This commit is contained in:
Joel Dice 2007-08-13 19:44:47 -06:00
parent ab3ca38580
commit d0e519d992
6 changed files with 28 additions and 21 deletions

View File

@ -204,7 +204,11 @@ public class ObjectInputStream extends InputStream {
for (Field f: c.getFields()) { for (Field f: c.getFields()) {
int modifiers = f.getModifiers(); int modifiers = f.getModifiers();
if ((modifiers & (Modifier.TRANSIENT | Modifier.STATIC)) == 0) { if ((modifiers & (Modifier.TRANSIENT | Modifier.STATIC)) == 0) {
try {
f.set(o, deserialize(map)); f.set(o, deserialize(map));
} catch (Exception e) {
throw new RuntimeException(e);
}
} }
} }

View File

@ -155,7 +155,14 @@ public class ObjectOutputStream extends OutputStream {
int modifiers = f.getModifiers(); int modifiers = f.getModifiers();
if ((modifiers & (Modifier.TRANSIENT | Modifier.STATIC)) == 0) { if ((modifiers & (Modifier.TRANSIENT | Modifier.STATIC)) == 0) {
out.print(" "); out.print(" ");
Object v = f.get(o); Object v;
try {
v = f.get(o);
} catch (Exception e) {
throw new RuntimeException(e);
}
Class t = f.getType(); Class t = f.getType();
if (t.equals(boolean.class)) { if (t.equals(boolean.class)) {
writeBoolean((Boolean) v); writeBoolean((Boolean) v);

View File

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

View File

@ -127,8 +127,7 @@ public class LinkedList<T> implements List<T> {
public T removeFirst() { public T removeFirst() {
if (front != null) { if (front != null) {
T v = front.value; T v = front.value;
front = front.next; remove(front);
if (front != null) front.prev = null;
return v; return v;
} else { } else {
throw new NoSuchElementException(); throw new NoSuchElementException();
@ -138,8 +137,7 @@ public class LinkedList<T> implements List<T> {
public T removeLast() { public T removeLast() {
if (rear != null) { if (rear != null) {
T v = rear.value; T v = rear.value;
rear = rear.prev; remove(rear);
if (rear != null) rear.next = null;
return v; return v;
} else { } else {
throw new NoSuchElementException(); throw new NoSuchElementException();

View File

@ -627,17 +627,17 @@ Throwable_trace(Thread* t, jclass, jint skipCount)
frame = frameNext(t, frame); frame = frameNext(t, frame);
} }
if (methodClass(t, frameMethod(t, frame))
== arrayBody(t, t->vm->types, Machine::ThrowableType))
{
// skip Throwable constructors // skip Throwable constructors
while (strcmp(reinterpret_cast<const int8_t*>("<init>"), while (frame >= 0
and isAssignableFrom
(t, arrayBody(t, t->vm->types, Machine::ThrowableType),
methodClass(t, frameMethod(t, frame)))
and strcmp(reinterpret_cast<const int8_t*>("<init>"),
&byteArrayBody(t, methodName(t, frameMethod(t, frame)), 0)) &byteArrayBody(t, methodName(t, frameMethod(t, frame)), 0))
== 0) == 0)
{ {
frame = frameNext(t, frame); frame = frameNext(t, frame);
} }
}
return pushReference(t, makeTrace(t, frame)); return pushReference(t, makeTrace(t, frame));
} }

View File

@ -271,8 +271,7 @@ postVisit(Thread* t, Heap::Visitor* v)
if (m->heap->status(*p) == Heap::Unreachable) { if (m->heap->status(*p) == Heap::Unreachable) {
// reference is unreachable // reference is unreachable
referenceUnreachable(t, p, v); referenceUnreachable(t, p, v);
} else if (jreferenceTarget(t, *p) == 0 } else if (m->heap->status(jreferenceTarget(t, *p))
or m->heap->status(jreferenceTarget(t, *p))
== Heap::Unreachable) == Heap::Unreachable)
{ {
// target is unreachable // target is unreachable
@ -318,8 +317,7 @@ postVisit(Thread* t, Heap::Visitor* v)
if (m->heap->status(*p) == Heap::Unreachable) { if (m->heap->status(*p) == Heap::Unreachable) {
// reference is unreachable // reference is unreachable
referenceUnreachable(t, p, v); referenceUnreachable(t, p, v);
} else if (jreferenceTarget(t, *p) == 0 } else if (m->heap->status(jreferenceTarget(t, *p))
or m->heap->status(jreferenceTarget(t, *p))
== Heap::Unreachable) == Heap::Unreachable)
{ {
// target is unreachable // target is unreachable