Bug 567116 - APT behaving differently to Java compiler and not visiting classes generated by another annotation processor
Summary: APT behaving differently to Java compiler and not visiting classes generated ...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: APT (show other bugs)
Version: 4.18   Edit
Hardware: All All
: P3 major with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: Generic inbox for the JDT-APT component CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2020-09-18 07:26 EDT by Graeme Rocher CLA
Modified: 2023-06-11 05:24 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Graeme Rocher CLA 2020-09-18 07:26:22 EDT
In Micronaut 2.0 we introduced support for incremental compilation annotation processing with Gradle. This works by having another annotation processor that visits all generated classes that are annotated with "Generated". See 

https://github.com/micronaut-projects/micronaut-core/blob/6e2f1d1b180ed56b31590e609503468c3e7c2490/inject-java/src/main/java/io/micronaut/annotation/processing/ServiceDescriptionProcessor.java#L37

This works fine with javac, Gradle, Maven and everything else but seems to be a problem with Eclipse which never triggers ServiceDescriptionProcessor

It is really undesirable to have to have 2 ways to do things (one for Eclipse and one for javac) and this should really be fixed in Eclipse itself which should behave the same as javac with respect to annotation processors.

To reproduce you can do the following:

---

curl https://launch.micronaut.io/example.zip\?build\=maven\&features\=aws-lambda -o example.zip
unzip example.zip -d example
Archive:  example.zip
  inflating: example/micronaut-cli.yml
  inflating: example/Dockerfile
  inflating: example/src/main/java/example/Book.java
  inflating: example/src/main/java/example/BookSaved.java
  inflating: example/src/main/java/example/BookController.java
  inflating: example/src/test/java/example/BookControllerTest.java
  inflating: example/src/main/resources/logback.xml
  inflating: example/.mvn/wrapper/maven-wrapper.jar
  inflating: example/.mvn/wrapper/maven-wrapper.properties
  inflating: example/.mvn/wrapper/MavenWrapperDownloader.java
  inflating: example/mvnw
  inflating: example/mvnw.bat
  inflating: example/pom.xml
  inflating: example/.gitignore
  inflating: example/src/main/resources/application.yml
  inflating: example/README.md
---

Import the project into Eclipse then run the test and it will fail.

Now run

---
./mvnw test
---

The test will pass. The difference is when javac compiles service definitions are generated into "target/classes/META-INF" whilst when Eclipse compiles they are not.
Comment 1 Eclipse Genie CLA 2023-06-11 05:24:23 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.