[kaffe] libraries/clib/native/Field.c

Godmar Back gback at cs.utah.edu
Tue May 21 11:04:20 PDT 2002


> 
> It makes life easier when you compare output of JDK
> and kaffe. But as it's not in the spec most of the
> time, it's more of a developer preference: if you
> match Sun's output, it's fine, if you don't, it's fine
> with me, too.
> 

The idea would of course be to improve on Sun's error messages
where possible.  For instance, this program:

    // Cast.java
    public class Cast {
	public static void main(String []av) {
	    Object o = new Integer(42);
	    Byte b = (Byte)o;
	}
    }

outputs under Sun's JDK:

Exception in thread "main" java.lang.ClassCastException: java.lang.Integer
	at Cast.main(Cast.java:5)

Kaffe's output is more informative:

java.lang.ClassCastException: can't cast `java/lang/Integer' to `java/lang/Byte'
	at Cast.main(Cast.java:5)

(Especially when you get into classloaders and reflection.)

	- Godmar





More information about the kaffe mailing list