Bug 565214 - annotation processor fails to run for annotated class generated in previous round
Summary: annotation processor fails to run for annotated class generated in previous r...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: APT (show other bugs)
Version: 4.17   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Generic inbox for the JDT-APT component CLA
QA Contact:
URL: https://github.com/charkins/ecj-apt-i...
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-14 11:08 EDT by Casey Harkins CLA
Modified: 2022-08-18 03:45 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.