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/09/25 11:28:39 UTC

[GitHub] geertjanw closed pull request #887: [NETBEANS-263] navigate to impl icon not shown for interface

geertjanw closed pull request #887: [NETBEANS-263] navigate to impl icon not shown for interface
URL: https://github.com/apache/incubator-netbeans/pull/887
 
 
   

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/java.source.base/src/org/netbeans/modules/java/source/ElementUtils.java b/java/java.source.base/src/org/netbeans/modules/java/source/ElementUtils.java
index 757bc5724f..9341155e46 100644
--- a/java/java.source.base/src/org/netbeans/modules/java/source/ElementUtils.java
+++ b/java/java.source.base/src/org/netbeans/modules/java/source/ElementUtils.java
@@ -21,7 +21,6 @@
 import com.sun.source.util.JavacTask;
 import com.sun.tools.javac.api.JavacTaskImpl;
 import com.sun.tools.javac.code.Kinds.Kind;
-import com.sun.tools.javac.code.Symbol;
 import com.sun.tools.javac.code.Symbol.ClassSymbol;
 import com.sun.tools.javac.code.Symbol.CompletionFailure;
 import com.sun.tools.javac.code.Symbol.ModuleSymbol;
@@ -30,6 +29,7 @@
 import com.sun.tools.javac.util.Name;
 import com.sun.tools.javac.util.Names;
 import java.util.Set;
+import javax.lang.model.element.ElementKind;
 import javax.lang.model.element.ModuleElement;
 import javax.lang.model.element.TypeElement;
 import org.netbeans.api.java.source.CompilationInfo;
@@ -46,21 +46,35 @@ public static TypeElement getTypeElementByBinaryName(CompilationInfo info, Strin
 
     public static TypeElement getTypeElementByBinaryName(JavacTask task, String name) {
         Set<? extends ModuleElement> allModules = task.getElements().getAllModuleElements();
+        Context ctx = ((JavacTaskImpl) task).getContext();
+        Symtab syms = Symtab.instance(ctx);
         
         if (allModules.isEmpty()) {
-            Context ctx = ((JavacTaskImpl) task).getContext();
-            Symtab syms = Symtab.instance(ctx);
-            
             return getTypeElementByBinaryName(task, syms.noModule, name);
         }
         
         TypeElement result = null;
+        boolean foundInUnamedModule = false;
         
         for (ModuleElement me : allModules) {
             TypeElement found = getTypeElementByBinaryName(task, me, name);
-            
+
             if (found != null) {
-                if (result != null) return null;
+                if ((ModuleSymbol) me == syms.unnamedModule) {
+                    foundInUnamedModule = true;
+                }
+                if (result != null) {
+                    if (foundInUnamedModule == true) {
+                        for (TypeElement elem : new TypeElement[]{result, found}) {
+                            if ((elem.getKind() == ElementKind.CLASS || elem.getKind() == ElementKind.INTERFACE)
+                                    && (((ClassSymbol) elem).packge().modle != syms.unnamedModule)) {
+                                return elem;
+                            }
+                        }
+                    } else {
+                        return null;
+                    }
+                }
                 result = found;
             }
         }


 

----------------------------------------------------------------
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