[11u] RFR: 8193367: Annotated type variable bounds crash javac

Thomas Stüfe thomas.stuefe at gmail.com
Mon Jul 20 08:01:28 UTC 2020


Hi Goetz,

LambdaToMethod.java:

Your version:

2358             boolean interfaceParameterIsIntersectionOrUnionType() {
2359                 List<Type> tl =
tree.getDescriptorType(types).getParameterTypes();
2360                 for (; tl.nonEmpty(); tl = tl.tail) {
2361                     Type pt = tl.head;
2362                     switch (pt.getKind()) {
2363                         case INTERSECTION:
2364                         case UNION:
2365                             return true;
2366                         case TYPEVAR:
2367                             TypeVar tv = (TypeVar) pt;
2368                             if (tv.getUpperBound().getKind() ==
TypeKind.INTERSECTION) {
2369                                 return true;
2370                             }
2371                     }
2372                 }
2373                 return false;
2374             }


does not seem equivalent to the original version:

boolean isIntersectionOrUnionType(Type t) {
    switch (t.getKind()) {
        case INTERSECTION:
        case UNION:
            return true;
        case TYPEVAR:
            TypeVar tv = (TypeVar) t;
            return isIntersectionOrUnionType(tv.getUpperBound());
    }
    return false;
}

for cases where tv.getUpperBound().kind == UNION. Yours returns false,
original returns true.


Best Regards, Thomas





On Sun, Jul 19, 2020 at 12:27 PM Lindenmaier, Goetz <
goetz.lindenmaier at sap.com> wrote:

> Hi
>
> I am downporting this for 11.0.9-oracle parity.
> I had to resolve 3 files. 2 are copyrights.
> In LambdaToMethod.java, 11 compares with INTERSECTION,
> where the original calls a method. The selection of the bounds field
> is similar though, and was easy to adapt.
>
> http://cr.openjdk.java.net/~goetz/wr20/8193367-ann_type_var-jdk11/01/
>
> Please review.
>
> https://bugs.openjdk.java.net/browse/JDK-8193367
> http://hg.openjdk.java.net/jdk/jdk/rev/a772e65727c5
>
> Best regards,
>   Goetz.
>


More information about the jdk-updates-dev mailing list