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$
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$
- duplicates
-
JDK-4398789 Correct bytecode for Object method on interface object crashes VM
-
- Closed
-