Bug 565214

Summary: annotation processor fails to run for annotated class generated in previous round
Product: [Eclipse Project] JDT Reporter: Casey Harkins <charkins>
Component: APTAssignee: Generic inbox for the JDT-APT component <jdt-apt-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3    
Version: 4.17   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
URL: https://github.com/charkins/ecj-apt-issue
Whiteboard: stalebug

Description Casey Harkins CLA 2020-07-14 11:08:24 EDT
When an annotation processor generates a class file which is itself annotated, the generated class is not being processed in a subsequent annotation processing round. If a .java file is generated instead of directly generating the class file, the issue does not arise. I have attempted to put together a relatively
minimal working example to demonstrate the bug:

https://github.com/charkins/ecj-apt-issue

There are effectively 4 source files in this project, the annotation (X.java), the processor (XProcessor.java) and two example classes that are annotated with X (Foo.java and Bar.java). The X annotation in this example takes an array of booleans to control generating source/classes recursively. Hopefully this approach isn't too confusing as an example, but it allowed keeping code to a minimum.

The README.md provides some detail, but the TLDR is that javac runs XProcessor for each java or class file generated, while ecj only runs XProcessor for java files that are generated.
Comment 1 Casey Harkins CLA 2020-07-14 14:21:23 EDT
This could be a duplicate of bug #527420 and comment 4 seems to suggest that generating class files directly (without generating java) is less well defined/tested.
Comment 2 Eclipse Genie CLA 2022-08-18 03:45:27 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.