diff options
author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-01-09 19:58:05 +0000 |
---|---|---|
committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-01-09 19:58:05 +0000 |
commit | 65bf3316cf384588453604be6b4f0ed3751a8b0f (patch) | |
tree | 996a5f57d4a68c53473382e45cb22f574cb3e4db /libjava/classpath/java/io/ObjectStreamField.java | |
parent | 8fc56618a84446beccd45b80381cdfe0e94050df (diff) | |
download | ppe42-gcc-65bf3316cf384588453604be6b4f0ed3751a8b0f.tar.gz ppe42-gcc-65bf3316cf384588453604be6b4f0ed3751a8b0f.zip |
Merged gcj-eclipse branch to trunk.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@120621 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/java/io/ObjectStreamField.java')
-rw-r--r-- | libjava/classpath/java/io/ObjectStreamField.java | 47 |
1 files changed, 18 insertions, 29 deletions
diff --git a/libjava/classpath/java/io/ObjectStreamField.java b/libjava/classpath/java/io/ObjectStreamField.java index 61ccdc7db76..91f557870a5 100644 --- a/libjava/classpath/java/io/ObjectStreamField.java +++ b/libjava/classpath/java/io/ObjectStreamField.java @@ -1,5 +1,5 @@ /* ObjectStreamField.java -- Class used to store name and class of fields - Copyright (C) 1998, 1999, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -48,17 +48,24 @@ import java.security.PrivilegedAction; * This class intends to describe the field of a class for the serialization * subsystem. Serializable fields in a serializable class can be explicitly * exported using an array of ObjectStreamFields. + * + * @author Tom Tromey (tromey@redhat.com) + * @author Jeroen Frijters (jeroen@frijters.net) + * @author Guilhem Lavaux (guilhem@kaffe.org) + * @author Michael Koch (konqueror@gmx.de) + * @author Andrew John Hughes (gnu_andrew@member.fsf.org) */ -public class ObjectStreamField implements Comparable +public class ObjectStreamField + implements Comparable<Object> { private String name; - private Class type; + private Class<?> type; private String typename; private int offset = -1; // XXX make sure this is correct private boolean unshared; private boolean persistent = false; private boolean toset = true; - private Field field; + Field field; ObjectStreamField (Field field) { @@ -74,7 +81,7 @@ public class ObjectStreamField implements Comparable * @param name Name of the field to export. * @param type Type of the field in the concerned class. */ - public ObjectStreamField (String name, Class type) + public ObjectStreamField (String name, Class<?> type) { this (name, type, false); } @@ -88,7 +95,7 @@ public class ObjectStreamField implements Comparable * @param type Type of the field in the concerned class. * @param unshared true if field will be unshared, false otherwise. */ - public ObjectStreamField (String name, Class type, boolean unshared) + public ObjectStreamField (String name, Class<?> type, boolean unshared) { if (name == null) throw new NullPointerException(); @@ -111,28 +118,10 @@ public class ObjectStreamField implements Comparable { this.name = name; this.typename = typename; - try - { - type = TypeSignature.getClassForEncoding(typename); - } - catch(ClassNotFoundException e) - { - } } - - /** - * There are many cases you can not get java.lang.Class from typename - * if your context class loader cann not load it, then use typename to - * construct the field. - * - * @param name Name of the field to export. - * @param typename The coded name of the type for this field. - * @param loader The class loader to use to resolve class names. - */ - ObjectStreamField (String name, String typename, ClassLoader loader) + + void resolveType(ClassLoader loader) { - this.name = name; - this.typename = typename; try { type = TypeSignature.getClassForEncoding(typename, true, loader); @@ -141,7 +130,7 @@ public class ObjectStreamField implements Comparable { } } - + /** * This method returns the name of the field represented by the * ObjectStreamField instance. @@ -159,7 +148,7 @@ public class ObjectStreamField implements Comparable * * @return A class representing the type of the field. */ - public Class getType () + public Class<?> getType () { return type; } @@ -347,7 +336,7 @@ public class ObjectStreamField implements Comparable */ void checkFieldType() throws InvalidClassException { - Class ftype = field.getType(); + Class<?> ftype = field.getType(); if (!ftype.isAssignableFrom(type)) throw new InvalidClassException |