mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java-stubs] A test for IDEA-349551 False positive warnings with @NonNullByDefault and @Nullable annotations
GitOrigin-RevId: 91fd9d88bcf74769356ee94192b2aa5f06eb1060
This commit is contained in:
committed by
intellij-monorepo-bot
parent
67e9414e4a
commit
834b04f28a
@@ -410,7 +410,7 @@ public class JavaStubBuilderTest extends LightIdeaTestCase {
|
||||
IMPLEMENTS_LIST:PsiRefListStub[IMPLEMENTS_LIST:]
|
||||
""");
|
||||
}
|
||||
|
||||
|
||||
public void testNestedGenerics() {
|
||||
doTest("""
|
||||
class X {
|
||||
@@ -758,7 +758,7 @@ public class JavaStubBuilderTest extends LightIdeaTestCase {
|
||||
IMPLEMENTS_LIST:PsiRefListStub[IMPLEMENTS_LIST:]
|
||||
""");
|
||||
}
|
||||
|
||||
|
||||
public void testCommentInType() {
|
||||
doTest("""
|
||||
class A {
|
||||
@@ -784,7 +784,7 @@ public class JavaStubBuilderTest extends LightIdeaTestCase {
|
||||
THROWS_LIST:PsiRefListStub[THROWS_LIST:]
|
||||
""");
|
||||
}
|
||||
|
||||
|
||||
public void testInterfaceKeywordInBody() {
|
||||
String source = """
|
||||
class X {
|
||||
@@ -800,7 +800,7 @@ public class JavaStubBuilderTest extends LightIdeaTestCase {
|
||||
PsiClassStub<?> classStub = (PsiClassStub<?>)stubs.get(1);
|
||||
assertFalse(classStub.isInterface());
|
||||
}
|
||||
|
||||
|
||||
public void testTypeAnnotation() {
|
||||
String source = """
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -828,6 +828,32 @@ public class JavaStubBuilderTest extends LightIdeaTestCase {
|
||||
/1/1->@NotNull""", annotations.toString());
|
||||
}
|
||||
|
||||
public void testTypeAnnotationQualified() {
|
||||
String source = """
|
||||
import pkg.Anno1;
|
||||
import pkg.Anno2;
|
||||
|
||||
public final class Container {
|
||||
public final native com.foo.@Anno1 Outer.@Anno2 Inner test();
|
||||
}
|
||||
""";
|
||||
PsiJavaFile file = (PsiJavaFile)createLightFile("test.java", source);
|
||||
FileASTNode fileNode = file.getNode();
|
||||
assertNotNull(fileNode);
|
||||
assertFalse(fileNode.isParsed());
|
||||
StubElement<?> element = myBuilder.buildStubTree(file);
|
||||
PsiClassStub<?> classStub = ContainerUtil.findInstance(element.getChildrenStubs(), PsiClassStub.class);
|
||||
assertNotNull(classStub);
|
||||
PsiMethodStub methodStub = ContainerUtil.findInstance(classStub.getChildrenStubs(), PsiMethodStub.class);
|
||||
assertNotNull(methodStub);
|
||||
TypeInfo typeInfo = methodStub.getReturnTypeText();
|
||||
assertEquals("com.foo.Outer.Inner", typeInfo.text());
|
||||
TypeAnnotationContainer annotations = typeInfo.getTypeAnnotations();
|
||||
assertEquals("""
|
||||
/.->@Anno1
|
||||
->@Anno2""", annotations.toString());
|
||||
}
|
||||
|
||||
public void testSOEProof() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
SecureRandom random = new SecureRandom();
|
||||
|
||||
Reference in New Issue
Block a user