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.

View | Details | Raw Unified | Return to bug 183793
Collapse All | Expand All

(-)a/api.java/apichanges.xml (+14 lines)
Lines 73-78 Link Here
73
<!-- ACTUAL CHANGES BEGIN HERE: -->
73
<!-- ACTUAL CHANGES BEGIN HERE: -->
74
74
75
<changes>
75
<changes>
76
        <change id="ap-query-triggers">
77
            <api name="classpath"/>
78
            <summary>Introducing AnnotationProcessingQuery.Result.Trigger</summary>
79
            <version major="1" minor="28"/>
80
            <date day="9" month="4" year="2010"/>
81
            <author login="dbalek"/>
82
            <compatibility addition="yes" modification="no" semantic="compatible" source="compatible" binary="compatible"/>
83
            <description>
84
                <p>Modifying AnnotationProcessingQuery.Result.annotationProcessingEnabled() to return a set of triggers on which the annotation processors should be run.
85
                </p>
86
            </description>
87
            <class package="org.netbeans.api.java.queries" name="AnnotationProcessingQuery" />
88
            <issue number="183793"/>
89
        </change>
76
        <change id="ap-query-processoroptions">
90
        <change id="ap-query-processoroptions">
77
            <api name="classpath"/>
91
            <api name="classpath"/>
78
            <summary>Introducing AnnotationProcessingQuery.Result.processorOptions</summary>
92
            <summary>Introducing AnnotationProcessingQuery.Result.processorOptions</summary>
(-)a/api.java/manifest.mf (-1 / +1 lines)
Lines 1-6 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.netbeans.api.java/1
2
OpenIDE-Module: org.netbeans.api.java/1
3
OpenIDE-Module-Specification-Version: 1.27
3
OpenIDE-Module-Specification-Version: 1.28
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/api/java/queries/Bundle.properties
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/api/java/queries/Bundle.properties
5
AutoUpdate-Show-In-Client: false
5
AutoUpdate-Show-In-Client: false
6
6
(-)a/api.java/src/org/netbeans/api/java/queries/AnnotationProcessingQuery.java (-5 / +21 lines)
Lines 41-47 Link Here
41
41
42
import java.net.URL;
42
import java.net.URL;
43
import java.util.Collections;
43
import java.util.Collections;
44
import java.util.EnumSet;
44
import java.util.Map;
45
import java.util.Map;
46
import java.util.Set;
45
import javax.swing.event.ChangeListener;
47
import javax.swing.event.ChangeListener;
46
import org.netbeans.api.annotations.common.CheckForNull;
48
import org.netbeans.api.annotations.common.CheckForNull;
47
import org.netbeans.api.annotations.common.NonNull;
49
import org.netbeans.api.annotations.common.NonNull;
Lines 85-95 Link Here
85
     */
87
     */
86
    public static interface Result {
88
    public static interface Result {
87
89
88
        /**Whether the annotation processors should be run inside Java editor.
90
        /**When the annotation processors should be run.
89
         *
91
         *
90
         * @return true if and only if the annotation processors should be run inside the Java editor
92
         * @return returns a set of triggers on which the annotation processors should be run
93
         * @since org.netbeans.api.java/1 1.27
91
         */
94
         */
92
        public boolean annotationProcessingEnabled();
95
        public @NonNull Set<? extends Trigger> annotationProcessingEnabled();
93
96
94
        /**Which annotation processors should be run.
97
        /**Which annotation processors should be run.
95
         *
98
         *
Lines 128-136 Link Here
128
        public void removeChangeListener(@NonNull ChangeListener l);
131
        public void removeChangeListener(@NonNull ChangeListener l);
129
    }
132
    }
130
133
134
    /** Annotation processing triggers
135
     */
136
    public static enum Trigger {
137
138
        /** Annotation processors should run on scanning
139
         */
140
        ON_SCAN,
141
        /** Annotation processors should run on every modification of a file in editor
142
         */
143
        IN_EDITOR
144
    }
145
131
    private static final Result EMPTY = new Result() {
146
    private static final Result EMPTY = new Result() {
132
        public boolean annotationProcessingEnabled() {
147
133
            return false;
148
        public Set<? extends Trigger> annotationProcessingEnabled() {
149
            return EnumSet.noneOf(Trigger.class);
134
        }
150
        }
135
151
136
        public Iterable<? extends String> annotationProcessorsToRun() {
152
        public Iterable<? extends String> annotationProcessorsToRun() {
(-)a/apisupport.project/manifest.mf (-1 / +1 lines)
Lines 6-10 Link Here
6
  org.netbeans.api.javahelp.Help
6
  org.netbeans.api.javahelp.Help
7
OpenIDE-Module-Layer: org/netbeans/modules/apisupport/project/ui/resources/layer.xml
7
OpenIDE-Module-Layer: org/netbeans/modules/apisupport/project/ui/resources/layer.xml
8
AutoUpdate-Show-In-Client: false
8
AutoUpdate-Show-In-Client: false
9
OpenIDE-Module-Specification-Version: 1.41
9
OpenIDE-Module-Specification-Version: 1.42
10
10
(-)a/apisupport.project/src/org/netbeans/modules/apisupport/project/queries/AnnotationProcessingQueryImpl.java (-2 / +5 lines)
Lines 41-49 Link Here
41
41
42
import java.net.URL;
42
import java.net.URL;
43
import java.util.Collections;
43
import java.util.Collections;
44
import java.util.EnumSet;
44
import java.util.Map;
45
import java.util.Map;
46
import java.util.Set;
45
import javax.swing.event.ChangeListener;
47
import javax.swing.event.ChangeListener;
46
import org.netbeans.api.java.queries.AnnotationProcessingQuery.Result;
48
import org.netbeans.api.java.queries.AnnotationProcessingQuery.Result;
49
import org.netbeans.api.java.queries.AnnotationProcessingQuery.Trigger;
47
import org.netbeans.modules.apisupport.project.NbModuleProject;
50
import org.netbeans.modules.apisupport.project.NbModuleProject;
48
import org.netbeans.spi.java.queries.AnnotationProcessingQueryImplementation;
51
import org.netbeans.spi.java.queries.AnnotationProcessingQueryImplementation;
49
import org.openide.filesystems.FileObject;
52
import org.openide.filesystems.FileObject;
Lines 82-89 Link Here
82
        }
85
        }
83
86
84
        @Override
87
        @Override
85
        public boolean annotationProcessingEnabled() {
88
        public Set<? extends Trigger> annotationProcessingEnabled() {
86
            return true;
89
            return EnumSet.allOf(Trigger.class);
87
        }
90
        }
88
91
89
        @Override
92
        @Override
(-)a/java.api.common/manifest.mf (-1 / +1 lines)
Lines 1-4 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.netbeans.modules.java.api.common/0
2
OpenIDE-Module: org.netbeans.modules.java.api.common/0
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/java/api/common/resources/Bundle.properties
3
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/java/api/common/resources/Bundle.properties
4
OpenIDE-Module-Specification-Version: 1.16
4
OpenIDE-Module-Specification-Version: 1.17
(-)a/java.api.common/src/org/netbeans/modules/java/api/common/queries/AnnotationProcessingQueryImpl.java (-4 / +9 lines)
Lines 47-53 Link Here
47
import java.net.MalformedURLException;
47
import java.net.MalformedURLException;
48
import java.net.URL;
48
import java.net.URL;
49
import java.util.Arrays;
49
import java.util.Arrays;
50
import java.util.Collections;
50
import java.util.EnumSet;
51
import java.util.HashSet;
51
import java.util.HashSet;
52
import java.util.LinkedHashMap;
52
import java.util.LinkedHashMap;
53
import java.util.Map;
53
import java.util.Map;
Lines 56-61 Link Here
56
import java.util.logging.Logger;
56
import java.util.logging.Logger;
57
import javax.swing.event.ChangeListener;
57
import javax.swing.event.ChangeListener;
58
import org.netbeans.api.java.queries.AnnotationProcessingQuery.Result;
58
import org.netbeans.api.java.queries.AnnotationProcessingQuery.Result;
59
import org.netbeans.api.java.queries.AnnotationProcessingQuery.Trigger;
59
import org.netbeans.spi.java.queries.AnnotationProcessingQueryImplementation;
60
import org.netbeans.spi.java.queries.AnnotationProcessingQueryImplementation;
60
import org.netbeans.spi.project.support.ant.AntProjectHelper;
61
import org.netbeans.spi.project.support.ant.AntProjectHelper;
61
import org.netbeans.spi.project.support.ant.PropertyEvaluator;
62
import org.netbeans.spi.project.support.ant.PropertyEvaluator;
Lines 113-121 Link Here
113
            evaluator.addPropertyChangeListener(WeakListeners.propertyChange(this, evaluator));
114
            evaluator.addPropertyChangeListener(WeakListeners.propertyChange(this, evaluator));
114
        }
115
        }
115
116
116
        public boolean annotationProcessingEnabled() {
117
        public Set<? extends Trigger> annotationProcessingEnabled() {
117
            return    TRUE.contains(evaluator.getProperty(annotationProcessingEnabledProperty))
118
            EnumSet<Trigger> set = EnumSet.noneOf(Trigger.class);
118
                   && TRUE.contains(evaluator.getProperty(annotationProcessingEnabledInEditorProperty));
119
            if (TRUE.contains(evaluator.getProperty(annotationProcessingEnabledProperty)))
120
                set.add(Trigger.ON_SCAN);
121
            if (TRUE.contains(evaluator.getProperty(annotationProcessingEnabledInEditorProperty)))
122
                set.add(Trigger.IN_EDITOR);
123
            return set;
119
        }
124
        }
120
125
121
        public Iterable<? extends String> annotationProcessorsToRun() {
126
        public Iterable<? extends String> annotationProcessorsToRun() {
(-)a/java.api.common/src/org/netbeans/modules/java/api/common/queries/QuerySupport.java (+1 lines)
Lines 288-293 Link Here
288
     * @param helper project's AntProjectHelper
288
     * @param helper project's AntProjectHelper
289
     * @param evaluator project's evaluator
289
     * @param evaluator project's evaluator
290
     * @param annotationProcessingEnabledProperty property whose value says whether the annotation processing is enabled for the given project at all
290
     * @param annotationProcessingEnabledProperty property whose value says whether the annotation processing is enabled for the given project at all
291
     *                                                    (will be returned from {@link Result#annotationProcessingEnabled()})
291
     * @param annotationProcessingEnabledInEditorProperty property whose value says whether the annotation processing should be enabled
292
     * @param annotationProcessingEnabledInEditorProperty property whose value says whether the annotation processing should be enabled
292
     *                                                    in the editor (will be returned from {@link Result#annotationProcessingEnabled())}
293
     *                                                    in the editor (will be returned from {@link Result#annotationProcessingEnabled())}
293
     * @param runAllAnnotationProcessorsProperty when true, {@link Result#annotationProcessorsToRun()} will return null
294
     * @param runAllAnnotationProcessorsProperty when true, {@link Result#annotationProcessorsToRun()} will return null
(-)a/java.freeform/manifest.mf (-1 / +1 lines)
Lines 1-6 Link Here
1
Manifest-Version: 1.0
1
Manifest-Version: 1.0
2
OpenIDE-Module: org.netbeans.modules.java.freeform/1
2
OpenIDE-Module: org.netbeans.modules.java.freeform/1
3
OpenIDE-Module-Specification-Version: 1.19
3
OpenIDE-Module-Specification-Version: 1.20
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/java/freeform/Bundle.properties
4
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/java/freeform/Bundle.properties
5
OpenIDE-Module-Layer: org/netbeans/modules/java/freeform/resources/layer.xml
5
OpenIDE-Module-Layer: org/netbeans/modules/java/freeform/resources/layer.xml
6
AutoUpdate-Show-In-Client: false
6
AutoUpdate-Show-In-Client: false
(-)a/java.freeform/src/org/netbeans/modules/java/freeform/AnnotationProcessingQueryImpl.java (-2 / +5 lines)
Lines 41-49 Link Here
41
41
42
import java.net.URL;
42
import java.net.URL;
43
import java.util.Collections;
43
import java.util.Collections;
44
import java.util.EnumSet;
44
import java.util.Map;
45
import java.util.Map;
46
import java.util.Set;
45
import javax.swing.event.ChangeListener;
47
import javax.swing.event.ChangeListener;
46
import org.netbeans.api.java.queries.AnnotationProcessingQuery.Result;
48
import org.netbeans.api.java.queries.AnnotationProcessingQuery.Result;
49
import org.netbeans.api.java.queries.AnnotationProcessingQuery.Trigger;
47
import org.netbeans.spi.java.queries.AnnotationProcessingQueryImplementation;
50
import org.netbeans.spi.java.queries.AnnotationProcessingQueryImplementation;
48
import org.openide.filesystems.FileObject;
51
import org.openide.filesystems.FileObject;
49
52
Lines 56-63 Link Here
56
59
57
    public @Override Result getAnnotationProcessingOptions(FileObject file) {
60
    public @Override Result getAnnotationProcessingOptions(FileObject file) {
58
        return new Result() {
61
        return new Result() {
59
            public @Override boolean annotationProcessingEnabled() {
62
            public @Override Set<? extends Trigger> annotationProcessingEnabled() {
60
                return true;
63
                return EnumSet.of(Trigger.ON_SCAN);
61
            }
64
            }
62
            public @Override Iterable<? extends String> annotationProcessorsToRun() {
65
            public @Override Iterable<? extends String> annotationProcessorsToRun() {
63
                return null;
66
                return null;
(-)a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/J2SEPersistenceProvider.java (-2 / +2 lines)
Lines 315-322 Link Here
315
                                changed = true;
315
                                changed = true;
316
                            }
316
                            }
317
                        }
317
                        }
318
                        if (!J2SEProjectUtil.isTrue(prop.getProperty(ProjectProperties.ANNOTATION_PROCESSING_ENABLED_IN_EDITOR))) {
318
                        if (!J2SEProjectUtil.isTrue(prop.getProperty(ProjectProperties.ANNOTATION_PROCESSING_ENABLED))) {
319
                            prop.setProperty(ProjectProperties.ANNOTATION_PROCESSING_ENABLED_IN_EDITOR, "true");    //NOI18N
319
                            prop.setProperty(ProjectProperties.ANNOTATION_PROCESSING_ENABLED, "true");    //NOI18N
320
                            changed = true;
320
                            changed = true;
321
                        }
321
                        }
322
                        if (changed) {
322
                        if (changed) {
(-)a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/J2SEProjectGenerator.java (-1 / +1 lines)
Lines 248-254 Link Here
248
        data.appendChild (testRoots);
248
        data.appendChild (testRoots);
249
        h.putPrimaryConfigurationData(data, true);
249
        h.putPrimaryConfigurationData(data, true);
250
        ep.setProperty(ProjectProperties.ANNOTATION_PROCESSING_ENABLED, "true"); // NOI18N
250
        ep.setProperty(ProjectProperties.ANNOTATION_PROCESSING_ENABLED, "true"); // NOI18N
251
        ep.setProperty(ProjectProperties.ANNOTATION_PROCESSING_ENABLED_IN_EDITOR, "true"); // NOI18N
251
        ep.setProperty(ProjectProperties.ANNOTATION_PROCESSING_ENABLED_IN_EDITOR, "false"); // NOI18N
252
        ep.setProperty(ProjectProperties.ANNOTATION_PROCESSING_RUN_ALL_PROCESSORS, "true"); // NOI18N
252
        ep.setProperty(ProjectProperties.ANNOTATION_PROCESSING_RUN_ALL_PROCESSORS, "true"); // NOI18N
253
        ep.setProperty(ProjectProperties.ANNOTATION_PROCESSING_PROCESSORS_LIST, ""); // NOI18N
253
        ep.setProperty(ProjectProperties.ANNOTATION_PROCESSING_PROCESSORS_LIST, ""); // NOI18N
254
        ep.setProperty(ProjectProperties.ANNOTATION_PROCESSING_SOURCE_OUTPUT, "${build.generated.sources.dir}/ap-source-output"); // NOI18N
254
        ep.setProperty(ProjectProperties.ANNOTATION_PROCESSING_SOURCE_OUTPUT, "${build.generated.sources.dir}/ap-source-output"); // NOI18N
(-)a/java.source/nbproject/project.properties (-1 / +1 lines)
Lines 43-49 Link Here
43
javadoc.title=Java Source
43
javadoc.title=Java Source
44
javadoc.arch=${basedir}/arch.xml
44
javadoc.arch=${basedir}/arch.xml
45
javadoc.apichanges=${basedir}/apichanges.xml
45
javadoc.apichanges=${basedir}/apichanges.xml
46
spec.version.base=0.58.0
46
spec.version.base=0.59.0
47
test.qa-functional.cp.extra=${refactoring.java.dir}/modules/ext/javac-api-nb-7.0-b07.jar
47
test.qa-functional.cp.extra=${refactoring.java.dir}/modules/ext/javac-api-nb-7.0-b07.jar
48
test.unit.run.cp.extra=${o.n.core.dir}/core/core.jar:\
48
test.unit.run.cp.extra=${o.n.core.dir}/core/core.jar:\
49
    ${o.n.core.dir}/lib/boot.jar:\
49
    ${o.n.core.dir}/lib/boot.jar:\
(-)a/java.source/src/org/netbeans/modules/java/source/indexing/APTUtils.java (-3 / +8 lines)
Lines 66-71 Link Here
66
import org.netbeans.api.java.classpath.JavaClassPathConstants;
66
import org.netbeans.api.java.classpath.JavaClassPathConstants;
67
import org.netbeans.api.java.queries.AnnotationProcessingQuery;
67
import org.netbeans.api.java.queries.AnnotationProcessingQuery;
68
import org.netbeans.api.java.queries.AnnotationProcessingQuery.Result;
68
import org.netbeans.api.java.queries.AnnotationProcessingQuery.Result;
69
import org.netbeans.api.java.queries.AnnotationProcessingQuery.Trigger;
69
import org.netbeans.modules.parsing.api.indexing.IndexingManager;
70
import org.netbeans.modules.parsing.api.indexing.IndexingManager;
70
import org.openide.filesystems.FileObject;
71
import org.openide.filesystems.FileObject;
71
import org.openide.util.Exceptions;
72
import org.openide.util.Exceptions;
Lines 115-122 Link Here
115
        return utils;
116
        return utils;
116
    }
117
    }
117
118
118
    public boolean aptEnabled() {
119
    public boolean aptEnabledOnScan() {
119
        return aptOptions.annotationProcessingEnabled();
120
        return aptOptions.annotationProcessingEnabled().contains(Trigger.ON_SCAN);
121
    }
122
123
    public boolean aptEnabledInEditor() {
124
        return aptOptions.annotationProcessingEnabled().contains(Trigger.IN_EDITOR);
120
    }
125
    }
121
126
122
    public Collection<? extends Processor> resolveProcessors() {
127
    public Collection<? extends Processor> resolveProcessors() {
Lines 205-211 Link Here
205
                IndexingManager.getDefault().refreshIndex(url, null);
210
                IndexingManager.getDefault().refreshIndex(url, null);
206
                return true;
211
                return true;
207
            }
212
            }
208
            if (JavaIndex.ensureAttributeValue(url, APT_ENABLED, aptOptions.annotationProcessingEnabled() ? Boolean.TRUE.toString() : null) && !allFilesIndexing) {
213
            if (JavaIndex.ensureAttributeValue(url, APT_ENABLED, aptOptions.annotationProcessingEnabled().contains(Trigger.ON_SCAN) ? Boolean.TRUE.toString() : null) && !allFilesIndexing) {
209
                JavaIndex.LOG.fine("forcing reindex due to change in annotation processing options"); //NOI18N
214
                JavaIndex.LOG.fine("forcing reindex due to change in annotation processing options"); //NOI18N
210
                IndexingManager.getDefault().refreshIndex(url, null);
215
                IndexingManager.getDefault().refreshIndex(url, null);
211
                return true;
216
                return true;
(-)a/java.source/src/org/netbeans/modules/java/source/parsing/JavacParser.java (-1 / +2 lines)
Lines 662-668 Link Here
662
        options.add("-g:vars");  // NOI18N, Make the compiler to maintain local variables table
662
        options.add("-g:vars");  // NOI18N, Make the compiler to maintain local variables table
663
        options.add("-source");  // NOI18N
663
        options.add("-source");  // NOI18N
664
        options.add(validatedSourceLevel.name);
664
        options.add(validatedSourceLevel.name);
665
        boolean aptEnabled = aptUtils != null && aptUtils.aptEnabled() && !ClasspathInfoAccessor.getINSTANCE().getCachedClassPath(cpInfo, PathKind.SOURCE).entries().isEmpty();
665
        boolean aptEnabled = aptUtils != null && (backgroundCompilation ? aptUtils.aptEnabledOnScan() : aptUtils.aptEnabledInEditor())
666
                && !ClasspathInfoAccessor.getINSTANCE().getCachedClassPath(cpInfo, PathKind.SOURCE).entries().isEmpty();
666
        if (aptEnabled) {
667
        if (aptEnabled) {
667
            for (Map.Entry<? extends String, ? extends String> entry : aptUtils.processorOptions().entrySet()) {
668
            for (Map.Entry<? extends String, ? extends String> entry : aptUtils.processorOptions().entrySet()) {
668
                StringBuilder sb = new StringBuilder();
669
                StringBuilder sb = new StringBuilder();

Return to bug 183793