-
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.
feat: support another edge case for Java.CharacterExpected
- Loading branch information
Showing
3 changed files
with
116 additions
and
8 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
5 changes: 5 additions & 0 deletions
5
error_templates/java/test_files/character_expected_call/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,5 @@ | ||
public class Main { | ||
public static void main(String[] args) { | ||
System.out.println("Hello, World!" // Error: Expected ';' | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
error_templates/java/test_files/character_expected_call/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 @@ | ||
name: "Call" | ||
template: "Java.CharacterExpectedError" | ||
--- | ||
Main.java:3: error: ')' or ',' expected | ||
System.out.println("Hello, World!" // Error: Expected ';' | ||
^ | ||
1 error | ||
=== | ||
template: "Java.CharacterExpectedError" | ||
--- | ||
# CharacterExpectedError | ||
This error occurs when there is an unexpected character in the code, and ')' is expected. | ||
``` | ||
public static void main(String[] args) { | ||
System.out.println("Hello, World!" // Error: Expected ';' | ||
^^^^^^^^^^^^^^^ | ||
} | ||
} | ||
``` | ||
## Steps to fix | ||
### Add the missing character | ||
Ensure that the array declaration has the correct syntax by adding the missing `)`. | ||
```diff | ||
public class Main { | ||
public static void main(String[] args) { | ||
- System.out.println("Hello, World!" // Error: Expected ';' | ||
+ System.out.println("Hello, World!") // Error: Expected ';' | ||
} | ||
} | ||
``` |