This is an automated email from the ASF dual-hosted git repository.

lkishalmi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/master by this push:
     new 9679421  [NETBEANS-2661] Trying to avoid excessive computations by 
using BinaryForSource query on the current source root, rather than iterating 
through all binary roots and using SourceForBinaryQuery for them.
9679421 is described below

commit 96794212dbd725e3f85b6ccf4c685134ae93a57a
Author: Jan Lahoda <jlah...@netbeans.org>
AuthorDate: Fri Aug 16 07:24:58 2019 +0200

    [NETBEANS-2661] Trying to avoid excessive computations by using 
BinaryForSource query on the current source root, rather than iterating through 
all binary roots and using SourceForBinaryQuery for them.
---
 .../modules/parsing/spi/indexing/support/QuerySupport.java       | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git 
a/ide/parsing.indexing/src/org/netbeans/modules/parsing/spi/indexing/support/QuerySupport.java
 
b/ide/parsing.indexing/src/org/netbeans/modules/parsing/spi/indexing/support/QuerySupport.java
index 4160c8c..c96cac0 100644
--- 
a/ide/parsing.indexing/src/org/netbeans/modules/parsing/spi/indexing/support/QuerySupport.java
+++ 
b/ide/parsing.indexing/src/org/netbeans/modules/parsing/spi/indexing/support/QuerySupport.java
@@ -45,6 +45,7 @@ import org.netbeans.api.annotations.common.NonNull;
 import org.netbeans.api.annotations.common.NullAllowed;
 import org.netbeans.api.java.classpath.ClassPath;
 import org.netbeans.api.java.classpath.GlobalPathRegistry;
+import org.netbeans.api.java.queries.BinaryForSourceQuery;
 import org.netbeans.api.java.queries.SourceForBinaryQuery;
 import org.netbeans.api.project.FileOwnerQuery;
 import org.netbeans.api.project.Project;
@@ -844,11 +845,9 @@ public final class QuerySupport {
             @NonNull final FileObject sourceRoot,
             @NonNull final Map<URL, List<URL>> binaryDeps) {
         Set<URL> result = new HashSet<>();
-        for (URL bin : binaryDeps.keySet()) {
-            for (FileObject fo : 
SourceForBinaryQuery.findSourceRoots(bin).getRoots()) {
-                if (sourceRoot.equals(fo)) {
-                    result.add(bin);
-                }
+        for (URL binRoot : 
BinaryForSourceQuery.findBinaryRoots(sourceRoot.toURL()).getRoots()) {
+            if (binaryDeps.containsKey(binRoot)) {
+                result.add(binRoot);
             }
         }
         return result;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@netbeans.apache.org
For additional commands, e-mail: commits-h...@netbeans.apache.org

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

Reply via email to