-
Notifications
You must be signed in to change notification settings - Fork 440
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
Java extension pack does not work with Micronaut 4 applications. #3223
Comments
Looks like related to to annotation processing because of the mention Is the build successful in Eclipse? If the application can be launched successfully in Eclipse, then the build should be fine. @sdedic Would you please take a look as well? @testforstephen |
Good point: although the project
Actually the behaviour with explicit builds (Automatic build disabled) is quite erratic. I tried to close/open project(s) and restart Eclipse IDE
Note: I mentioned Eclipse just because I thought the compilation + problems engine is mostly the same as in vscode lang server for java, so I was surprised with the behaviour difference. |
This is a known issue of ECJ compiler, see eclipse-jdt/eclipse.jdt.core#543. ECJ requires all indirect dependencies in the build path when compiling a project. But in your sample micronaut project, there is a dependency The workaround is to explicitly add the missing dependency implementation('io.micronaut:micronaut-core-processor:4.0.1') |
@testforstephen hm ! Anyway, gradle buildsys is apparently able to build the project, it seems to collect "somehow" the dependencies properly - shouldn't be the project info on par with that ? |
To anwer myself. No: The suggested workaround is not 'correct' as well, as it leaks internal AP dependencies to the consuming project(s). BTW the issue affects also Maven (see |
this is unfortunate behaviour of Eclipse JDT. No wonder nobody it is rarely used when annotation processors are used extensively. I have tried to implement a workaround micronaut-projects/micronaut-core#9634 in Micronaut, but this may come up again as this is clearly broken behaviour of the IDE |
So 4.0.2 is out and the build problem is gone, but now it doesn't look like annotation processors are running at all |
Here is the exception log for this failure.
Looks like the annotation processors used in this sample project do not generate new source files but manipulate the existing source file ECJ compiler will abort the compilation when it detects some source files have been changed during compilation. In case you're interested to investigate the compiler further, here is the ECJ compiler code that throws the exception. |
@testforstephen we do not manipulate the AST at all in Micronaut, the call here causing the issue is a simple lookup by class name:
All it does is call
There are no issues with with this with javac. That said we will look if we can place yet another workaround for Eclipse JDT into the codebase. |
btw how do you get to those logs? |
I pushed another workaround for this bug in Eclipse JDT micronaut-projects/micronaut-core#9660 |
Here is a more simple testcase for this bug. I suggest to upgrade the bug description, as the bug potentially affects way more APs than just Micronaut's one. |
F1 -> Java: Open Java Language Server Log File |
A related Eclipse bug - https://bugs.eclipse.org/bugs/show_bug.cgi?id=547970 |
Note though that this ticket actually talks about 2 different issues:
|
Environment
Steps To Reproduce
Projects created for Micronaut 3.10 (3.9.x) works OK, projects targetting Micronaut 4.x fail to work properly in vscode.
The sample projects are attached: demo4.zip (gradle Micronaut 4.0.1), demom4.zip
(maven Micronaut 4.0.1), demo2.zip(gradle, Micronaut 3.10-SNAPSHOT -- working). During testing and switching projects, the demo4 project appeared to load OK two times, but mostly fails. The seemingly successful opens were:
open demo2, then create new window and open demo4 there. Appeared without Problems once (further attempt failed with the reported problem)
open demo2, then Close Folder, and Open Folder demo4 in the current vscode (empty) window. (again, once seemed to load OK, other attempts fail)
In both successful cases, I can't say for sure the progress for "Opening Java projects" appeared at all, maybe the extension did not load fully (?)
demo2.zip -- working
demo4.zip -- fails
demom4.zip -- fails too
Logs: jdtls.log
Current Result
Rebuild All
orRebuild Project
actions fail.The problems window shows the following messages:
The application fails to launch:
Expected Result
No problems :) or just normal code issues.
Additional Informations
Default (system) Java version:
vscode version:
Installed extensions:
Suprisingly, opening the projects in Eclipse J2EE IDE shows no problems - screenshots of the Problems window:
The text was updated successfully, but these errors were encountered: