You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by ne...@apache.org on 2019/07/03 09:50:05 UTC

[netbeans] branch master updated: [NETBEANS-2755] Corrected the position of Source for Binary Query for Gradle Repositories.

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

neilcsmith 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 1f376df  [NETBEANS-2755] Corrected the position of Source for Binary Query for Gradle Repositories.
     new 44c7cee  Merge pull request #1341 from lkishalmi/NETBEANS-2755
1f376df is described below

commit 1f376dfb14b94ae5784a377c26c6a48e15040487
Author: Laszlo Kishalmi <la...@gmail.com>
AuthorDate: Sun Jun 30 12:22:21 2019 -0700

    [NETBEANS-2755] Corrected the position of Source for Binary Query for Gradle Repositories.
---
 .../java/queries/GradleSourceForRepository.java    | 24 ++++++----------------
 1 file changed, 6 insertions(+), 18 deletions(-)

diff --git a/groovy/gradle.java/src/org/netbeans/modules/gradle/java/queries/GradleSourceForRepository.java b/groovy/gradle.java/src/org/netbeans/modules/gradle/java/queries/GradleSourceForRepository.java
index a085994..426f801 100644
--- a/groovy/gradle.java/src/org/netbeans/modules/gradle/java/queries/GradleSourceForRepository.java
+++ b/groovy/gradle.java/src/org/netbeans/modules/gradle/java/queries/GradleSourceForRepository.java
@@ -20,21 +20,15 @@
 package org.netbeans.modules.gradle.java.queries;
 
 import org.netbeans.modules.gradle.api.GradleProjects;
-import org.netbeans.modules.gradle.api.NbGradleProject;
-import org.netbeans.modules.gradle.java.api.GradleJavaProject;
-import org.netbeans.modules.gradle.java.api.GradleJavaSourceSet;
 import java.io.File;
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.Collections;
 import java.util.Map;
-import java.util.Set;
 import java.util.WeakHashMap;
 import javax.swing.event.ChangeListener;
 import org.netbeans.api.java.queries.JavadocForBinaryQuery;
 import org.netbeans.api.java.queries.SourceForBinaryQuery;
-import org.netbeans.api.project.FileOwnerQuery;
-import org.netbeans.api.project.Project;
 import org.netbeans.spi.java.queries.JavadocForBinaryQueryImplementation;
 import org.netbeans.spi.java.queries.SourceForBinaryQueryImplementation;
 import org.netbeans.spi.java.queries.SourceForBinaryQueryImplementation2;
@@ -49,28 +43,22 @@ import org.openide.util.lookup.ServiceProviders;
  * @author Laszlo Kishalmi
  */
 @ServiceProviders({
-    @ServiceProvider(service = SourceForBinaryQueryImplementation.class, position = 67),
-    @ServiceProvider(service = SourceForBinaryQueryImplementation2.class, position = 67),
-    @ServiceProvider(service = JavadocForBinaryQueryImplementation.class, position = 67)
+    @ServiceProvider(service = SourceForBinaryQueryImplementation.class, position = 110),
+    @ServiceProvider(service = SourceForBinaryQueryImplementation2.class, position = 110),
+    @ServiceProvider(service = JavadocForBinaryQueryImplementation.class, position = 110)
 })
 public class GradleSourceForRepository implements SourceForBinaryQueryImplementation2, JavadocForBinaryQueryImplementation {
 
-    private final Map<URL, SrcRes> srcCache = Collections.synchronizedMap(new WeakHashMap<URL, SrcRes>());
-    private final Map<URL, DocRes> docCache = Collections.synchronizedMap(new WeakHashMap<URL, DocRes>());
+    private final Map<URL, SrcRes> srcCache = Collections.synchronizedMap(new WeakHashMap<>());
+    private final Map<URL, DocRes> docCache = Collections.synchronizedMap(new WeakHashMap<>());
 
     @Override
     public Result findSourceRoots2(URL binaryRoot) {
         SrcRes ret = srcCache.get(binaryRoot);
         if ((ret == null) && "jar".equals(binaryRoot.getProtocol())) {
             try {
-                File sources = null;
-
                 File jar = FileUtil.normalizeFile(Utilities.toFile(FileUtil.getArchiveFile(binaryRoot).toURI()));
-                Project owner = FileOwnerQuery.getOwner(Utilities.toURI(jar));
-                NbGradleProject project = owner != null ? owner.getLookup().lookup(NbGradleProject.class) : null;
-                if (project == null) {
-                    sources = GradleProjects.getSources(jar);
-                }
+                File sources = GradleProjects.getSources(jar);
                 if (sources != null) {
                     ret = new SrcRes(sources);
                     srcCache.put(binaryRoot, ret);


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

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