-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
VS Code extension fails Spring Boot update #1142
Comments
Basically OpenRewrite fails to parse one or more of your java source files. We should definitely do better reporting the issue properly... A little popup window in the bottom-right corner showing a warning for example with the path of the source file that failed to parse would be very helpful i think. Also I think we could skip the file with the compilation error and perhaps try and upgrade everything else... Any chance you can share your project? Or a simplified version of it? You could also try 1.49 or 1.48 version of Spring Boot Tools for VSCode... It might just work since |
Thanks for the quick answer, since this is a company project I am not able to share it unfortunately. But the project tests and packages successfully, so I'm surprised that it's a source code issue. From a quick glance there are the usual deprecation warnings, but I see no serious issues. With extension v1.49 same thing happens, however with 1.48 the patch version update is indeed successful. Updating to 3.1 does something, but it looks like the process crashed midway, he did a lot of changes, but now there are compilation issues with Spring Security classes. |
I have pushed bb1cac8 to report the failed to parsed sources and to let the upgrade continue ignoring sources that failed to parse (if possible). The list of sources failed to parse would be shown in the small notification popup in the bottom-right corner. The spring boot language server log file would have more details with the exact errors and parsers that threw exception. There is a setting to output spring boot language server log to file. You can either find VSIX file here: https://dist.springsource.com/snapshot/STS4/nightly-distributions.html and install it into your VSCode or wait for the new 1.51 pre-release version that will become available on Thursday. Please try the fix let us know what happens. |
I've installed the VSIX-file from the given location and I've redirected the log into a file. The popup shows a single file failed to parse, and this is the related error from the log file:
Then a git diff follows that spans several hundreds of lines, but the important part seems to be this:
So there's a method param with a fully qualified type name and a |
@pappnase99 I suspect that the syntax |
No the syntax is strange but correct, the fully qualified name path belongs to the Item, not the Annotation. As a simplified example, this is valid code:
And this creates a compilation error: The compiler says
On a different discussion I found a link to this:
|
Rewrite Java Parser issue: openrewrite/rewrite#3683 |
I don't want to rain on your parade, but I think you are working with false assumptions. The quoted JLS sentence says
Note the "just" in there. All the annotations mentioned here and in the openrewrite issue are annotated with more than just TYPE_USE, so that sentence doesn't apply. To me the syntax remains illegal. Also ecj doesn't compile it, so it might be more pragmatic to change the original code. |
The org.eclipse.jdt.annotation.NonNull annotation has indeed |
Sorry, my fault. You are right. Confused it with rewrites NonNull definition when I checked. :) The openrewrite PR with Deprecated would not fit IMO, however. |
@Bananeweizen I have corrected the unit test in Rewrite to have annotation with String annotationSource = """
package example;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.CLASS)
@Target({ TYPE_USE })
public @interface NonNull {
// marker annotation with no members
}
""";
String source = """
package example;
import example.NonNull;
public class A {
java.lang.@NonNull String a;
}
"""; If this still does not fir the purpose feel free to propose corrections :-) |
Moving this to the next release (4.21.1) while waiting for the fix to appear in open rewrite. |
Fixed in OR. Latest OR jar adopted with 8a74023 hence should be fixed. Please try in snapshots found on https://dist.springsource.com/snapshot/STS4/nightly-distributions.html |
Yeah tried v1.52.0-202401091454 and worked for me. 👍 |
Describe the bug
I try to use the VS Code extension for an update of an outdated Spring Boot project that's on 2.7.7. When I try to update either to the latest 2.7 patch version or the latest major version 3.1.5, it fails with an exception like this:
OS: Win10, VS Code 1.84.1
Spring Boot Tools 1.50.0
I've set "spring-boot.ls.java.home" to a JDK 17 path in the settings.json.
Maybe there's something weird with this project, but I've no idea what to make of this error.
The text was updated successfully, but these errors were encountered: