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

generics: bridge for inherited final method can cause verify error

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 5.0
    • Fix Version/s: 1.4.1
    • Component/s: tools
    • Subcomponent:
    • Resolved In Build:
      hopper
    • CPU:
      generic
    • OS:
      solaris_8

      Description


      frog:~/workspaces/test/Generic11 $ ls -la
      total 7
      drwxr-xr-x 2 gafter 512 Feb 4 22:14 .
      drwxr-xr-x 116 gafter 3072 Feb 4 22:19 ..
      -rw-r--r-- 1 gafter 75 Feb 4 22:14 MyColor.java
      -rw-r--r-- 1 gafter 82 Feb 4 14:53 MyComparable.java
      -rw-r--r-- 1 gafter 125 Feb 4 22:11 MyEnum.java
      frog:~/workspaces/test/Generic11 $ cat -n MyColor.java
           1 class MyColor extends MyEnum<MyColor> {
           2 public static void main() {}
           3 }
      frog:~/workspaces/test/Generic11 $ cat -n MyComparable.java
           1 interface MyComparable<T extends MyComparable<T>> {
           2 int compareTo(T other);
           3 }
      frog:~/workspaces/test/Generic11 $ cat -n MyEnum.java
           1 class MyEnum<E extends MyEnum<E>> implements MyComparable<E> {
           2
           3 public final int compareTo(E other) {
           4 return 0;
           5 }
           6 }
      frog:~/workspaces/test/Generic11 $ newjavac -gj *.java
      frog:~/workspaces/test/Generic11 $ /usr/java1.4/bin/java -Xfuture MyColor
      Exception in thread "main" java.lang.VerifyError: class MyColor overrides final method .
      at java.lang.ClassLoader.defineClass0(Native Method)
      at java.lang.ClassLoader.defineClass(ClassLoader.java:509)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
      at java.net.URLClassLoader.defineClass(URLClassLoader.java:246)
      at java.net.URLClassLoader.access$100(URLClassLoader.java:54)
      at java.net.URLClassLoader$1.run(URLClassLoader.java:193)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:262)
      at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:322)
      frog:~/workspaces/test/Generic11 $ jdis MyColor.class
      super class MyColor
      extends MyEnum
      {


      Method "<init>":"()V"
      stack 1 locals 1
      {
      aload_0;
      invokespecial Method MyEnum."<init>":"()V";
      return;
      }

      public static Method main:"()V"
      stack 0 locals 0
      {
      return;
      }

      public Method compareTo:"(LMyEnum;)I"
      stack 2 locals 2
      {
      aload_0;
      aload_1;
      checkcast class MyColor;
      invokespecial Method MyEnum.compareTo:"(LMyEnum;)I";
      ireturn;
      }

      } // end Class MyColor
      frog:~/workspaces/test/Generic11 $

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                gafter Neal Gafter
                Reporter:
                gafter Neal Gafter
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: