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

Godmar Back gback@stanford.edu
Tue, 21 May 2002 12:04:20 -0600 (MDT)


> 
> 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