First, I've found two bugs in Kiev compiler. Sorry for hacks of code,
to bypass these bugs...
Second, Kiev uses java.util.zip package to work with zip/jar entryes
in CLASSPATH variable. Without this package you need unpack
all zip and jar files to work with the compiler. I think, it's not very
bad news, since there must be some code in Japhar project - just
import it.
Third, here is a list of classes we need append/check. Currently I
removed those that were impossible to compile and temporary
grab two interfaces from Sun's JDK. Here is the list:
// Because of serialize methods
// GetFields and SetFields classes abcent
java.util.HashMap
java.util.Hashtable
java.util.HashSet // depends on HashMap
java.text.AttributedStringIterator // depends on HashMap
java.text.AttributedString // depends on AttributedStringIterator
// Security - class not found java.security.AccessController
// depends on it
java.net.Authentificator
// java.security.cert.Certificate not found
// depends on it
java.security.CodeSource
java.security.ProtectionDomain
// Jar
// java.util.jar package abcent
java.net.JarURLConnection
// Containers
// absent interface Comparable
java.util.Arrays // hacked package - added Comparable
java.util.Collections // hacked package - added Comparable
// Others
java.util.MissingResourceException // abcent
And here is the patch of modifications of your code:
1) I've substituted "enum" with "_enum". It's not necessary, but otherwise
we need -java compatibility flag for kiev compiler (since "enum" is a
keyword of kiev for enumeration classes).
2) "new ArrayIndexOutOfBoundsException( number )" was replaced
with "new ArrayIndexOutOfBoundsException( String.valueOf(number) )".
I think it's not a bug of compiler...
3) '\u000d' was replaced with '\r' - I had a long long discussion about
this bug/feature of javac with JavaCC developers. They didn't wish
to allow this syntax, since JavaCC is written by specs, and they do
not wish support bugs of javac.
4) Added a constructor to WriteAbortedException - I do not now what
about documentation, but your classes uses this constructor.
5) Kiev compiler bug in java.net.InetAddress - it will be
easy to fix the bug in compiler ;-)
6) Kiev compiler bug in java.util.Collections - casts is the
most complex part with operator overloading, I was forced
to put there a "hint" for compiler... I do not think this will be
an easy bug :-(
Here is the patch "cvs diff -u":
? classes
? cp.prj
? cpkiev.diff
? err.log
? project
? removed.classes
? java/util/Comparable.java
? java/util/MissingResourceException.java
Index: gnu/java/beans/BeanInfoEmbryo.java
===================================================================
RCS file: /gd/gnu/anoncvsroot/classpath/gnu/java/beans/BeanInfoEmbryo.java,v
retrieving revision 1.3
diff -u -r1.3 BeanInfoEmbryo.java
--- BeanInfoEmbryo.java 1998/08/01 05:26:13 1.3
+++ BeanInfoEmbryo.java 1998/10/26 18:57:32
@@ -60,9 +60,9 @@
PropertyDescriptor[] Aproperties = new
PropertyDescriptor[properties.size()];
int i = 0;
- Enumeration enum = properties.elements();
- while(enum.hasMoreElements()) {
- Aproperties[i] = (PropertyDescriptor)enum.nextElement();
+ Enumeration _enum = properties.elements();
+ while(_enum.hasMoreElements()) {
+ Aproperties[i] = (PropertyDescriptor)_enum.nextElement();
if(defaultPropertyName != null &&
Aproperties[i].getName().equals(defaultPropertyName)) {
defaultProperty = i;
}
@@ -71,9 +71,9 @@
EventSetDescriptor[] Aevents = new EventSetDescriptor[events.size()];
i = 0;
- enum = events.elements();
- while(enum.hasMoreElements()) {
- Aevents[i] = (EventSetDescriptor)enum.nextElement();
+ _enum = events.elements();
+ while(_enum.hasMoreElements()) {
+ Aevents[i] = (EventSetDescriptor)_enum.nextElement();
if(defaultEventName != null &&
Aevents[i].getName().equals(defaultEventName)) {
defaultEvent = i;
}
Index: java/io/StreamTokenizer.java
===================================================================
RCS file: /gd/gnu/anoncvsroot/classpath/java/io/StreamTokenizer.java,v
retrieving revision 1.2
diff -u -r1.2 StreamTokenizer.java
--- StreamTokenizer.java 1998/09/25 15:26:46 1.2
+++ StreamTokenizer.java 1998/10/26 18:58:36
@@ -806,7 +806,7 @@
break;
case 'r': // Carriage return
- c = '\u000d';
+ c = '\r';
break;
case '"': // Double quote
Index: java/io/WriteAbortedException.java
===================================================================
RCS file: /gd/gnu/anoncvsroot/classpath/java/io/WriteAbortedException.java,v
retrieving revision 1.3
diff -u -r1.3 WriteAbortedException.java
--- WriteAbortedException.java 1998/08/01 04:47:07 1.3
+++ WriteAbortedException.java 1998/10/26 18:58:39
@@ -58,6 +58,21 @@
this.detail = detail;
}
+/**
+ * HACKED BY MK - this constructor required by code of ObjectInputStream
+ *
+ * Create a new WriteAbortedException with an eof parameter indicating
+ * the detailed Exception that caused this exception to be thrown.
+ *
+ * @param msg Additional error message
+ * @param detail The exception that caused this exception to be thrown
+ */
+WriteAbortedException(String msg, Exception detail)
+{
+ super(msg);
+ this.detail = detail;
+}
+
/*************************************************************************/
/*
Index: java/lang/Character.java
===================================================================
RCS file: /gd/gnu/anoncvsroot/classpath/java/lang/Character.java,v
retrieving revision 1.4
diff -u -r1.4 Character.java
--- Character.java 1998/10/11 18:50:37 1.4
+++ Character.java 1998/10/26 18:59:58
@@ -854,7 +854,7 @@
return ((category == SPACE_SEPARATOR && !attr.isNoBreakSpace()) ||
category == LINE_SEPARATOR ||
category == PARAGRAPH_SEPARATOR ||
- (ch >= '\u0009' && ch <= '\u000D') ||
+ (ch >= '\u0009' && ch <= '\r') ||
(ch >= '\u001C' && ch <= '\u001F'));
}
Index: java/lang/String.java
===================================================================
RCS file: /gd/gnu/anoncvsroot/classpath/java/lang/String.java,v
retrieving revision 1.19
diff -u -r1.19 String.java
--- String.java 1998/08/16 03:42:18 1.19
+++ String.java 1998/10/26 19:01:03
@@ -315,7 +315,7 @@
*/
public char charAt(int index) throws IndexOutOfBoundsException {
if (index < 0 || index >= len)
- throw new StringIndexOutOfBoundsException(index);
+ throw new StringIndexOutOfBoundsException(String.valueOf(index));
return str[index];
}
Index: java/lang/StringBuffer.java
===================================================================
RCS file: /gd/gnu/anoncvsroot/classpath/java/lang/StringBuffer.java,v
retrieving revision 1.3
diff -u -r1.3 StringBuffer.java
--- StringBuffer.java 1998/10/19 04:27:19 1.3
+++ StringBuffer.java 1998/10/26 19:01:10
@@ -59,7 +59,7 @@
public synchronized void setLength(int newLength)
throws IndexOutOfBoundsException {
if (newLength < 0)
- throw new StringIndexOutOfBoundsException(newLength);
+ throw new StringIndexOutOfBoundsException(String.valueOf(newLength));
ensureCapacity(newLength);
len = newLength;
@@ -67,7 +67,7 @@
public synchronized char charAt(int index) throws
IndexOutOfBoundsException {
if (index < 0 || index >= len)
- throw new StringIndexOutOfBoundsException(index);
+ throw new StringIndexOutOfBoundsException(String.valueOf(index));
return str[index];
}
@@ -81,7 +81,7 @@
public synchronized void setCharAt(int index, char ch)
throws IndexOutOfBoundsException {
if (index < 0 || index >= len)
- throw new StringIndexOutOfBoundsException(index);
+ throw new StringIndexOutOfBoundsException(String.valueOf(index));
if (sharing) makeCopy();
str[index] = ch;
@@ -154,7 +154,7 @@
public synchronized StringBuffer insert(int offset, String str)
throws IndexOutOfBoundsException {
if (offset < 0|| offset > len)
- throw new StringIndexOutOfBoundsException(offset);
+ throw new StringIndexOutOfBoundsException(String.valueOf(offset));
if (str == null) str = "null";
ensureCapacity(len + str.length());
@@ -221,7 +221,7 @@
public synchronized StringBuffer delete(int start, int end)
throws StringIndexOutOfBoundsException {
if (start < 0 || end > len || start > end)
- throw new StringIndexOutOfBoundsException(start);
+ throw new StringIndexOutOfBoundsException(String.valueOf(start));
if (end > len) end = len;
len = len - (end-start);
if (sharing) makeCopy();
@@ -232,14 +232,14 @@
public StringBuffer deleteCharAt(int index)
throws StringIndexOutOfBoundsException {
if (index < 0 || index >= len)
- throw new StringIndexOutOfBoundsException(index);
+ throw new StringIndexOutOfBoundsException(String.valueOf(index));
return delete(index, index+1);
}
public synchronized StringBuffer replace(int start, int end, String str)
throws NullPointerException, StringIndexOutOfBoundsException {
if (start < 0 || end > len || start > end)
- throw new StringIndexOutOfBoundsException(start);
+ throw new StringIndexOutOfBoundsException(String.valueOf(start));
delete(start, end);
return insert(start, str);
}
Index: java/net/InetAddress.java
===================================================================
RCS file: /gd/gnu/anoncvsroot/classpath/java/net/InetAddress.java,v
retrieving revision 1.2
diff -u -r1.2 InetAddress.java
--- InetAddress.java 1998/07/24 01:59:39 1.2
+++ InetAddress.java 1998/10/26 19:01:41
@@ -331,18 +331,17 @@
{
int i;
int[] ip = new int[4];
- for (i = 0; i < 4; i++)
+ try
{
- try
+ for (i = 0; i < 4; i++)
{
ip[i] = Integer.parseInt(st.nextToken());
if ((ip[i] < 0) || (ip[1] > 255))
break;
}
- catch (NumberFormatException e)
- {
- break;
- }
+ }
+ catch (NumberFormatException e)
+ {
}
if (i == 4)
{
Index: java/text/Collator.java
===================================================================
RCS file: /gd/gnu/anoncvsroot/classpath/java/text/Collator.java,v
retrieving revision 1.1
diff -u -r1.1 Collator.java
--- Collator.java 1998/09/26 20:00:18 1.1
+++ Collator.java 1998/10/26 19:02:12
@@ -27,6 +27,7 @@
import java.util.Locale;
import java.util.PropertyResourceBundle;
import java.util.ResourceBundle;
+import java.util.MissingResourceException;
/**
* This class is the abstract superclass of classes which perform
Index: java/util/Collections.java
===================================================================
RCS file: /gd/gnu/anoncvsroot/classpath/java/util/Collections.java,v
retrieving revision 1.3
diff -u -r1.3 Collections.java
--- Collections.java 1998/07/27 23:36:34 1.3
+++ Collections.java 1998/10/26 19:02:46
@@ -49,7 +49,7 @@
*/
public static final Comparator REVERSE_ORDER = new Comparator() {
public int compare(Object a, Object b) {
- return -((Comparable)a).compareTo(b);
+ return - ((/*{$cast}*/ Comparable)a).compareTo(b);
}
};
// Personally I'd like a public top-level class ReverseOrder that could
either
Index: java/util/Vector.java
===================================================================
RCS file: /gd/gnu/anoncvsroot/classpath/java/util/Vector.java,v
retrieving revision 1.3
diff -u -r1.3 Vector.java
--- Vector.java 1998/10/05 21:45:56 1.3
+++ Vector.java 1998/10/26 19:03:11
@@ -260,7 +260,7 @@
*/
public int lastIndexOf(Object elem, int index) {
if (index > elementCount - 1)
- throw new ArrayIndexOutOfBoundsException(index);
+ throw new ArrayIndexOutOfBoundsException(String.valueOf(index));
for (int i = index; i>=0; i--) {
if ((elementData[i]==elem) ||
elementData[i].equals(elem)) return i;
@@ -292,7 +292,7 @@
//Within the bounds of this Vector does not necessarily mean within
//the bounds of the internal array
if (index >= elementCount)
- throw new ArrayIndexOutOfBoundsException(index);
+ throw new ArrayIndexOutOfBoundsException(String.valueOf(index));
return elementData[index];
}
@@ -335,7 +335,7 @@
public void setElementAt(Object obj, int index) {
if ((index < 0) ||
(index >= elementCount))
- throw new ArrayIndexOutOfBoundsException(index);
+ throw new ArrayIndexOutOfBoundsException(String.valueOf(index));
modCount++;
elementData[index] = obj;
@@ -352,7 +352,7 @@
*/
public Object set(int index, Object element) {
if (index >= elementCount)
- throw new ArrayIndexOutOfBoundsException(index);
+ throw new ArrayIndexOutOfBoundsException(String.valueOf(index));
modCount++;
Object temp = elementData[index];
@@ -368,7 +368,7 @@
*/
public void removeElementAt(int index) {
if (index >= elementCount)
- throw new ArrayIndexOutOfBoundsException(index);
+ throw new ArrayIndexOutOfBoundsException(String.valueOf(index));
modCount++;
elementCount--;
@@ -390,7 +390,7 @@
public void insertElementAt(Object obj, int index) {
if ((index < 0) ||
(index > elementCount))
- throw new ArrayIndexOutOfBoundsException(index);
+ throw new ArrayIndexOutOfBoundsException(String.valueOf(index));
if (index == elementCount - 1) {
addElement(obj);