Bug 514055 - Annotation processing not used until I manually enable / disable the APT processing preference
Summary: Annotation processing not used until I manually enable / disable the APT proc...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: APT (show other bugs)
Version: 4.7   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Generic inbox for the JDT-APT component CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2017-03-22 07:42 EDT by Lars Vogel CLA
Modified: 2022-08-24 11:38 EDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Vogel CLA 2017-03-22 07:42:10 EDT
From https://github.com/tbroyer/gradle-apt-plugin/issues/17#issuecomment-193221821

1.) Clone https://github.com/traggatt/AptTest
2.) Run ./gradlew eclipseJdtApt eclipseFactorypath via the command line
3.) Import the project via the Gradle import wizard

-> Compile error, even though annotation processing is correct setup

Clean project -> does not fix it

You need to disable and re-enable annotation processing to make it work which should be necessary. 

Quote from the Github issue: "For as far as I can remember, I always had those kind of issues with Eclipse annotation processing (one of the reasons I personally switched to IntelliJ; YMMV)"
Comment 1 Lars Vogel CLA 2017-03-22 08:32:33 EDT
This issue is also mentioned here: https://grundlefleck.github.io/2014/07/23/configuring-google-autovalue.html

Quote: There was also a weird issue Iā€™m blaming on Eclipse. Even with the correct config files, when I imported the project, I needed to turn annotation processing off and on again to get it to work. Nasty.
Comment 2 Walter Harley CLA 2017-04-03 01:56:02 EDT
Can we get a description of what the actual repro scenario is?  What is it that is special about this particular repro?
Comment 3 Lars Vogel CLA 2017-04-03 10:38:04 EDT
(In reply to Walter Harley from comment #2)
> Can we get a description of what the actual repro scenario is?  What is it
> that is special about this particular repro?

AFAICT there is nothing special about the repo, I assume any change from  outside of the IDE for this preference does not enable the APT processing. I still need to validate that assumption (sorry lack of time so far).

My assumption would be that we are missing a preference listener for the AptPreferenceConstants.APT_ENABLED preference. I would guess that we only have a SelectionListener on the button and if I disable and enable annotation processing via the preference setting this functionality is activated.

I had a quick lock at SelectionButtonDialogField and ProcessorOptionsAdapter which seems relevant. Are you aware of a preference listener for AptPreferenceConstants.APT_ENABLED?
Comment 4 Ashok Koyi CLA 2018-04-24 16:11:54 EDT
I created a sample project that integrated lombok + mapstruct + gradle + Eclipse Oxygen (with buildship plugin). The sample project is located at https://github.com/thekalinga/gradle-apt-plugin-eclipse-issue

But, Eclipse does not generate mapstruct (one of the annotation processor available in the dependencies) classes. I'm unable to figure out what could be causing this issue

I checked with the author of the gradle apt plugin. He says that the eclipse configuration is fine from the point of view of the gradle plugin. I am able to use the same applciation in intellij without any issue

Here is the comment from the author

https://github.com/tbroyer/gradle-apt-plugin/issues/79#issuecomment-383393121

Is there any chance this issue will be fixed?

ADDITIONAL DETAILS
--
Here is the version of eclipse I tried this with (+ I also tried in STS, where too I have exactly the same issue)

Version: Oxygen.3a Release (4.7.3a)
Build id: 20180405-1200

I have used Lombok v1.16.20 "Dancing Elephant" along with eclipse
Comment 5 giacomo scaparrotti CLA 2020-06-18 10:40:30 EDT
as of june 2020 this bug is still open (eclipse 4.12). any news?
Comment 6 Jay Arthanareeswaran CLA 2020-06-22 01:47:07 EDT
I don't see a great chance of this getting fixed as the team is smaller now and busy with new Java versions support. If someone is willing to work on this, that'll be welcome.
Comment 7 Eclipse Genie CLA 2022-08-24 11:38:06 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.