RFR: JDK-8042803 Types.wildLowerBound and cvarLowerBound should call unannotatedType()

Vicente-Arturo Romero-Zaldivar vicente.romero at oracle.com
Tue Jun 17 19:40:46 UTC 2014


On 17/06/14 20:32, Dan Smith wrote:
> This is a small patch to properly handle AnnotatedTypes in 8u20 in some code of mine from a previous bug fix.  No patch for 9, because AnnotatedTypes have been removed there.

looks good,

Vicente

>
> —Dan
>
> diff -r b060e7c2f5cc src/share/classes/com/sun/tools/javac/code/Types.java
> --- a/src/share/classes/com/sun/tools/javac/code/Types.java	Mon Jun 16 11:19:22 2014 -0700
> +++ b/src/share/classes/com/sun/tools/javac/code/Types.java	Tue Jun 17 13:32:35 2014 -0600
> @@ -135,7 +135,7 @@
>                else
>                    return wildUpperBound(w.type);
>            }
> -         else return t;
> +         else return t.unannotatedType();
>        }
>   
>        /**
> @@ -147,7 +147,7 @@
>                TypeVar v = (TypeVar) t.unannotatedType();
>                return v.isCaptured() ? cvarUpperBound(v.bound) : v;
>            }
> -         else return t;
> +         else return t.unannotatedType();
>        }
>   
>       /**
> @@ -156,10 +156,10 @@
>        */
>       public Type wildLowerBound(Type t) {
>           if (t.hasTag(WILDCARD)) {
> -            WildcardType w = (WildcardType) t;
> +            WildcardType w = (WildcardType) t.unannotatedType();
>               return w.isExtendsBound() ? syms.botType : wildLowerBound(w.type);
>           }
> -        else return t;
> +        else return t.unannotatedType();
>       }
>   
>       /**
> @@ -167,10 +167,11 @@
>        * @param t a type
>        */
>       public Type cvarLowerBound(Type t) {
> -        if (t.hasTag(TYPEVAR) && ((TypeVar) t).isCaptured()) {
> -            return cvarLowerBound(t.getLowerBound());
> +        if (t.hasTag(TYPEVAR)) {
> +            TypeVar v = (TypeVar) t.unannotatedType();
> +            return v.isCaptured() ? cvarLowerBound(v.getLowerBound()) : v;
>           }
> -        else return t;
> +        else return t.unannotatedType();
>       }
>       // </editor-fold>
>



More information about the compiler-dev mailing list