[java] don't show illegal static error in javadoc reference (IDEA-211302)

GitOrigin-RevId: 2f71fba18c8f61496fe6c6fbc2ea171d2adbafdd
This commit is contained in:
Anna Kozlova
2022-02-16 20:53:44 +01:00
committed by intellij-monorepo-bot
parent 1e23b24835
commit cc41c3aec2
3 changed files with 10 additions and 3 deletions

View File

@@ -1195,7 +1195,10 @@ public class HighlightVisitorImpl extends JavaElementVisitor implements Highligh
place = ref;
}
}
if (place != null && PsiTreeUtil.isAncestor(aClass, place, false) && aClass.hasTypeParameters()) {
if (place != null &&
PsiTreeUtil.isAncestor(aClass, place, false) &&
aClass.hasTypeParameters() &&
!PsiUtil.isInsideJavadocComment(place)) {
myHolder.add(HighlightClassUtil.checkCreateInnerClassFromStaticContext(ref, place, (PsiClass)resolved));
}
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2021 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.intellij.psi.util;
import com.intellij.core.JavaPsiBundle;
@@ -870,7 +870,7 @@ public final class PsiUtil extends PsiUtilCore {
}
public static boolean isInsideJavadocComment(PsiElement element) {
return PsiTreeUtil.getParentOfType(element, PsiDocComment.class, true) != null;
return PsiTreeUtil.getParentOfType(element, PsiDocComment.class, true, PsiMember.class) != null;
}
@NotNull

View File

@@ -4,6 +4,10 @@ class MyTest<K> {
}
//not an error in java 8?!
/**
* {@link A}
*/
static class C<T extends <error descr="'MyTest.this' cannot be referenced from a static context">A<String></error>> {
}