From 49a799d926cbf6c7697363262747a24b3be73151 Mon Sep 17 00:00:00 2001 From: Aosen Xiong Date: Wed, 19 Jun 2024 16:53:39 -0400 Subject: [PATCH 1/3] Only clean when the annotated type mirror is type variable --- .../checkerframework/framework/stub/AnnotationFileParser.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/framework/src/main/java/org/checkerframework/framework/stub/AnnotationFileParser.java b/framework/src/main/java/org/checkerframework/framework/stub/AnnotationFileParser.java index 0557b75cb6f..ef20f024d6e 100644 --- a/framework/src/main/java/org/checkerframework/framework/stub/AnnotationFileParser.java +++ b/framework/src/main/java/org/checkerframework/framework/stub/AnnotationFileParser.java @@ -1521,7 +1521,9 @@ private void clearAnnotations(AnnotatedTypeMirror atype, Type typeDef) { */ // Clear existing annotations, which only makes a difference for // type variables, but doesn't hurt in other cases. - atype.clearAnnotations(); + if (atype.getKind() == TypeKind.TYPEVAR) { + atype.clearAnnotations(); + } } /** From 280e8aaf0d5bd96877ee2787e54538b98ed78a61 Mon Sep 17 00:00:00 2001 From: Aosen Xiong Date: Thu, 20 Jun 2024 01:01:14 -0400 Subject: [PATCH 2/3] Add error message on NoExplicitAnnotations test case --- checker/tests/stubparser-nullness/NoExplicitAnnotations.java | 1 + 1 file changed, 1 insertion(+) diff --git a/checker/tests/stubparser-nullness/NoExplicitAnnotations.java b/checker/tests/stubparser-nullness/NoExplicitAnnotations.java index 82e72708ca5..5e0dd3d4062 100644 --- a/checker/tests/stubparser-nullness/NoExplicitAnnotations.java +++ b/checker/tests/stubparser-nullness/NoExplicitAnnotations.java @@ -51,6 +51,7 @@ void use( NoExplicitAnnotationsSub2 sub2, NoExplicitAnnotationsSub3 sub3) { nble = sub1.method1(); + // :: error: (assignment.type.incompatible) nn = sub1.method1(); nble = sub2.method2(); nn = sub2.method2(); From b5fc573a987c3bffbb53603ed1da0074af3f776d Mon Sep 17 00:00:00 2001 From: Aosen Xiong Date: Thu, 20 Jun 2024 02:20:36 -0400 Subject: [PATCH 3/3] Empty commit for CI