diff --git a/checker/src/main/java/org/checkerframework/checker/interning/InterningAnnotatedTypeFactory.java b/checker/src/main/java/org/checkerframework/checker/interning/InterningAnnotatedTypeFactory.java index 9e5f4a72665..988fc09d12d 100644 --- a/checker/src/main/java/org/checkerframework/checker/interning/InterningAnnotatedTypeFactory.java +++ b/checker/src/main/java/org/checkerframework/checker/interning/InterningAnnotatedTypeFactory.java @@ -148,15 +148,6 @@ protected TypeAnnotator createTypeAnnotator() { return new ListTypeAnnotator(new InterningTypeAnnotator(this), super.createTypeAnnotator()); } - @Override - public void addComputedTypeAnnotations(Tree tree, AnnotatedTypeMirror type, boolean useFlow) { - Element element = TreeUtils.elementFromTree(tree); - if (!type.isAnnotatedInHierarchy(INTERNED) && ElementUtils.isCompileTimeConstant(element)) { - type.addAnnotation(INTERNED); - } - super.addComputedTypeAnnotations(tree, type, useFlow); - } - @Override public void addComputedTypeAnnotations(Element element, AnnotatedTypeMirror type) { if (!type.isAnnotatedInHierarchy(INTERNED) && ElementUtils.isCompileTimeConstant(element)) { diff --git a/framework/src/main/java/org/checkerframework/framework/type/AbstractViewpointAdapter.java b/framework/src/main/java/org/checkerframework/framework/type/AbstractViewpointAdapter.java index 6520cfa3057..b59b3c043e9 100644 --- a/framework/src/main/java/org/checkerframework/framework/type/AbstractViewpointAdapter.java +++ b/framework/src/main/java/org/checkerframework/framework/type/AbstractViewpointAdapter.java @@ -64,7 +64,6 @@ public void viewpointAdaptMember( if (!shouldAdaptMember(memberType, memberElement)) { return; } - AnnotatedTypeMirror decltype = atypeFactory.getAnnotatedType(memberElement); AnnotatedTypeMirror combinedType = combineTypeWithType(receiverType, decltype); memberType.replaceAnnotations(combinedType.getAnnotations()); diff --git a/framework/tests/viewpointtest/AnnoOnTypeVariableUse.java b/framework/tests/viewpointtest/AnnoOnTypeVariableUse.java new file mode 100644 index 00000000000..f51af85f9b0 --- /dev/null +++ b/framework/tests/viewpointtest/AnnoOnTypeVariableUse.java @@ -0,0 +1,17 @@ +import viewpointtest.quals.*; + +@SuppressWarnings("cast.unsafe.constructor.invocation") +class Demo { + @ReceiverDependentQual E element; + + static void test() { + Demo<@B Element> d = new @A Demo<@B Element>(); + // d.element = @A |> @RDQ = @A + // thus expects no error here + d.element = new @A Element(); + } +} + +class Element { + int f = 1; +}