Skip to content

Commit

Permalink
[NETBEANS-263] navigate to impl icon not shown for interface
Browse files Browse the repository at this point in the history
  • Loading branch information
rtaneja1 committed Sep 20, 2018
1 parent 02ed32f commit 2b08947
Showing 1 changed file with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,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;
Expand All @@ -47,19 +48,29 @@ 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()) {
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 ((ModuleSymbol) me == syms.unnamedModule) {
foundInUnamedModule = true;
}
if (result != null) {
if ((ModuleSymbol) me == syms.unnamedModule) {
continue;
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;
}
Expand Down

0 comments on commit 2b08947

Please sign in to comment.