mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-187753 Duplicate annotation in compiled class when Nullable / NotNull Problems inspection is enabled with custom NonNull annotation
This commit is contained in:
+1
-1
@@ -188,7 +188,7 @@ public class NotNullVerifyingInstrumenter extends ClassVisitor implements Opcode
|
||||
|
||||
@Override
|
||||
public AnnotationVisitor visitTypeAnnotation(int typeRef, TypePath typePath, String desc, boolean visible) {
|
||||
AnnotationVisitor av = mv.visitTypeAnnotation(typeRef, null, desc, visible);
|
||||
AnnotationVisitor av = mv.visitTypeAnnotation(typeRef, typePath, desc, visible);
|
||||
if (typePath != null) return av;
|
||||
|
||||
TypeReference ref = new TypeReference(typeRef);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@Target({ElementType.TYPE_USE, ElementType.METHOD, ElementType.PARAMETER})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@interface FooAnno {}
|
||||
|
||||
public class TypeUseAndMemberAnnotations {
|
||||
@@ -13,4 +14,6 @@ public class TypeUseAndMemberAnnotations {
|
||||
return null;
|
||||
}
|
||||
|
||||
public @FooAnno java.util.List<@FooAnno String> returnType() { return null; }
|
||||
|
||||
}
|
||||
+6
@@ -200,6 +200,12 @@ public class NotNullVerifyingInstrumenterTest extends UsefulTestCase {
|
||||
Object instance = test.newInstance();
|
||||
verifyCallThrowsException("@FooAnno method TypeUseAndMemberAnnotations.foo1 must not return null", instance, test.getMethod("foo1"));
|
||||
verifyCallThrowsException("Argument 0 for @FooAnno parameter of TypeUseAndMemberAnnotations.foo2 must not be null", instance, test.getMethod("foo2", String.class), (String)null);
|
||||
|
||||
Method returnType = test.getMethod("returnType");
|
||||
verifyCallThrowsException("@FooAnno method TypeUseAndMemberAnnotations.returnType must not return null", instance, returnType);
|
||||
|
||||
assertSize(1, returnType.getAnnotations());
|
||||
assertSize(1, returnType.getAnnotatedReturnType().getAnnotations());
|
||||
}
|
||||
|
||||
public void testMalformedBytecode() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user