[kaffe] Patches to enable kaffe to run Saxon 7.3

Ito Kazumitsu ito.kazumitsu at hitachi-cable.co.jp
Tue Nov 19 22:41:14 PST 2002


Saxon 7.3 has been released.  This version uses more JDK 1.4
features than Saxon 7.2,  so I applied the following patches
to kaffe, whose ChangeLog head is

  Wed Nov 13 12:11:59 CET 2002 Dalibor Topic <robilad at yahoo.com>

--- java/io/File.java.orig	Fri Jan  4 14:12:00 2002
+++ java/io/File.java	Wed Nov 20 12:33:19 2002
@@ -365,6 +365,16 @@
 	    isDirectory() ? getAbsolutePath() + separator : getAbsolutePath());
 }
 
+// The following toURI() is wrong,  but works at least for Saxon 7.3.
+public URL toURI() {
+	try {
+		return toURL();
+	}
+	catch (MalformedURLException e) {
+		return null;
+	}
+}
+
 public boolean isHidden() {
 	checkReadAccess();
 	return getName().startsWith(".");
--- java/lang/String.java.orig	Thu Apr  4 21:52:29 2002
+++ java/lang/String.java	Wed Nov 20 11:44:51 2002
@@ -18,7 +18,7 @@
 import kaffe.io.ByteToCharConverter;
 import kaffe.io.CharToByteConverter;
 
-public final class String implements Serializable, Comparable {
+public final class String implements Serializable, Comparable, CharSequence {
 
 	/**
 	 * Maximum slop (extra unused chars in the char[]) that
@@ -500,6 +500,10 @@
 
 	return new String( offset+sIdx, offset+eIdx, value);
 
+}
+
+public CharSequence subSequence( int sIdx, int eIdx) {
+        return substring( sIdx, eIdx);
 }
 
 public char[] toCharArray() {
--- java/lang/StringBuffer.java.orig	Fri Jun 28 05:42:53 2002
+++ java/lang/StringBuffer.java	Wed Nov 20 11:46:08 2002
@@ -10,7 +10,7 @@
 
 package java.lang;
 
-public final class StringBuffer implements java.io.Serializable {
+public final class StringBuffer implements java.io.Serializable, CharSequence {
 	private static final int SPARECAPACITY = 16;
 
 	char[] buffer;				// character buffer
@@ -144,6 +144,10 @@
 		isStringized = true;
 		return new String(start, end, buffer);
 	}
+}
+
+public CharSequence subSequence(int start, int end) {
+        return substring(start, end);
 }
 
 public void ensureCapacity(int minCapacity) {
--- java/nio/CharBuffer.java.orig	Thu Nov  7 18:16:18 2002
+++ java/nio/CharBuffer.java	Wed Nov 20 11:49:36 2002
@@ -36,7 +36,7 @@
 exception statement from your version. */
 
 package java.nio;
-public abstract class CharBuffer extends Buffer
+public abstract class CharBuffer extends Buffer implements CharSequence
 {
     private ByteOrder endian = ByteOrder.BIG_ENDIAN;
    protected char [] backing_buffer;
--- gnu/java/nio/CharBufferImpl.java.orig	Thu May  2 20:22:40 2002
+++ gnu/java/nio/CharBufferImpl.java	Wed Nov 20 13:01:53 2002
@@ -143,4 +143,19 @@
         }
       return super.toString();
     }
+
+    // There must be a better way of doing the following.
+    public CharSequence subSequence(int start, int end)
+    {
+        return toString().substring(start, end);
+    }
+    public int length()
+    {
+        return toString().length();
+    }
+    public char charAt(int i)
+    {
+	return toString().charAt(i);
+    }
+
 }




More information about the kaffe mailing list