Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!

Bug 183793

Summary: Add AnnotationProcessingQuery.Result.annotationProcessingEnabledInEditor() method
Product: java Reporter: Dusan Balek <dbalek>
Component: SourceAssignee: Dusan Balek <dbalek>
Status: RESOLVED FIXED QA Contact: issues <issues.netbeans.org>
Priority: P3 CC: jglick, tzezula
Version: 6.xKeywords: API, API_REVIEW_FAST
Target Milestone: 6.x   
Hardware: All   
OS: All   
Whiteboard:
Issue Type: DEFECT Exception Report:
Attachments: Proposed change
Updated proposal

Description Dusan Balek 2010-04-09 16:52:49 UTC
AnnotationProcessingQuery.Result.annotationProcessingEnabledInEditor() method should be added. For more information, see issue #183473.
Comment 1 Dusan Balek 2010-04-09 17:27:43 UTC
Created attachment 96978 [details]
Proposed change
Comment 2 Jesse Glick 2010-04-09 19:00:41 UTC
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.
Comment 3 Tomas Zezula 2010-04-09 20:00:27 UTC
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.
Comment 4 Jesse Glick 2010-04-09 20:27:09 UTC
So maybe replace annotationProcessingEnabled() with annotationProcessingStatus() returning an enum {DISABLED, ONLY_ON_SAVE, ENABLED}.
Comment 5 Dusan Balek 2010-04-14 15:15:08 UTC
OK - modifying annotationProcessingEnabled() to return a set of triggers on which the annotation processors should be run {ON_SCAN, IN_EDITOR}.
Comment 6 Dusan Balek 2010-04-14 15:16:11 UTC
Created attachment 97363 [details]
Updated proposal
Comment 7 Jesse Glick 2010-04-14 16:26:35 UTC
java.freeform should use EnumSet.allOf, I think.
Comment 8 Tomas Zezula 2010-04-14 16:48:04 UTC
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.
Comment 9 Jesse Glick 2010-04-14 16:56:25 UTC
(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.
Comment 10 Tomas Zezula 2010-04-14 17:06:58 UTC
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.
Comment 11 Jesse Glick 2010-04-14 17:27:53 UTC
(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.
Comment 12 Dusan Balek 2010-04-15 08:28:33 UTC
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.
Comment 13 Dusan Balek 2010-04-15 15:27:22 UTC
Pushed to contrib.

http://hg.netbeans.org/main/contrib/rev/4fe4c858d13b
Comment 14 Quality Engineering 2010-04-16 04:21:14 UTC
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).
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo