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

Javac rejects multiple type-variable bound declarations starting with an enum type

XMLWordPrintable

    • b33
    • generic
    • generic
    • Not verified

      Description:
      Compiler throws an error when a TypeParameter is encountered with multiple bounds containing a valid combination of enum and interface.

      <code>
      bash-3.00$ cat TypeParameterWithMultipleBounds.java
      enum MyEnum implements Comparable<MyEnum> {
      }
       class TypeParameterWithMultipleBounds <T> {
          <S extends MyEnum & Comparable<MyEnum>> void method1(){
          }
      }
      </code>
      <output>
      TypeWithMultipleBounds.java:4: enum types are not extensible
          <S extends MyEnum & Comparable<MyEnum>> void method1(){
           ^
      1 error
      </output>
      <version>
      /net/sqindia/export/disk09/jdk/7/latest/binaries/solsparc/bin/java -version
      java version "1.7.0-ea"
      Java(TM) SE Runtime Environment (build 1.7.0-ea-b24)
      Java HotSpot(TM) Client VM (build 12.0-b01, mixed mode)

      bash-3.00$ uname -a
      SunOS hrajan 5.10 Generic sun4u sparc SUNW,Sun-Blade-100

            mcimadamore Maurizio Cimadamore
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: