-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: illegal expression start not showing
- Loading branch information
Showing
3 changed files
with
69 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
error_templates/java/test_files/illegal_expression_start_error_if/Main.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
public class Main { | ||
public static void main(String[] args) { | ||
int inventoryCount = 10; | ||
String item = "a"; | ||
System.out.println(item); | ||
|
||
if (true) { | ||
System.out.println("b"); | ||
) else { | ||
System.out.println("c"); | ||
} | ||
} | ||
} | ||
|
30 changes: 30 additions & 0 deletions
30
error_templates/java/test_files/illegal_expression_start_error_if/test.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
template: "Java.IllegalExpressionStartError" | ||
name: "If" | ||
--- | ||
Main.java:9: error: illegal start of expression | ||
) else { | ||
^ | ||
1 errors | ||
=== | ||
template: "Java.IllegalExpressionStartError" | ||
--- | ||
# IllegalExpressionStartError | ||
This error occurs when the compiler encounters an expression that is not valid. | ||
``` | ||
System.out.println("b"); | ||
) else { | ||
^^^^^^ | ||
System.out.println("c"); | ||
} | ||
``` | ||
## Steps to fix | ||
### Use the right closing bracket | ||
Ensure that the right closing bracket for the else branch of your if statement is used. | ||
```diff | ||
if (true) { | ||
System.out.println("b"); | ||
- ) else { | ||
+ } else { | ||
System.out.println("c"); | ||
} | ||
``` |