You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm running in lightweight/syntax only mode. At least, I'm trying to but the error is making me wonder.
If I write a class which extends a class that's not known to vscode-java (remember, I'm trying to run in standalone mode!) and I write another method in that class of the same name but different parameters (so not overriding the superclass method) as a method in the superclass, and elsewhere try to invoke the superclass method, I get a Problem, saying the method is not applicable for the arguments.
eg: In a completely standalone window, outside of any project, open a new Java source file with this:
public abstract class TestSyntax extends groovy.lang.Script {
public Object run(String parameter) {
return run();
}
}
The problem reported is:
The method run(String) in the type TestSyntax is not applicable for the arguments ()
The bug is that it's reporting this class of error at all. Obviously groovy.lang.Script is not available, so if I did nothing to make it available it wouldn't compile. But if vscode-java is in syntax/lightweight mode, it should only be reporting on any syntax errors, not on the failure to resolve this method.
There seems to be no option to suppress this obviously bogus message.
(The real-world situation is a gradle project which does depend on Groovy, and which builds just fine thank-you. But I've had no luck trying to get vscode-java to actually import even the simplest gradle project, so I've disabled, as far as I can determine, any attempt for it to do so. I just want syntax checking and a symbol browser for the class I'm in. But in the real case I am indeed writing a base class for scripts, which extends groovy.lang.Script, and so has a real similarity to what's happening here.)
Environment
Operating System: Mac OS Big Sur (intel)
JDK version: 16.0.1
Visual Studio Code version: 1.56.0
Java extension version: 0.79.1
Steps To Reproduce
Open a new Code window
Paste the above java source
Save it as TestSyntax.java so it knows it's a java file
The Problem will appear as a 1 next to the X in the bottom left. click on it to open and see
(I've done nothing to enable those incubator modules.)
If I try to load the java language server log I get an error saying there isn't one.
Current Result
Spurious error from incorrectly trying to resolve an out-of-classpath superclass method when in lightweight mode
The particular problem only occurs because there is another method of the same name (but different parameters) declared in the class. If I rename that eg: to runt(String parameter), the Problem disappears.
Expected Result
No errors relating to failing to resolve symbols when in lightweight syntax-only mode.
I mean, it could maybe do what it's doing if it's not extending unknown classes, because then the method call probably would be wrong. But if there's an extends or implements of any class or interface that isn't known to the language server's classloader, and it's in lightweight non-project mode and supposed to only be reporting syntax errors then it should presume that any such "missing" methods are there somewhere and let it pass.
Additional Informations
My main reason for thinking I'm in Lightweight mode is that I have an option to switch to Standard mode.
If I do that the above error doesn't go away, but I also get:
"TestSyntax.java is a non-project file, only syntax errors are reported"
Despite that clearly not being the case. But of course the real problem here seems to be that the "not applicable" error is incorrectly being thought of as a syntax error and being reported in a non-project file.
The text was updated successfully, but these errors were encountered:
I'm running in lightweight/syntax only mode. At least, I'm trying to but the error is making me wonder.
If I write a class which extends a class that's not known to vscode-java (remember, I'm trying to run in standalone mode!) and I write another method in that class of the same name but different parameters (so not overriding the superclass method) as a method in the superclass, and elsewhere try to invoke the superclass method, I get a Problem, saying the method is not applicable for the arguments.
eg: In a completely standalone window, outside of any project, open a new Java source file with this:
The problem reported is:
The bug is that it's reporting this class of error at all. Obviously
groovy.lang.Script
is not available, so if I did nothing to make it available it wouldn't compile. But if vscode-java is in syntax/lightweight mode, it should only be reporting on any syntax errors, not on the failure to resolve this method.There seems to be no option to suppress this obviously bogus message.
(The real-world situation is a gradle project which does depend on Groovy, and which builds just fine thank-you. But I've had no luck trying to get vscode-java to actually import even the simplest gradle project, so I've disabled, as far as I can determine, any attempt for it to do so. I just want syntax checking and a symbol browser for the class I'm in. But in the real case I am indeed writing a base class for scripts, which extends
groovy.lang.Script
, and so has a real similarity to what's happening here.)Environment
Steps To Reproduce
The entire extension log:
(I've done nothing to enable those incubator modules.)
If I try to load the java language server log I get an error saying there isn't one.
Current Result
Spurious error from incorrectly trying to resolve an out-of-classpath superclass method when in lightweight mode
The particular problem only occurs because there is another method of the same name (but different parameters) declared in the class. If I rename that eg: to
runt(String parameter)
, the Problem disappears.Expected Result
No errors relating to failing to resolve symbols when in lightweight syntax-only mode.
I mean, it could maybe do what it's doing if it's not extending unknown classes, because then the method call probably would be wrong. But if there's an extends or implements of any class or interface that isn't known to the language server's classloader, and it's in lightweight non-project mode and supposed to only be reporting syntax errors then it should presume that any such "missing" methods are there somewhere and let it pass.
Additional Informations
My main reason for thinking I'm in Lightweight mode is that I have an option to switch to Standard mode.
If I do that the above error doesn't go away, but I also get:
"TestSyntax.java is a non-project file, only syntax errors are reported"
Despite that clearly not being the case. But of course the real problem here seems to be that the "not applicable" error is incorrectly being thought of as a syntax error and being reported in a non-project file.
The text was updated successfully, but these errors were encountered: