You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2018/04/23 16:51:43 UTC

[GitHub] JaroslavTulach closed pull request #500: COS Synchronization is performed at the end of initial scan.

JaroslavTulach closed pull request #500: COS Synchronization is performed at the end of initial scan.
URL: https://github.com/apache/incubator-netbeans/pull/500
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/java.completion/nbproject/project.properties b/java.completion/nbproject/project.properties
index 859f87591..60014f3e0 100644
--- a/java.completion/nbproject/project.properties
+++ b/java.completion/nbproject/project.properties
@@ -15,7 +15,7 @@
 # specific language governing permissions and limitations
 # under the License.
 is.autoload=true
-javac.source=1.7
+javac.source=1.8
 javac.compilerargs=-Xlint -Xlint:-serial
 spec.version.base=1.9.0
 #test configs
diff --git a/java.completion/test/unit/src/org/netbeans/modules/java/completion/CompletionTestBase.java b/java.completion/test/unit/src/org/netbeans/modules/java/completion/CompletionTestBase.java
index f2485e32c..a4dc62a62 100644
--- a/java.completion/test/unit/src/org/netbeans/modules/java/completion/CompletionTestBase.java
+++ b/java.completion/test/unit/src/org/netbeans/modules/java/completion/CompletionTestBase.java
@@ -165,7 +165,7 @@ public ClassPath findClassPath(FileObject file, String type) {
         final ClassPath sourcePath = ClassPathSupport.createClassPath(new FileObject[] {FileUtil.toFileObject(getDataDir())});
         final ClassIndexManager mgr  = ClassIndexManager.getDefault();
         for (ClassPath.Entry entry : sourcePath.entries()) {
-            TransactionContext tx = TransactionContext.beginStandardTransaction(entry.getURL(), true, true, false);
+            TransactionContext tx = TransactionContext.beginStandardTransaction(entry.getURL(), true, ()->true, false);
             try {
                 mgr.createUsagesQuery(entry.getURL(), true);
             } finally {
@@ -182,7 +182,7 @@ public ClassPath findClassPath(FileObject file, String type) {
             public void run(CompilationController parameter) throws Exception {
                 for (ClassPath.Entry entry : bootPath.entries()) {
                     final URL url = entry.getURL();
-                    TransactionContext.beginStandardTransaction(entry.getURL(), false, true, false);
+                    TransactionContext.beginStandardTransaction(entry.getURL(), false, ()->true, false);
                     try {
                         final ClassIndexImpl cii = mgr.createUsagesQuery(url, false);
                         BinaryAnalyser ba = cii.getBinaryAnalyser();
diff --git a/java.editor/test/unit/src/org/netbeans/modules/java/editor/completion/CompletionTestBase.java b/java.editor/test/unit/src/org/netbeans/modules/java/editor/completion/CompletionTestBase.java
index 6ba97315c..2f788d730 100644
--- a/java.editor/test/unit/src/org/netbeans/modules/java/editor/completion/CompletionTestBase.java
+++ b/java.editor/test/unit/src/org/netbeans/modules/java/editor/completion/CompletionTestBase.java
@@ -174,7 +174,7 @@ public Lookup getLookup(MimePath mimePath) {
         final ClassPath sourcePath = ClassPathSupport.createClassPath(new FileObject[] {FileUtil.toFileObject(getDataDir())});
         final ClassIndexManager mgr  = ClassIndexManager.getDefault();
         for (ClassPath.Entry entry : sourcePath.entries()) {
-            TransactionContext tx = TransactionContext.beginStandardTransaction(entry.getURL(), true, true, false);
+            TransactionContext tx = TransactionContext.beginStandardTransaction(entry.getURL(), true, ()->true, false);
             try {
                 mgr.createUsagesQuery(entry.getURL(), true);
             } finally {
@@ -189,7 +189,7 @@ public Lookup getLookup(MimePath mimePath) {
             public void run(CompilationController parameter) throws Exception {
                 for (ClassPath.Entry entry : bootPath.entries()) {
                     final URL url = entry.getURL();
-                    TransactionContext.beginStandardTransaction(entry.getURL(), false, true, false);
+                    TransactionContext.beginStandardTransaction(entry.getURL(), false, ()->true, false);
                     try {
                         final ClassIndexImpl cii = mgr.createUsagesQuery(url, false);
                         BinaryAnalyser ba = cii.getBinaryAnalyser();
diff --git a/java.hints/test/unit/src/org/netbeans/modules/java/hints/infrastructure/ErrorHintsTestBase.java b/java.hints/test/unit/src/org/netbeans/modules/java/hints/infrastructure/ErrorHintsTestBase.java
index a75dd94ed..00783ee5a 100644
--- a/java.hints/test/unit/src/org/netbeans/modules/java/hints/infrastructure/ErrorHintsTestBase.java
+++ b/java.hints/test/unit/src/org/netbeans/modules/java/hints/infrastructure/ErrorHintsTestBase.java
@@ -129,7 +129,7 @@ public Lookup getLookup(MimePath mimePath) {
     @Override
     protected void tearDown() throws Exception {
         for (URL bootCP : SourceUtilsTestUtil.getBootClassPath()) {
-            TransactionContext ctx = TransactionContext.beginStandardTransaction(bootCP, false, false, false);
+            TransactionContext ctx = TransactionContext.beginStandardTransaction(bootCP, false, ()->false, false);
             try {
                 ClassIndexManager.getDefault().removeRoot(bootCP);
             } finally {
diff --git a/java.j2seproject/nbproject/project.xml b/java.j2seproject/nbproject/project.xml
index bda3c75f9..6b4deec49 100644
--- a/java.j2seproject/nbproject/project.xml
+++ b/java.j2seproject/nbproject/project.xml
@@ -143,7 +143,7 @@
                     <build-prerequisite/>
                     <compile-dependency/>
                     <run-dependency>
-                        <specification-version>1.44</specification-version>
+                        <specification-version>1.50</specification-version>
                     </run-dependency>
                 </dependency>
                 <dependency>
diff --git a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/J2SEActionProvider.java b/java.j2seproject/src/org/netbeans/modules/java/j2seproject/J2SEActionProvider.java
index 814eb2e80..5293659a4 100644
--- a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/J2SEActionProvider.java
+++ b/java.j2seproject/src/org/netbeans/modules/java/j2seproject/J2SEActionProvider.java
@@ -30,6 +30,7 @@
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
+import java.util.ArrayDeque;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -39,6 +40,7 @@
 import java.util.Map;
 import java.util.Optional;
 import java.util.Properties;
+import java.util.Queue;
 import java.util.Set;
 import java.util.WeakHashMap;
 import java.util.concurrent.Future;
@@ -456,6 +458,10 @@ public ClassPath findClassPath(@NonNull FileObject file, @NonNull String type) {
         private final Map</*@GuardedBy("this")*/URL,BuildArtifactMapper.ArtifactsUpdated> currentListeners;
         private final ChangeSupport cs;
         private final AtomicReference<Pair<URI,Collection<File>>> importantFilesCache;
+        //@GuardedBy("this")
+        private final Queue<Runnable> deferred = new ArrayDeque<>();
+        //@GuardedBy("this")
+        private byte deferredGuard; //0 - unset, 1 - pending, 2 - set
         private volatile Object targetCache;
         private volatile Object updatedFSProp;
 
@@ -602,7 +608,11 @@ public void fileAttributeChanged(FileAttributeEvent fe) {
 
         @NonNull
         Future<?> newSyncTask(@NonNull final Runnable callback) {
-            return RUNNER.submit(callback, null);
+            return RUNNER.submit(() -> {
+                    drainDeferred();
+                    callback.run();
+                },
+                null);
         }
 
         private void updateRootsListeners() {
@@ -684,7 +694,7 @@ private Boolean performUpdate(@NonNull final Context ctx) {
                                 props.setProperty(PROP_SRCDIR, root.getAbsolutePath());
                                 props.setProperty(PROP_INCLUDES, includes);
                                 props.setProperty(COS_CUSTOM, getUpdatedFileSetProperty());
-                                RUNNER.execute(()-> {
+                                final Runnable work = () -> {
                                     try {
                                         final ExecutorTask task = runTargetInDedicatedTab(
                                                 NbBundle.getMessage(J2SEActionProvider.class, "LBL_CompileOnSaveUpdate"),
@@ -703,7 +713,12 @@ private Boolean performUpdate(@NonNull final Context ctx) {
                                                 ex.getMessage()
                                             });
                                     }
-                                });
+                                };
+                                if (ctx.isAllFilesIndexing()) {
+                                    enqueueDeferred(work);
+                                } else {
+                                    RUNNER.execute(work);
+                                }
                             } else {
                                 LOG.warning("BuildArtifactMapper artifacts do not provide attributes.");    //NOI18N
                             }
@@ -883,8 +898,44 @@ private static String relativize(
                 start++;
             }
             return file.getAbsolutePath().substring(start);
-        }                        
-        
+        }
+
+        private void enqueueDeferred(final Runnable work) {
+            boolean addGuard = false;
+            synchronized (this) {
+                this.deferred.offer(work);
+                if (deferredGuard == 0) {
+                     addGuard = true;
+                    deferredGuard = 1;
+                }
+            }
+            if (addGuard) {
+                final JavaSource js = createSource();
+                synchronized (this) {
+                    if (deferredGuard == 1) {
+                        deferredGuard = 2;
+                        try {
+                            js.runWhenScanFinished((cc) -> drainDeferred(), true);
+                        } catch (IOException ioe) {
+                            Exceptions.printStackTrace(ioe);
+                        }
+                    }
+                }
+            }
+        }
+
+        private void drainDeferred() {
+            Runnable[] todo;
+            synchronized (this) {
+                todo = deferred.toArray(new Runnable[deferred.size()]);
+                deferred.clear();
+                deferredGuard = 0;
+            }
+            for (Runnable r : todo) {
+                r.run();
+            }
+        }
+
         @CheckForNull
         static CosAction getInstance(@NonNull final Project p) {
             final Reference<CosAction> r = instances.get(p);
diff --git a/java.preprocessorbridge/nbproject/project.properties b/java.preprocessorbridge/nbproject/project.properties
index a6f0b6128..0214116a1 100644
--- a/java.preprocessorbridge/nbproject/project.properties
+++ b/java.preprocessorbridge/nbproject/project.properties
@@ -17,7 +17,7 @@
 is.autoload=true
 javac.compilerargs=-Xlint:unchecked
 javac.source=1.8
-spec.version.base=1.49.0
+spec.version.base=1.50.0
 javadoc.apichanges=${basedir}/apichanges.xml
 
 requires.nb.javac=true
diff --git a/java.preprocessorbridge/src/org/netbeans/modules/java/preprocessorbridge/spi/CompileOnSaveAction.java b/java.preprocessorbridge/src/org/netbeans/modules/java/preprocessorbridge/spi/CompileOnSaveAction.java
index 2bf162584..9a14c5b9b 100644
--- a/java.preprocessorbridge/src/org/netbeans/modules/java/preprocessorbridge/spi/CompileOnSaveAction.java
+++ b/java.preprocessorbridge/src/org/netbeans/modules/java/preprocessorbridge/spi/CompileOnSaveAction.java
@@ -103,6 +103,7 @@
         private final URL srcRoot;
         private final boolean isCopyResources;
         private final boolean isKeepResourcesUpToDate;
+        private final boolean isAllFilesIndexing;
         private final File cacheRoot;
         private final Iterable<? extends File> updated;
         private final Iterable<? extends File> deleted;
@@ -114,6 +115,7 @@ private Context(
                 @NonNull final URL srcRoot,
                 final boolean isCopyResources,
                 final boolean isKeepResourcesUpToDate,
+                final boolean isAllFilesIndexing,
                 @NullAllowed final File cacheRoot,
                 @NullAllowed final Iterable<? extends File> updated,
                 @NullAllowed final Iterable<? extends File> deleted,
@@ -123,6 +125,7 @@ private Context(
             this.srcRoot = srcRoot;
             this.isCopyResources = isCopyResources;
             this.isKeepResourcesUpToDate = isKeepResourcesUpToDate;
+            this.isAllFilesIndexing = isAllFilesIndexing;
             this.cacheRoot = cacheRoot;
             this.updated = updated;
             this.deleted = deleted;
@@ -260,7 +263,7 @@ public void filesUpdated(@NonNull final Iterable<File> updatedFiles) {
         @NonNull
         public static Context clean(@NonNull final URL srcRoot) {
             Parameters.notNull("srcRoot", srcRoot); //NOI18N
-            return new Context(Operation.CLEAN, srcRoot, false, false, null, null, null, null, null);
+            return new Context(Operation.CLEAN, srcRoot, false, false, false, null, null, null, null, null);
         }
         
         /**
@@ -281,12 +284,36 @@ public static Context update(
                 @NonNull final Iterable<? extends File> updated,
                 @NonNull final Iterable<? extends File> deleted,
                 @NullAllowed final Consumer<Iterable<File>> firer) {
+            return update(srcRoot, isCopyResources, false, cacheRoot, updated, deleted, firer);
+        }
+
+        /**
+         * Creates context for update operation.
+         * @param srcRoot the root
+         * @param isCopyResources true for resource update
+         * @param isAllFilesIndexing true for all files indexing
+         * @param cacheRoot the cache root
+         * @param updated the changed files
+         * @param deleted the deleted files
+         * @param firer the fire callback
+         * @return the {@link Context} for update operation
+         * @since 1.50
+         */
+        @NonNull
+        public static Context update(
+                @NonNull final URL srcRoot,
+                final boolean isCopyResources,
+                final boolean isAllFilesIndexing,
+                @NonNull final File cacheRoot,
+                @NonNull final Iterable<? extends File> updated,
+                @NonNull final Iterable<? extends File> deleted,
+                @NullAllowed final Consumer<Iterable<File>> firer) {
             Parameters.notNull("srcRoot", srcRoot); //NOI18N
             Parameters.notNull("cacheRoot", cacheRoot); //NOI18N
             Parameters.notNull("updated", updated); //NOI18N
-            Parameters.notNull("deleted", deleted); //NOI18N            
+            Parameters.notNull("deleted", deleted); //NOI18N
             return new Context(
-                    Operation.UPDATE, srcRoot, isCopyResources, false, cacheRoot, updated, deleted, null, firer);
+                    Operation.UPDATE, srcRoot, isCopyResources, false, isAllFilesIndexing, cacheRoot, updated, deleted, null, firer);
         }
         
         /**
@@ -306,7 +333,7 @@ public static Context sync(
             Parameters.notNull("srcRoot", srcRoot); //NOI18N
             Parameters.notNull("owner", owner); //NOI18N
             return new Context(
-                    Operation.SYNC, srcRoot, isCopyResources, isKeepResourcesUpToDate, null, null, null, owner, null);
+                    Operation.SYNC, srcRoot, isCopyResources, isKeepResourcesUpToDate, false, null, null, null, owner, null);
         }
         
         /**
@@ -378,6 +405,15 @@ public static URL getTargetURL(@NonNull URL srcRoot) {
 
             return result;
         }
+
+        /**
+         * Returns true if the action represents an all files indexing.
+         * @return true for all files indexing
+         * @since 1.50
+         */
+        public boolean isAllFilesIndexing() {
+            return this.isAllFilesIndexing;
+        }
     }
 
     /**
diff --git a/java.source.base/nbproject/project.xml b/java.source.base/nbproject/project.xml
index d012fd58b..067937f75 100644
--- a/java.source.base/nbproject/project.xml
+++ b/java.source.base/nbproject/project.xml
@@ -188,7 +188,7 @@
                     <build-prerequisite/>
                     <compile-dependency/>
                     <run-dependency>
-                        <specification-version>1.49</specification-version>
+                        <specification-version>1.50</specification-version>
                     </run-dependency>
                 </dependency>
                 <dependency>
diff --git a/java.source.base/src/org/netbeans/modules/java/source/indexing/COSSynchronizingIndexer.java b/java.source.base/src/org/netbeans/modules/java/source/indexing/COSSynchronizingIndexer.java
index 0d6457838..095055781 100644
--- a/java.source.base/src/org/netbeans/modules/java/source/indexing/COSSynchronizingIndexer.java
+++ b/java.source.base/src/org/netbeans/modules/java/source/indexing/COSSynchronizingIndexer.java
@@ -105,7 +105,13 @@ protected void index(Iterable<? extends Indexable> files, Context context) {
             File sourceRootFile = BaseUtilities.toFile(context.getRootURI().toURI());
 
             if (!context.checkForEditorModifications()) { // #187514, see also #152222 and JavaCustomIndexer
-                BuildArtifactMapperImpl.classCacheUpdated(context.getRootURI(), sourceRootFile, Collections.<File>emptyList(), updated, true);
+                BuildArtifactMapperImpl.classCacheUpdated(
+                        context.getRootURI(),
+                        sourceRootFile,
+                        Collections.<File>emptyList(),
+                        updated,
+                        true,
+                        context.isAllFilesIndexing());
             }
         } catch (URISyntaxException ex) {
             Exceptions.printStackTrace(ex);
@@ -162,7 +168,13 @@ public void filesDeleted(Iterable<? extends Indexable> deleted, Context context)
             try {
                 File sourceRootFile = BaseUtilities.toFile(context.getRootURI().toURI());
 
-                BuildArtifactMapperImpl.classCacheUpdated(context.getRootURI(), sourceRootFile, deletedFiles, Collections.<File>emptyList(), true);
+                BuildArtifactMapperImpl.classCacheUpdated(
+                        context.getRootURI(),
+                        sourceRootFile,
+                        deletedFiles,
+                        Collections.<File>emptyList(),
+                        true,
+                        context.isAllFilesIndexing());
             } catch (URISyntaxException ex) {
                 Exceptions.printStackTrace(ex);
             }
diff --git a/java.source.base/src/org/netbeans/modules/java/source/indexing/CacheAttributesTransaction.java b/java.source.base/src/org/netbeans/modules/java/source/indexing/CacheAttributesTransaction.java
index 7e00407fb..4c1a51325 100644
--- a/java.source.base/src/org/netbeans/modules/java/source/indexing/CacheAttributesTransaction.java
+++ b/java.source.base/src/org/netbeans/modules/java/source/indexing/CacheAttributesTransaction.java
@@ -20,6 +20,7 @@
 
 import java.io.IOException;
 import java.net.URL;
+import java.util.function.Supplier;
 import org.netbeans.api.annotations.common.NonNull;
 import org.netbeans.modules.java.source.usages.ClassIndexImpl;
 import org.netbeans.modules.java.source.usages.ClassIndexManager;
@@ -33,14 +34,14 @@
 
     private final URL root;
     private final boolean srcRoot;
-    private final boolean allFiles;
+    private final Supplier<Boolean> allFiles;
     private boolean closed;
     private boolean invalid;
 
     private CacheAttributesTransaction(
         @NonNull final URL root,
         final boolean srcRoot,
-        final boolean allFiles) {
+        final Supplier<Boolean> allFiles) {
         this.root = root;
         this.srcRoot = srcRoot;
         this.allFiles = allFiles;
@@ -49,7 +50,7 @@ private CacheAttributesTransaction(
     static CacheAttributesTransaction create(
             @NonNull final URL root,
             final boolean srcRoot,
-            final boolean allFiles) {
+            final Supplier<Boolean> allFiles) {
         Parameters.notNull("root", root);   //NOI18N
         return new CacheAttributesTransaction(root, srcRoot, allFiles);
     }
@@ -67,7 +68,7 @@ protected void commit() throws IOException {
                 JavaIndex.setAttribute(root, ClassIndexManager.PROP_SOURCE_ROOT, Boolean.TRUE.toString());
             }
         } else {            
-            if (allFiles) {
+            if (allFiles.get()) {
                 JavaIndex.setAttribute(root, ClassIndexManager.PROP_SOURCE_ROOT, Boolean.FALSE.toString());
             }
         }
diff --git a/java.source.base/src/org/netbeans/modules/java/source/indexing/JavaBinaryIndexer.java b/java.source.base/src/org/netbeans/modules/java/source/indexing/JavaBinaryIndexer.java
index 1629da456..376f48775 100644
--- a/java.source.base/src/org/netbeans/modules/java/source/indexing/JavaBinaryIndexer.java
+++ b/java.source.base/src/org/netbeans/modules/java/source/indexing/JavaBinaryIndexer.java
@@ -232,7 +232,7 @@ public void rootsRemoved (final Iterable<? extends URL> removedRoots) {
             assert removedRoots != null;
             final TransactionContext txCtx = TransactionContext.beginTrans().register(
                 ClassIndexEventsTransaction.class,
-                ClassIndexEventsTransaction.create(false));
+                ClassIndexEventsTransaction.create(false, ()->false));
             try {
                 final ClassIndexManager cim = ClassIndexManager.getDefault();
                 for (URL removedRoot : removedRoots) {
@@ -259,7 +259,7 @@ public boolean scanStarted(final Context context) {
                 TransactionContext.beginStandardTransaction(
                         context.getRootURI(),
                         false,
-                        context.isAllFilesIndexing(),
+                        context::isAllFilesIndexing,
                         context.checkForEditorModifications());
                 final ClassIndexImpl uq = ClassIndexManager.getDefault().createUsagesQuery(context.getRootURI(), false);
                 if (uq == null) {
diff --git a/java.source.base/src/org/netbeans/modules/java/source/indexing/JavaCustomIndexer.java b/java.source.base/src/org/netbeans/modules/java/source/indexing/JavaCustomIndexer.java
index 8e5a3b0b5..82dd59293 100644
--- a/java.source.base/src/org/netbeans/modules/java/source/indexing/JavaCustomIndexer.java
+++ b/java.source.base/src/org/netbeans/modules/java/source/indexing/JavaCustomIndexer.java
@@ -1036,7 +1036,7 @@ public boolean scanStarted(final Context context) {
             final TransactionContext txctx = TransactionContext.beginStandardTransaction(
                     context.getRootURI(),
                     true,
-                    context.isAllFilesIndexing(),
+                    context::isAllFilesIndexing,
                     context.checkForEditorModifications());
             try {
                 return JavaIndexerWorker.reduce(
@@ -1093,7 +1093,7 @@ public void rootsRemoved(final Iterable<? extends URL> removedRoots) {
             assert removedRoots != null;
             JavaIndex.LOG.log(Level.FINE, "roots removed: {0}", removedRoots);
             final TransactionContext txCtx = TransactionContext.beginTrans().
-                    register(ClassIndexEventsTransaction.class, ClassIndexEventsTransaction.create(true));
+                    register(ClassIndexEventsTransaction.class, ClassIndexEventsTransaction.create(true, ()->false));
             try {
                 APTUtils.sourceRootUnregistered(removedRoots);
                 final ClassIndexManager cim = ClassIndexManager.getDefault();
diff --git a/java.source.base/src/org/netbeans/modules/java/source/indexing/TransactionContext.java b/java.source.base/src/org/netbeans/modules/java/source/indexing/TransactionContext.java
index cb1d2b000..9d2448224 100644
--- a/java.source.base/src/org/netbeans/modules/java/source/indexing/TransactionContext.java
+++ b/java.source.base/src/org/netbeans/modules/java/source/indexing/TransactionContext.java
@@ -22,6 +22,7 @@
 import java.net.URL;
 import java.util.LinkedHashMap;
 import java.util.Map;
+import java.util.function.Supplier;
 import org.netbeans.api.annotations.common.CheckForNull;
 import org.netbeans.api.annotations.common.NonNull;
 import org.netbeans.modules.java.source.parsing.FileManagerTransaction;
@@ -193,7 +194,7 @@ public static TransactionContext get() throws IllegalStateException {
     public static TransactionContext beginStandardTransaction(
             @NonNull final URL root,
             final boolean srcIndex,
-            final boolean allFilesIndexing,
+            final Supplier<Boolean> allFilesIndexing,
             final boolean checkForEditorModifications) throws IllegalStateException {
         boolean hasCache;
         if (srcIndex) {
@@ -218,7 +219,7 @@ public static TransactionContext beginStandardTransaction(
                 CacheAttributesTransaction.create(root, srcIndex, allFilesIndexing)).
             register(
                 ClassIndexEventsTransaction.class,
-                ClassIndexEventsTransaction.create(srcIndex)).
+                ClassIndexEventsTransaction.create(srcIndex, allFilesIndexing)).
             register(
                 SourceFileManager.ModifiedFilesTransaction.class,
                 SourceFileManager.newModifiedFilesTransaction(srcIndex, checkForEditorModifications));
diff --git a/java.source.base/src/org/netbeans/modules/java/source/usages/BuildArtifactMapperImpl.java b/java.source.base/src/org/netbeans/modules/java/source/usages/BuildArtifactMapperImpl.java
index c082cb963..dbd295c51 100644
--- a/java.source.base/src/org/netbeans/modules/java/source/usages/BuildArtifactMapperImpl.java
+++ b/java.source.base/src/org/netbeans/modules/java/source/usages/BuildArtifactMapperImpl.java
@@ -191,13 +191,14 @@ public static boolean isUpdateResources(URL srcRoot) {
                 false;                
     }
 
-    public static void classCacheUpdated(URL sourceRoot, File cacheRoot, Iterable<File> deleted, Iterable<File> updated, boolean resource) {
+    public static void classCacheUpdated(URL sourceRoot, File cacheRoot, Iterable<File> deleted, Iterable<File> updated, boolean resource, boolean isAllFilesIndexing) {
         final CompileOnSaveAction a = CompileOnSaveActionQuery.getAction(sourceRoot);
         if (a != null) {
             try {
                 final CompileOnSaveAction.Context ctx = CompileOnSaveAction.Context.update(
                         sourceRoot,
                         resource,
+                        isAllFilesIndexing,
                         cacheRoot,
                         updated,
                         deleted,
diff --git a/java.source.base/src/org/netbeans/modules/java/source/usages/ClassIndexEventsTransaction.java b/java.source.base/src/org/netbeans/modules/java/source/usages/ClassIndexEventsTransaction.java
index c3bd137a4..b001cf0c2 100644
--- a/java.source.base/src/org/netbeans/modules/java/source/usages/ClassIndexEventsTransaction.java
+++ b/java.source.base/src/org/netbeans/modules/java/source/usages/ClassIndexEventsTransaction.java
@@ -22,6 +22,7 @@
 import java.io.IOException;
 import java.net.URL;
 import java.util.*;
+import java.util.function.Supplier;
 import javax.lang.model.element.ModuleElement;
 import javax.lang.model.element.TypeElement;
 import org.netbeans.api.annotations.common.NonNull;
@@ -43,6 +44,7 @@
 public final class ClassIndexEventsTransaction extends TransactionContext.Service {
 
     private final boolean source;
+    private final Supplier<Boolean> isAllFilesIndexing;
     private Set<URL> removedRoots;
     private ElementHandle<ModuleElement> addedModule;
     private ElementHandle<ModuleElement> removedModule;
@@ -56,8 +58,9 @@
     private URL changesInRoot;
     private boolean closed;
 
-    private ClassIndexEventsTransaction(final boolean src) {
+    private ClassIndexEventsTransaction(final boolean src, final Supplier<Boolean> allFilesIndexing) {
         source = src;
+        isAllFilesIndexing = allFilesIndexing;
         removedRoots = new HashSet<>();
         addedTypes = new HashSet<>();
         removedTypes = new HashSet<>();
@@ -212,7 +215,8 @@ protected void commit() throws IOException {
                         JavaIndex.getClassFolder(changesInRoot),
                         Collections.unmodifiableCollection(removedFiles),
                         Collections.unmodifiableCollection(addedFiles),
-                        false);
+                        false,
+                        isAllFilesIndexing.get());
                 }
             } finally {
                 final ClassIndexManager ciManager = ClassIndexManager.getDefault();
@@ -278,11 +282,12 @@ private void closeTx() {
     /**
      * Creates a new instance of {@link ClassIndexEventsTransaction} service.
      * @param source the source flag, true for source roots, false for binary roots.
+     * @param isAllFilesIndexing  true for all files indexing
      * @return the {@link ClassIndexEventsTransaction}.
      */
     @NonNull
-    public static ClassIndexEventsTransaction create(final boolean source) {
-        return new ClassIndexEventsTransaction(source);
+    public static ClassIndexEventsTransaction create(final boolean source, final Supplier<Boolean> isAllFilesIndexing) {
+        return new ClassIndexEventsTransaction(source, isAllFilesIndexing);
     }
 
 }
diff --git a/java.source.base/test/unit/src/org/netbeans/api/java/source/TestUtilities.java b/java.source.base/test/unit/src/org/netbeans/api/java/source/TestUtilities.java
index 1dd899e8f..108599d50 100644
--- a/java.source.base/test/unit/src/org/netbeans/api/java/source/TestUtilities.java
+++ b/java.source.base/test/unit/src/org/netbeans/api/java/source/TestUtilities.java
@@ -235,7 +235,7 @@ public final static void analyzeBinaries(final Collection<URL> urls) throws IOEx
         js.runUserActionTask(new Task<CompilationController>() {
             public void run(CompilationController parameter) throws Exception {                
                 for (final URL url : urls) {
-                    TransactionContext ctx = TransactionContext.beginStandardTransaction(url, false, true, false);
+                    TransactionContext ctx = TransactionContext.beginStandardTransaction(url, false, ()->true, false);
                     try {
                         final ClassIndexImpl cii = mgr.createUsagesQuery(url, false);
                         final BinaryAnalyser ba = cii.getBinaryAnalyser();            
diff --git a/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/ImportAnalysis2Test.java b/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/ImportAnalysis2Test.java
index 3b6702053..814103c4c 100644
--- a/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/ImportAnalysis2Test.java
+++ b/java.source.base/test/unit/src/org/netbeans/api/java/source/gen/ImportAnalysis2Test.java
@@ -706,7 +706,7 @@ public void testTooSoon206957a() throws Exception {
             "\n" +
             "public abstract class Test implements Entry, Map {\n" +
             "}\n";
-        final TransactionContext ctx = TransactionContext.beginStandardTransaction(Utilities.toURI(getWorkDir()).toURL(), true, true, false);
+        final TransactionContext ctx = TransactionContext.beginStandardTransaction(Utilities.toURI(getWorkDir()).toURL(), true, ()->true, false);
         try {
             ClasspathInfo cpInfo = ClasspathInfoAccessor.getINSTANCE().create (ClassPathSupport.createClassPath(System.getProperty("sun.boot.class.path")), ClassPath.EMPTY, ClassPath.EMPTY, ClassPath.EMPTY, ClassPath.EMPTY, ClassPathSupport.createClassPath(getSourcePath()), ClassPath.EMPTY, null, true, false, false, true, false, null);
             JavaSource src = JavaSource.create(cpInfo, FileUtil.toFileObject(testFile));
@@ -752,7 +752,7 @@ public void testTooSoon206957b() throws Exception {
             "public abstract class Entry implements Map.Entry, Map {\n" +
             "}\n";
 
-        final TransactionContext ctx = TransactionContext.beginStandardTransaction(Utilities.toURI(getWorkDir()).toURL(), true, true, false);
+        final TransactionContext ctx = TransactionContext.beginStandardTransaction(Utilities.toURI(getWorkDir()).toURL(), true, ()->true, false);
         try {
             ClasspathInfo cpInfo = ClasspathInfoAccessor.getINSTANCE().create (ClassPathSupport.createClassPath(System.getProperty("sun.boot.class.path")), ClassPath.EMPTY, ClassPath.EMPTY, ClassPath.EMPTY, ClassPath.EMPTY, ClassPathSupport.createClassPath(getSourcePath()), ClassPath.EMPTY, null, true, false, false, true, false, null);
             JavaSource src = JavaSource.create(cpInfo, FileUtil.toFileObject(testFile));
diff --git a/java.source.base/test/unit/src/org/netbeans/modules/java/source/ClassIndexTestCase.java b/java.source.base/test/unit/src/org/netbeans/modules/java/source/ClassIndexTestCase.java
index 04df4a99a..83a64e53f 100644
--- a/java.source.base/test/unit/src/org/netbeans/modules/java/source/ClassIndexTestCase.java
+++ b/java.source.base/test/unit/src/org/netbeans/modules/java/source/ClassIndexTestCase.java
@@ -67,7 +67,7 @@ public static TransactionContext beginTx() throws IOException {
         try {
             return TransactionContext.beginTrans().
                     register(ClassIndexEventsTransaction.class, 
-                             ClassIndexEventsTransaction.create(true)).
+                             ClassIndexEventsTransaction.create(true, ()->true)).
                     register(FileManagerTransaction.class, FileManagerTransaction.writeThrough()).
                     register(ProcessorGenerated.class, ProcessorGenerated.nullWrite());
         } catch (IllegalStateException ise) {
diff --git a/java.source.base/test/unit/src/org/netbeans/modules/java/source/ModuleNamesTest.java b/java.source.base/test/unit/src/org/netbeans/modules/java/source/ModuleNamesTest.java
index 8e74f2c79..1fd092e98 100644
--- a/java.source.base/test/unit/src/org/netbeans/modules/java/source/ModuleNamesTest.java
+++ b/java.source.base/test/unit/src/org/netbeans/modules/java/source/ModuleNamesTest.java
@@ -462,7 +462,7 @@ private void fakeIndex(
             @NonNull final FileObject srcRoot,
             @NonNull final URL binRoot,
             @NullAllowed final String moduleName) throws IOException {
-        ClassIndexImpl q = ClassIndexManager.getDefault().createUsagesQuery(srcRoot.toURL(), true, ClassIndexEventsTransaction.create(true));
+        ClassIndexImpl q = ClassIndexManager.getDefault().createUsagesQuery(srcRoot.toURL(), true, ClassIndexEventsTransaction.create(true, ()->true));
         q.setState(ClassIndexImpl.State.INITIALIZED);
         JavaIndex.setAttribute(srcRoot.toURL(), JavaIndex.ATTR_MODULE_NAME, moduleName);
         ModuleNames.getInstance().reset(binRoot);
diff --git a/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/CompileWorkerTestBase.java b/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/CompileWorkerTestBase.java
index f550f7ebc..b64a2d19d 100644
--- a/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/CompileWorkerTestBase.java
+++ b/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/CompileWorkerTestBase.java
@@ -128,7 +128,7 @@ public void run(CompilationController cc) throws Exception {
     }
 
     protected ParsingOutput runIndexing(List<CompileTuple> files, List<CompileTuple> virtualFiles) throws Exception {
-        TransactionContext txc = TransactionContext.beginStandardTransaction(src.toURL(), true, false, false);
+        TransactionContext txc = TransactionContext.beginStandardTransaction(src.toURL(), true, ()->false, false);
         Factory f = new JavaCustomIndexer.Factory();
         Context ctx = SPIAccessor.getInstance().createContext(CacheFolder.getDataFolder(src.toURL()), src.toURL(), f.getIndexerName(), f.getIndexVersion(), LuceneIndexFactory.getDefault(), false, false, true, SPIAccessor.getInstance().createSuspendStatus(new SuspendStatusImpl() {
             @Override
diff --git a/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/JavaBinaryIndexerTest.java b/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/JavaBinaryIndexerTest.java
index 361e24ef5..fbea4e4e0 100644
--- a/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/JavaBinaryIndexerTest.java
+++ b/java.source.base/test/unit/src/org/netbeans/modules/java/source/indexing/JavaBinaryIndexerTest.java
@@ -77,7 +77,7 @@ protected void setUp() throws Exception {
     @Override
     protected void tearDown() throws Exception {
         LowMemoryWatcherAccessor.setLowMemory(false);
-        final TransactionContext ctx = TransactionContext.beginStandardTransaction(me, false, false, false);
+        final TransactionContext ctx = TransactionContext.beginStandardTransaction(me, false, ()->false, false);
         try {
             ClassIndexManager.getDefault().removeRoot(me);
         } finally {
diff --git a/java.source.base/test/unit/src/org/netbeans/modules/java/source/parsing/ClasspathInfoTest.java b/java.source.base/test/unit/src/org/netbeans/modules/java/source/parsing/ClasspathInfoTest.java
index f534bc288..f49c8177a 100644
--- a/java.source.base/test/unit/src/org/netbeans/modules/java/source/parsing/ClasspathInfoTest.java
+++ b/java.source.base/test/unit/src/org/netbeans/modules/java/source/parsing/ClasspathInfoTest.java
@@ -193,7 +193,7 @@ private static void assertEquals (final String[] binNames,
     public void testMemoryFileManager () throws Exception {
         final ClassPath scp = createSourcePath(FileUtil.toFileObject(this.getWorkDir()));
         createJavaFile(scp.getRoots()[0], "org/me/Lib.java", "package org.me;\n class Lib {}\n");
-        TransactionContext tx = TransactionContext.beginStandardTransaction(scp.getRoots()[0].toURL(), true, true, false);
+        TransactionContext tx = TransactionContext.beginStandardTransaction(scp.getRoots()[0].toURL(), true, ()->true, false);
         try {
             final ClasspathInfo cpInfo = ClasspathInfoAccessor.getINSTANCE().create( bootPath, ClassPath.EMPTY, classPath, ClassPath.EMPTY, ClassPath.EMPTY, scp, ClassPath.EMPTY, null, true, true, true, false, false, null);
             final JavaFileManager fm = ClasspathInfoAccessor.getINSTANCE().createFileManager(cpInfo, null);
diff --git a/java.source.base/test/unit/src/org/netbeans/modules/java/source/parsing/ModuleOraculumTest.java b/java.source.base/test/unit/src/org/netbeans/modules/java/source/parsing/ModuleOraculumTest.java
index 834e965b2..11a5826fe 100644
--- a/java.source.base/test/unit/src/org/netbeans/modules/java/source/parsing/ModuleOraculumTest.java
+++ b/java.source.base/test/unit/src/org/netbeans/modules/java/source/parsing/ModuleOraculumTest.java
@@ -446,7 +446,7 @@ public void testModuleNameCache_ModuleInfoCreated() throws IOException {
 
     private static void scan(@NonNull final FileObject root) throws IOException {
         final TransactionContext ctx = TransactionContext.beginTrans()
-                .register(ClassIndexEventsTransaction.class, ClassIndexEventsTransaction.create(true));
+                .register(ClassIndexEventsTransaction.class, ClassIndexEventsTransaction.create(true, ()->true));
         try {
             ClassIndexImpl ci = ClassIndexManager.getDefault().createUsagesQuery(root.toURL(), true);
             if (ci == null) {
diff --git a/java.source.base/test/unit/src/org/netbeans/modules/java/source/usages/PersistentClassIndexScopesTest.java b/java.source.base/test/unit/src/org/netbeans/modules/java/source/usages/PersistentClassIndexScopesTest.java
index 3b0e43b91..bbbac29f5 100644
--- a/java.source.base/test/unit/src/org/netbeans/modules/java/source/usages/PersistentClassIndexScopesTest.java
+++ b/java.source.base/test/unit/src/org/netbeans/modules/java/source/usages/PersistentClassIndexScopesTest.java
@@ -160,7 +160,7 @@ private static void fakeIndex(
             @NonNull final URL root) throws IOException {
         TransactionContext.beginTrans().register(
                 ClassIndexEventsTransaction.class,
-                ClassIndexEventsTransaction.create(true));
+                ClassIndexEventsTransaction.create(true, ()->true));
         try {
             ClassIndexManager.getDefault().removeRoot(root);
         } finally {
diff --git a/java.source.base/test/unit/src/org/netbeans/modules/java/source/usages/SourceAnalyzerTest.java b/java.source.base/test/unit/src/org/netbeans/modules/java/source/usages/SourceAnalyzerTest.java
index 1e0fd81b4..93e563b46 100644
--- a/java.source.base/test/unit/src/org/netbeans/modules/java/source/usages/SourceAnalyzerTest.java
+++ b/java.source.base/test/unit/src/org/netbeans/modules/java/source/usages/SourceAnalyzerTest.java
@@ -98,7 +98,7 @@ public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
                 problems.offer(diagnostic);
             }
         };
-        TransactionContext.beginStandardTransaction(src.toURL(), true, false, true);
+        TransactionContext.beginStandardTransaction(src.toURL(), true, ()->false, true);
         try {
             final ClasspathInfo cpInfo = ClasspathInfoAccessor.getINSTANCE().create(
                 src,
@@ -151,7 +151,7 @@ public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
                 problems.offer(diagnostic);
             }
         };
-        TransactionContext.beginStandardTransaction(src.toURL(), true, false, true);
+        TransactionContext.beginStandardTransaction(src.toURL(), true, ()->false, true);
         try {
             final ClasspathInfo cpInfo = ClasspathInfoAccessor.getINSTANCE().create(
                 src,
@@ -200,7 +200,7 @@ public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
                 problems.offer(diagnostic);
             }
         };
-        TransactionContext.beginStandardTransaction(src.toURL(), true, false, true);
+        TransactionContext.beginStandardTransaction(src.toURL(), true, ()->false, true);
         try {
             final ClasspathInfo cpInfo = ClasspathInfoAccessor.getINSTANCE().create(
                 src,
diff --git a/javafx2.editor/nbproject/project.properties b/javafx2.editor/nbproject/project.properties
index 8569f738e..61aad8242 100644
--- a/javafx2.editor/nbproject/project.properties
+++ b/javafx2.editor/nbproject/project.properties
@@ -16,7 +16,7 @@
 # under the License.
 
 
-javac.source=1.6
+javac.source=1.8
 javac.compilerargs=-Xlint -Xlint:-serial
 spec.version.base=1.22.0
 requires.nb.javac=true
diff --git a/javafx2.editor/test/unit/src/org/netbeans/modules/javafx2/editor/FXMLCompletionTestBase.java b/javafx2.editor/test/unit/src/org/netbeans/modules/javafx2/editor/FXMLCompletionTestBase.java
index 60a616067..2ab69aaeb 100644
--- a/javafx2.editor/test/unit/src/org/netbeans/modules/javafx2/editor/FXMLCompletionTestBase.java
+++ b/javafx2.editor/test/unit/src/org/netbeans/modules/javafx2/editor/FXMLCompletionTestBase.java
@@ -197,7 +197,7 @@ public Lookup getLookup(MimePath mimePath) {
         final ClassPath sourcePath = ClassPathSupport.createClassPath(new FileObject[] {FileUtil.toFileObject(getDataDir())});
         final ClassIndexManager mgr  = ClassIndexManager.getDefault();
         for (ClassPath.Entry entry : sourcePath.entries()) {
-            TransactionContext tx = TransactionContext.beginStandardTransaction(entry.getURL(), true, true, false);
+            TransactionContext tx = TransactionContext.beginStandardTransaction(entry.getURL(), true, ()->true, false);
             try {
                 mgr.createUsagesQuery(entry.getURL(), true);
             } finally {
@@ -215,7 +215,7 @@ public void run(CompilationController parameter) throws Exception {
                 entries.addAll(fxPath.entries());
                 for (ClassPath.Entry entry : entries) {
                     final URL url = entry.getURL();
-                    TransactionContext.beginStandardTransaction(entry.getURL(), false, true, false);
+                    TransactionContext.beginStandardTransaction(entry.getURL(), false, ()->true, false);
                     try {
                         final ClassIndexImpl cii = mgr.createUsagesQuery(url, false);
                         BinaryAnalyser ba = cii.getBinaryAnalyser();


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists