Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8027253

javac illegally accepts array as bound

    XMLWordPrintable

Details

    • b112
    • 8
    • b117
    • Verified

    Backports

      Description

        Javac 8b112 accepts the following code:
        class Class<M extends Object[]> { }

        As per JLS 7, 4.4. Type Variables

        Grammar:

        TypeParameter:
            TypeVariable TypeBoundopt

        TypeBound:
            extends TypeVariable
            extends ClassOrInterfaceType AdditionalBoundListopt

        4.3. Reference Types and Values:
        ReferenceType:
            ClassOrInterfaceType
            TypeVariable
            ArrayType

        This means ArrayType should not be allowed.

        The following JCK tests fail:

          lang/TYPE/type140/type14003m0/type14003m0.html
        lang/TYPE/type140/type14003m1/type14003m1.html
        lang/TYPE/type140/type14003m2/type14003m2.html
        lang/TYPE/type140/type14003m3/type14003m3.html
          lang/TYPE/type140/type14003m0/type14003m01.html
        lang/TYPE/type140/type14003m1/type14003m11.html
        lang/TYPE/type140/type14003m2/type14003m21.html
        lang/TYPE/type140/type14003m3/type14003m31.html

        Attachments

          Issue Links

            Activity

              People

                emc Eric Mccorkle
                vrudomet Victor Rudometov
                Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: