-
Notifications
You must be signed in to change notification settings - Fork 566
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
Get annotation processing going with Eclipse Compiler for Java #8913
base: main
Are you sure you want to change the base?
Conversation
Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA).
To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application. When signing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated. If you are an Oracle employee, please make sure that you are a member of the main Oracle GitHub organization, and your membership in this organization is public. |
If you want to go forward with this PR, kindly sign the OCA, as otherwise we cannot accept your contribution. |
@tomas-langer I added one more commit to handle the last case I had issues with when using Eclipse IDE. Can you have a look at it as well? I signed the OCA already, I guess it needs a bit to be approved. |
Thank you for signing the OCA. |
@@ -76,7 +76,11 @@ public void lines(List<String> newLines) { | |||
public void write() { | |||
if (modified) { | |||
if (originalResource != null) { | |||
originalResource.delete(); | |||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This means that it will only work with clean compile
and will not be able to do incremental build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume deleting a resource only fails when using ECJ and javac
wouldn't fail to delete the fail, right?
@@ -161,6 +161,10 @@ public static Optional<TypeName> createTypeName(TypeElement element, TypeMirror | |||
* @return the associated type name instance | |||
*/ | |||
public static Optional<TypeName> createTypeName(Element type) { | |||
if (type == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This actually violates Helidon design (we only support non-null parameters - always).
We can merge it, I will create a follow up to fix this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall I add a comment here that this was added only to get ECJ running?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added a comment as to why this check was added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I cannot merge this:
- The
ConfigMetadataHandler
needs copyright update (I could do this on my own) - The change you did for writing the stack trace is causing a spotbugs failure. So either this needs to be added as an exception (requires
etc/spotbugs/exclude.xml
file in the module + update of pom file (example can be found inconfig/config
module. or it must be reverted to original
52b3cb3
to
3fe941e
Compare
3fe941e
to
c0bf510
Compare
@tomas-langer I updated the PR, can you have a look again? |
491f326
to
1e4ed11
Compare
@tomas-langer can you have a look at the PR again? I think I addressed all your points. It would be great to gave it to get Eclipse IDE running. |
I fixed the Checkstyle error just now. I don't know what we do with the failing tests/native-image-mp-1-macos job. Could it be flappy? |
Problem
I'm writing a HTTP feature for Helidon (related to #8897) and want to work with Eclipse IDE, but the Helidon annotation processors throw an exception because the Eclipse Compiler for Java (ECJ) behaves slightly different compared to javac.
Solution
Some changes were necessary to get the annotation processing going:
javax.tools.StandardLocation.SOURCE_PATH
implemented and therefore the search formodule-info.java
fails with a thrownIllegalArgumentException
. Ignoring this exception when compiling with the ECJ is fine.Element
parameter is null. Returning an emptyOptional
enables the caller to fall back.FileObject
throws anIllegalStateException
. Ignoring any exception when compiling with the ECJ should be fine.I have successfully tested the changes suggested here in a current Eclipse IDE (
Version: 2024-06 (4.32.0)
) on my local computer.