Skip to content

Commit

Permalink
[java-intention] IDEA-327580 Type info not working on declaration
Browse files Browse the repository at this point in the history
- fixed tests

GitOrigin-RevId: 788a33ceb1dcc26c985b7ebea67e403ce60c17e4
  • Loading branch information
Mikhail Pyltsin authored and intellij-monorepo-bot committed Sep 3, 2023
1 parent b3dfaa0 commit f289a39
Showing 1 changed file with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,17 +212,16 @@ void test() {
public void testLambdaParameter() {
doTest("""
void test() {
class Test{
interface Consumer<T>{
public void consume(T t);
}
class Test2{
public void test(Consumer<String> a) {
}
}
new Test().test(<selection>a</selection>-> System.out.println(a));
}""", "int",
"<table>" +
"<tr><td align=\"left\" style=\"color:#909090\" valign=\"top\">Type:</td><td>int</td></tr>" +
"<tr><td align=\"left\" style=\"color:#909090\" valign=\"top\">Value:</td><td>1</td></tr>" +
"</table>");
new Test2().test(<selection>a</selection>-> System.out.println(a));
}""", "String", "No advanced info found");
}

public void testEscaping() {
Expand Down Expand Up @@ -250,15 +249,15 @@ private void doTest(@Language(value = "JAVA", prefix = "@SuppressWarnings(\"all\
PsiTreeUtil.findElementOfClassAtRange(file, selection.getStartOffset(), selection.getEndOffset(), PsiExpression.class);
if (element == null) {
element =
PsiTreeUtil.findElementOfClassAtRange(file, selection.getStartOffset(), selection.getEndOffset(), PsiIdentifier.class);
PsiTreeUtil.findElementOfClassAtRange(file, selection.getStartOffset(), selection.getEndOffset(), PsiParameter.class);
}
if (element == null) {
element =
PsiTreeUtil.findElementOfClassAtRange(file, selection.getStartOffset(), selection.getEndOffset(), PsiKeyword.class);
PsiTreeUtil.findElementOfClassAtRange(file, selection.getStartOffset(), selection.getEndOffset(), PsiIdentifier.class);
}
if (element == null) {
element =
PsiTreeUtil.findElementOfClassAtRange(file, selection.getStartOffset(), selection.getEndOffset(), PsiIdentifier.class);
PsiTreeUtil.findElementOfClassAtRange(file, selection.getStartOffset(), selection.getEndOffset(), PsiKeyword.class);
}
assertNotNull("Expression not found", element);
JavaTypeProvider provider = new JavaTypeProvider();
Expand Down

0 comments on commit f289a39

Please sign in to comment.