This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
AnnotationProcessingQuery.Result.annotationProcessingEnabledInEditor() method should be added. For more information, see issue #183473.
Created attachment 96978 [details] Proposed change
Would like to see a clearer summary in this issue of what this change is for and why. I think the Javadoc is rather confusing. What does annotationProcessingEnabled() mean if not annotationProcessingEnabledInEditor()? Why is it off for freeform projects? Beware that this is an incompatible API change which will break autoproject.java unless you add that interface method (w/o @Override) in advance.
The reason is that some APs are slow (eg. eclipselink which parses xml every time it's invoked and it slows down the editor features). The goal of this API change is to add one more state when APs are enabled in ant and in the scan but not called in the editor every time you do a modification. The AP has to be called in scan (save) to allow Compile On Save. This state was missing in the current API. Also some APs are not handling errors correctly and enabling them in the editor where the AP is invoked in 90% on broken code is very dangerous, see issue #183473.
So maybe replace annotationProcessingEnabled() with annotationProcessingStatus() returning an enum {DISABLED, ONLY_ON_SAVE, ENABLED}.
OK - modifying annotationProcessingEnabled() to return a set of triggers on which the annotation processors should be run {ON_SCAN, IN_EDITOR}.
Created attachment 97363 [details] Updated proposal
java.freeform should use EnumSet.allOf, I think.
Jesse, should I rather create a customizer panel for it? I am afraid that slow AP on cp may make the editing of freeform java files very slow.
(In reply to comment #8) > should I rather create a customizer panel for it? If you want. > slow AP on cp may make the editing of freeform java files very slow You can always specify <classpath mode="processor"/> to disable the APs.
Disabling AP at all using <classpath mode="processor"/>seems enough as the freeform does not allow Compile On Save. I agree that returning EnumSet.allOf if there is processor path and EnumSet.noneOf otherwise is near to correct.
(In reply to comment #10) > returning EnumSet.allOf > if there is processor path and EnumSet.noneOf otherwise You can unconditionally return allOf, since java.source would not be running any APs anyway if the processor path is empty.
Pushed to jet-main. http://hg.netbeans.org/jet-main/rev/bce79a5e961f Once the change gets propagated to main-silver, I will change the autoproject.java.
Pushed to contrib. http://hg.netbeans.org/main/contrib/rev/4fe4c858d13b
Integrated into 'main-golden', will be available in build *201004160201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/bce79a5e961f User: Dusan Balek <dbalek@netbeans.org> Log: Modifying AnnotationProcessingQuery.Result.annotationProcessingEnabled() to return a set of triggers on which the annotation processors should be run (see issue #183793).