[PATCH] compareTo for Number sub-classes in java.lang

Dalibor Topic robilad at yahoo.com
Wed Mar 20 06:14:20 PST 2002


Hi,

I tried to run make check with javac 1.3.1 and it failed on SortTest.java. It 
turned out that javac was using jdk's classes and generating code to call 
Integer.compareTo(Integer). That method is not implemented yet, so kaffe 
complained.

It is an interoperability issue. In Klasses.jar, only 
Integer.compareTo(Object) exists, thus all virtual calls go there. In jdk 
1.2+, there is a compareTo(own type) method. The compiler generates calls to 
the own type version, if it can.

This patch adds the compareTo(own type) method to sub classes of 
java.lang.Number, and adapts the compareTo(Object) method to call it.

have fun,

dalibor topic
-------------- next part --------------
	* libraries/javalib/java/lang/Byte.java,
	libraries/javalib/java/lang/Character.java,
	libraries/javalib/java/lang/Double.java,
	libraries/javalib/java/lang/Float.java,
	libraries/javalib/java/lang/Integer.java,
	libraries/javalib/java/lang/Long.java,
	libraries/javalib/java/lang/Short.java:
	added compareTo methods to compare with same type.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: compareTo.patch
Type: text/x-diff
Size: 4487 bytes
Desc: not available
Url : http://kaffe.org/pipermail/kaffe/attachments/20020320/d63e72bc/attachment-0003.patch 


More information about the kaffe mailing list