-
Notifications
You must be signed in to change notification settings - Fork 136
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
Support an alternative compiler (e.g., Javac) to build projects and generate class files #2490
Comments
jdt is not only used to generate .class files but also for things like codecompletion, refactorings etc. it is an alternative to javac. see also |
Indeed, and it's already done in a fork.
To be clear, the work is already done, and no-one is asking help nor anyone else to put extra manpower here as most of the work is already done in a fork. I understand that current contributors can be busy, but we're not trying to make them any busier (beyond just saying "yes, we can welcome code that allows to use an alternative AbstractImageBuilder"); so this argument doesn't really stand here. |
There is technical no need to make any change in jdt, just define your own "javac" nature with its own builder and leave the jdt.core.javanature as is. |
Yes, there is a need for it as the JavaBuilder does evaluate what files to builds according to build order, modified resources and so on. We don't want to duplicate that important bit of smartness, we just want to reusing and be able to hook in an alternative code generation while still reusing most JDT smartness. |
I personally think having a handy option to switch to alternative compiler implementation would be interesting (for example to investigate compiler differences). So if you made already some progress and have something to show, please create draft PR to discuss. |
FYI: Once problematic code has been isolated to a test case the option to run ecj and javac back-to-back is already baked into our test infrastructure (AbstractRegressionTest). I've started to rely more on that for BETA_JAVA23 development. |
I think we can close it (I cannot do it as I'm not a committer), since #2497 is merged and we have a demo showing it works as expected. |
From time to time, we observe discrepancies in compiler implementation between ECJ and Javac, particularly in areas such as generic type inference and annotation processing. Often, build tools like Maven or Gradle can compile the project successfully, but ECJ fails, causing compilation errors that block the run/debug behavior in the IDE.
To address this, we're experimenting with allowing the JDT to support an alternative compiler for building Java projects and generating class files. This new compiler would be used by JavaBuilder for project compilation only and would not impact basic language features like code completion and navigation, which would continue to use ECJ for the type system. We believe that offering an alternative compiler will benefit both the IDE and developers, allowing them to choose the compiler that best suits their needs.
To integrate a new compiler in JavaBuilder, we need to make minor refactorings to the AbstractImageBuilder, specifically to open up the API for initializing a different compiler. The implementation of the new compiler itself can be handled in a separate plugin.
We are opening this ticket to initiate the discussion. In the meantime, we will prepare a draft pull request to discuss the API design required to support a new compiler in JavaBuilder.
The text was updated successfully, but these errors were encountered: