various bugfixes

This commit is contained in:
Joel Dice
2007-08-13 18:37:00 -06:00
parent 89609e11c9
commit ab3ca38580
9 changed files with 120 additions and 53 deletions

View File

@ -1,7 +1,7 @@
package java.lang;
public class Object {
protected native Object clone();
protected native Object clone() throws CloneNotSupportedException;
public boolean equals(Object o) {
return this == o;

View File

@ -38,7 +38,10 @@ public class Constructor<T> extends AccessibleObject implements Member {
private static native <T> T make(Class<T> c);
public T newInstance(Object ... arguments) {
public T newInstance(Object ... arguments)
throws InvocationTargetException, InstantiationException,
IllegalAccessException
{
T v = make(method.getDeclaringClass());
method.invoke(v, arguments);
return v;

View File

@ -35,7 +35,8 @@ public class Field<T> extends AccessibleObject {
return Class.forCanonicalName(getName());
}
public native Object get(Object instance);
public native Object get(Object instance) throws IllegalAccessException;
public native void set(Object instance, Object value);
public native void set(Object instance, Object value)
throws IllegalAccessException;
}

View File

@ -87,5 +87,6 @@ public class Method<T> extends AccessibleObject implements Member {
return types;
}
public native Object invoke(Object instance, Object ... arguments);
public native Object invoke(Object instance, Object ... arguments)
throws InvocationTargetException, IllegalAccessException;
}

View File

@ -52,7 +52,7 @@ public class HashMap<K, V> implements Map<K, V> {
Cell<K, V> next;
for (Cell<K, V> c = array[i]; c != null; c = next) {
next = c.next();
int index = c.getKey().hashCode() & (capacity - 1);
int index = c.hashCode() & (capacity - 1);
c.setNext(array[index]);
array[index] = c;
}