Merged gcj-eclipse branch to trunk.
From-SVN: r120621
This commit is contained in:
parent
c648dedbde
commit
97b8365caf
17478 changed files with 606493 additions and 100744 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue