Skip to content

Commit

Permalink
Show declaration (F3) & Mouseover Popups not working
Browse files Browse the repository at this point in the history
  • Loading branch information
stephan-herrmann committed Jun 14, 2024
1 parent 3eb741f commit 71d24ad
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3166,12 +3166,45 @@ public static void main(String[] args) {
parser.setStatementsRecovery(true);
CompilationUnit dom = (CompilationUnit)parser.createAST(null);
Name variable = (Name)new NodeFinder(dom, start, length).getCoveredNode();
IJavaElement javaElement = variable.resolveBinding().getJavaElement();
IJavaElement javaElement = variable.resolveBinding().getJavaElement();

assertElementsEqual(
"Unexpected elements",
"abc [in doit(I) [in <lambda #1> [in doit(I) [in <lambda #1> [in doit(I) [in <lambda #1> [in main(String[]) [in X [in [Working copy] X.java [in <default> [in src [in Resolve]]]]]]]]]]]]",
new IJavaElement[] { javaElement }
);
}
public void testGH2571() throws JavaModelException {
String contents = """
package org.eclipse;
import java.util.function.Predicate;
import java.util.function.Supplier;
public class PopupKiller {
public final Supplier<Predicate<String>> predicateSupplier = () -> new Predicate<String>() {
@SuppressWarnings("unused")
public static boolean THIS_VARIABLE_KILLS_JAVADOC_POPUPS_AND_F3 = true;
@Override
public boolean test(final String record) {
System.out.println("<-- try to Mouseover System.out.: nothing!");
return true;
}
};
}
""";
this.wc = getWorkingCopy("/Resolve/src/org/eclipse/PopupKiller.java", contents);
String selectionIdentifier = "out";
int start = contents.indexOf(selectionIdentifier);

IJavaElement[] elements = this.wc.codeSelect(start, selectionIdentifier.length());
assertElementsEqual(
"Unexpected elements",
"out [in System [in System.class [in java.lang [in /home/eclipse/jdt-master/jclFull1.8.jar]]]]",
elements
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,8 @@ protected boolean triggerRecoveryUponLambdaClosure(Statement statement, boolean
statementEnd = statement.sourceEnd;
}
for (int i = this.elementPtr; i >= 0; --i) {
if (this.elementKindStack[i] == K_TYPE_DELIMITER)
break;
if (this.elementKindStack[i] != K_LAMBDA_EXPRESSION_DELIMITER)
continue;
LambdaExpression expression = (LambdaExpression) this.elementObjectInfoStack[i];
Expand Down

0 comments on commit 71d24ad

Please sign in to comment.