###@###.### 2004-04-22
J2SE Version (please include all output from java -version flag):
java version "1.5.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b46)
Java HotSpot(TM) Client VM (build 1.5.0-beta2-b46, mixed mode)
Does this problem occur on J2SE 1.4 or 1.4.1 or 1.4.2? Yes / No (pick one)
No
Operating System Configuration Information (be specific):
Windows 2000 sp2
Hardware Configuration Information (be specific):
Pentium 4 3GHz with 1GB RAM
Bug Description:
Javac generates corrupt bytecode if redundant cast included in source.
Steps to Reproduce (be specific):
1) Compile the following source using the options.
//////////////////////////////////////////////////
public class TestCase0 {
public static void main(String args[]) throws Exception {
doIt();
System.out.println("Terminated normally");
}
public static void doIt() {
Holder<Integer> association = new Holder<Integer>(new Integer(0));
Integer sizeHolder = (Integer)(association.getValue()); //Cast to Integer is redundant!!!
System.out.println(sizeHolder.intValue());
}
static class Holder<V> {
V value;
Holder(V value) {
this.value = value;
}
V getValue() {
return value;
}
}
}
//////////////////////////////////////////////////
2) Execute the class TestCase0
java TestCase0
3) You get the following VerifyError
Exception in thread "main" java.lang.VerifyError: (class: TestCase0, method:
doIt signature: ()V) Incompatible object argument for function call
If the redundant cast to Integer is removed then there is no problem.
- duplicates
-
JDK-5035001 redundant cast with generified APIs causes verify error
- Resolved