Menu

#104 problem with type casts and static fields

open
nobody
5
2012-11-27
2006-08-07
Tim Wahls
No

MultiJava does not seem to like a combination of a type
cast and accessing a static field through the result.
The following class:

public class Baz {
public static int j = 3;

public static void main(String argv[]) {
Baz b = new Baz();
System.out.println( ((Baz) b).j );
}
}

compiles and runs just fine with standard Java, but gives:

Exception in thread "main" java.lang.VerifyError:
(class: Baz, method: main signature:
([Ljava/lang/String;)V) Incompatible object argument
for function call

when compiled with MultiJava and then run. If the cast
is removed or the field is not declared static, the
code compiles and runs just fine with MultiJava.

Discussion


Log in to post a comment.