-
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 for locating missing class in Java.SymbolNotFoundError
- Loading branch information
Showing
4 changed files
with
63 additions
and
18 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
17 changes: 0 additions & 17 deletions
17
error_templates/java/test_files/no_class_def_error/test.txt
This file was deleted.
Oops, something went wrong.
File renamed without changes.
40 changes: 40 additions & 0 deletions
40
error_templates/java/test_files/symbol_not_found_error_missing_class/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,40 @@ | ||
name: "MissingClass" | ||
template: "Java.SymbolNotFoundError" | ||
--- | ||
MyClass.java:5: error: cannot find symbol | ||
NonExistingClass obj = new NonExistingClass(); | ||
^ | ||
symbol: class NonExistingClass | ||
location: class MyClass | ||
MyClass.java:5: error: cannot find symbol | ||
NonExistingClass obj = new NonExistingClass(); | ||
^ | ||
symbol: class NonExistingClass | ||
location: class MyClass | ||
2 errors | ||
=== | ||
template: "Java.SymbolNotFoundError" | ||
--- | ||
# SymbolNotFoundError | ||
The error indicates that the compiler cannot find the class `NonExistingClass` when attempting to create an instance of it in the `MyClass` class. | ||
``` | ||
// Attempting to create an instance of a non-existing class | ||
NonExistingClass obj = new NonExistingClass(); | ||
^^^^^^^^^^^^^^^^ | ||
} | ||
} | ||
``` | ||
## Steps to fix | ||
### Create the missing class | ||
Create a new class named `NonExistingClass` to resolve the "cannot find symbol" error. | ||
```diff | ||
// MyClass.java | ||
- public class MyClass { | ||
+ class NonExistingClass { | ||
+ // Add any necessary code for NonExistingClass class | ||
+ } | ||
+ | ||
+ public class MyClass { | ||
public static void main(String[] args) { | ||
// Attempting to create an instance of a non-existing class | ||
``` |