-
Bug
-
Resolution: Fixed
-
P4
-
1.3.0
-
mantis
-
generic
-
generic
-
Verified
Consider:
class ArrayClone {
public static void main(String[] args) {
args.clone();
}
}
Compiling this with javac (1.3 version) and running javap on the resulting class
file, we get:
javap -c ArrayClone
Compiled from ArrayClone.java
class ArrayClone extends java.lang.Object {
ArrayClone();
public static void main(java.lang.String[]);
}
Method ArrayClone()
0 aload_0
1 invokespecial #1 <Method java.lang.Object()>
4 return
Method void main(java.lang.String[])
0 aload_0
1 invokevirtual #2 <Method java.lang.Object clone()>
4 pop
5 return
Note that the call to clone refers to Object rather than to the array type
String[]. This is wrong under both old and new JLS rules for compilation.
This only matters for illegal programs, so it is not a big deal.
gilad.bracha@eng 2000-04-12
class ArrayClone {
public static void main(String[] args) {
args.clone();
}
}
Compiling this with javac (1.3 version) and running javap on the resulting class
file, we get:
javap -c ArrayClone
Compiled from ArrayClone.java
class ArrayClone extends java.lang.Object {
ArrayClone();
public static void main(java.lang.String[]);
}
Method ArrayClone()
0 aload_0
1 invokespecial #1 <Method java.lang.Object()>
4 return
Method void main(java.lang.String[])
0 aload_0
1 invokevirtual #2 <Method java.lang.Object clone()>
4 pop
5 return
Note that the call to clone refers to Object rather than to the array type
String[]. This is wrong under both old and new JLS rules for compilation.
This only matters for illegal programs, so it is not a big deal.
gilad.bracha@eng 2000-04-12