From 00cc0561ab759922eba86ff6980787b848cf907a Mon Sep 17 00:00:00 2001 From: Chris Povirk Date: Wed, 14 Oct 2020 13:46:33 -0400 Subject: [PATCH] Invasive, hardcoded changes for JSpecify handling of unbounded wildcards. --- .../framework/type/BoundsInitializer.java | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/framework/src/main/java/org/checkerframework/framework/type/BoundsInitializer.java b/framework/src/main/java/org/checkerframework/framework/type/BoundsInitializer.java index 5869863778..a1368e3553 100644 --- a/framework/src/main/java/org/checkerframework/framework/type/BoundsInitializer.java +++ b/framework/src/main/java/org/checkerframework/framework/type/BoundsInitializer.java @@ -577,26 +577,20 @@ public void initializeExtendsBound(AnnotatedWildcardType wildcard) { AnnotatedTypeFactory typeFactory = wildcard.atypeFactory; WildcardType javaWildcardType = wildcard.getUnderlyingType(); - TypeMirror javaExtendsBound; + AnnotatedTypeMirror extendsBound; if (javaWildcardType.getExtendsBound() != null) { // If the wildcard type has an extends bound, use it. - javaExtendsBound = javaWildcardType.getExtendsBound(); - } else if (wildcard.getTypeVariable() != null) { - // Otherwise use the upper bound of the type variable associated with this wildcard. - javaExtendsBound = wildcard.getTypeVariable().getUpperBound(); + extendsBound = + AnnotatedTypeMirror.createType( + javaWildcardType.getExtendsBound(), typeFactory, false); } else { - // Otherwise use the upper bound of the java wildcard. - javaExtendsBound = - TypesUtils.wildUpperBound( - javaWildcardType, wildcard.atypeFactory.processingEnv); + extendsBound = AnnotatedTypeMirror.createTypeOfObject(wildcard.atypeFactory); } if (wildcard.isUninferredTypeArgument()) { rawTypeWildcards.put(wildcard.getTypeVariable(), wildcard.getUnderlyingType()); } - AnnotatedTypeMirror extendsBound = - AnnotatedTypeMirror.createType(javaExtendsBound, typeFactory, false); wildcard.setExtendsBound(extendsBound); this.wildcards.put(wildcard.getUnderlyingType(), wildcard);