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

Correct code for clone on derived interface crashes the VM

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.4.0
    • hotspot
    • None
    • generic
    • solaris_7

      One more try

      frog$ cat -n T.java
           1 class T {
           2 interface I1 {
           3 public Object clone();
           4 };
           5 interface I2 extends I1 {
           6 };
           7 static class C implements I2 {
           8 public Object clone() { return new C(); }
           9 };
          10 public static void main(String[] args) {
          11 I2 i2 = new C();
          12 i2.clone();
          13 }
          14 }
      frog$ newjavac -Xcomplyfields T.java
      + /home/gafter/bin/newjava -Xfuture -Xbootclasspath/p:/net/frog/gafter/gjc-neal/gjclasses2 -classpath /net/frog/gafter/gjc-neal/gjclasses2:/net/frog/gafter/gjc-neal/make/tools/javac/gjc.jar:/net/frog/gafter/gjc-neal/make/tools/javac/gjcmain.jar com.sun.tools.javac.Main -classpath . -Xcomplyfields T.java
      + /net/frog/gafter/gjc-neal/build/solaris-sparc/bin/java -Xfuture -Xfuture -Xbootclasspath/p:/net/frog/gafter/gjc-neal/gjclasses2 -classpath /net/frog/gafter/gjc-neal/gjclasses2:/net/frog/gafter/gjc-neal/make/tools/javac/gjc.jar:/net/frog/gafter/gjc-neal/make/tools/javac/gjcmain.jar com.sun.tools.javac.Main -classpath . -Xcomplyfields T.java
      frog$ jdis T.class
      super class T
      {


      Method "<init>":"()V"
              stack 1 locals 1
      {
                      aload_0;
                      invokespecial Method java/lang/Object."<init>":"()V";
                      return;
      }

      public static Method main:"([Ljava/lang/String;)V"
              stack 2 locals 2
      {
                      new class T$C;
                      dup;
                      invokespecial Method T$C."<init>":"()V";
                      astore_1;
                      aload_1;
                      invokeinterface InterfaceMethod T$I2.clone:"()Ljava/lang/Object;", 1;
                      pop;
                      return;
      }

      static InnerClass C=class T$C of class T;
      static abstract interface InnerClass I2=class T$I2 of class T;
      static abstract interface InnerClass I1=class T$I1 of class T;

      } // end Class T
      frog$ newjava T
      + /net/frog/gafter/gjc-neal/build/solaris-sparc/bin/java -Xfuture T
      Exception in thread "main" java.lang.AbstractMethodError
              at T.main(T.java:12)
      frog$

            psoper Pete Soper (Inactive)
            gafter Neal Gafter (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: