summaryrefslogtreecommitdiffstats
path: root/libjava/classpath/vm/reference/gnu/classpath/jdwp/VMIdManager.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/classpath/vm/reference/gnu/classpath/jdwp/VMIdManager.java')
-rw-r--r--libjava/classpath/vm/reference/gnu/classpath/jdwp/VMIdManager.java156
1 files changed, 78 insertions, 78 deletions
diff --git a/libjava/classpath/vm/reference/gnu/classpath/jdwp/VMIdManager.java b/libjava/classpath/vm/reference/gnu/classpath/jdwp/VMIdManager.java
index 9360e764dfb..ac3e05a7c27 100644
--- a/libjava/classpath/vm/reference/gnu/classpath/jdwp/VMIdManager.java
+++ b/libjava/classpath/vm/reference/gnu/classpath/jdwp/VMIdManager.java
@@ -119,49 +119,49 @@ public class VMIdManager
// Special case: arrays
if (object.getClass ().isArray ())
- id = new ArrayId ();
+ id = new ArrayId ();
else
- {
- // Loop through all classes until we hit baseclass
- Class myClass;
- for (myClass = object.getClass (); myClass != null;
- myClass = myClass.getSuperclass ())
- {
- Class clz = (Class) _idList.get (myClass);
- if (clz != null)
- {
- try
- {
- id = (ObjectId) clz.newInstance ();
- synchronized (_idLock)
- {
- id.setId (++_lastId);
- }
- id.setReference (obj);
- return id;
- }
- catch (InstantiationException ie)
- {
- // This really should not happen
- throw new RuntimeException ("cannot create new ID", ie);
- }
- catch (IllegalAccessException iae)
- {
- // This really should not happen
- throw new RuntimeException ("illegal access of ID", iae);
- }
- }
- }
-
- /* getSuperclass returned null and no matching ID type found.
- So it must derive from Object. */
- id = new ObjectId ();
- }
+ {
+ // Loop through all classes until we hit baseclass
+ Class myClass;
+ for (myClass = object.getClass (); myClass != null;
+ myClass = myClass.getSuperclass ())
+ {
+ Class clz = (Class) _idList.get (myClass);
+ if (clz != null)
+ {
+ try
+ {
+ id = (ObjectId) clz.newInstance ();
+ synchronized (_idLock)
+ {
+ id.setId (++_lastId);
+ }
+ id.setReference (obj);
+ return id;
+ }
+ catch (InstantiationException ie)
+ {
+ // This really should not happen
+ throw new RuntimeException ("cannot create new ID", ie);
+ }
+ catch (IllegalAccessException iae)
+ {
+ // This really should not happen
+ throw new RuntimeException ("illegal access of ID", iae);
+ }
+ }
+ }
+
+ /* getSuperclass returned null and no matching ID type found.
+ So it must derive from Object. */
+ id = new ObjectId ();
+ }
synchronized (_idLock)
- {
- id.setId (++_lastId);
- }
+ {
+ id.setId (++_lastId);
+ }
id.setReference (obj);
return id;
}
@@ -178,19 +178,19 @@ public class VMIdManager
ReferenceTypeId id;
Class clazz = (Class) ref.get ();
if (clazz == null)
- return null;
+ return null;
if (clazz.isArray ())
- id = new ArrayReferenceTypeId ();
+ id = new ArrayReferenceTypeId ();
else if (clazz.isInterface ())
- id = new InterfaceReferenceTypeId ();
+ id = new InterfaceReferenceTypeId ();
else
- id = new ClassReferenceTypeId ();
+ id = new ClassReferenceTypeId ();
id.setReference (ref);
synchronized (_ridLock)
- {
- id.setId (++_lastRid);
- }
+ {
+ id.setId (++_lastRid);
+ }
return id;
}
}
@@ -218,7 +218,7 @@ public class VMIdManager
super (referent);
_hash = referent.hashCode ();
}
-
+
/**
* Constructs a new <code>ReferenceKey</code> object
* with the given referent and reference queue.
@@ -235,7 +235,7 @@ public class VMIdManager
super (referent, queue);
_hash = referent.hashCode ();
}
-
+
/**
* Returns the hash code of the referent.
* This seems hacky, but is required in order to use this class
@@ -262,21 +262,21 @@ public class VMIdManager
public boolean equals (Object obj)
{
if (obj instanceof ReferenceKey)
- {
- ReferenceKey ref = (ReferenceKey) obj;
-
- /* First check if the two references are the same.
- If they are, that means we must be clearing GCd objects. */
- if (this == obj)
- return true;
-
- return (ref.get () == get ());
- }
-
+ {
+ ReferenceKey ref = (ReferenceKey) obj;
+
+ /* First check if the two references are the same.
+ If they are, that means we must be clearing GCd objects. */
+ if (this == obj)
+ return true;
+
+ return (ref.get () == get ());
+ }
+
return false;
}
}
-
+
// instance of VMIdManager
private static VMIdManager _idm = new VMIdManager ();
@@ -322,9 +322,9 @@ public class VMIdManager
Reference ref;
while ((ref = _refQueue.poll ()) != null)
{
- ObjectId id = (ObjectId) _oidTable.get (ref);
- _oidTable.remove (ref);
- _idTable.remove (new Long (id.getId ()));
+ ObjectId id = (ObjectId) _oidTable.get (ref);
+ _oidTable.remove (ref);
+ _idTable.remove (new Long (id.getId ()));
}
}
@@ -340,18 +340,18 @@ public class VMIdManager
// Special case: null
if (theObject == null)
return new NullObjectId ();
-
+
ReferenceKey ref = new ReferenceKey (theObject, _refQueue);
ObjectId id = (ObjectId) _oidTable.get (ref);
if (id == null)
{
- // update the tables -- this is an arbitrary place to put this
- _update ();
+ // update the tables -- this is an arbitrary place to put this
+ _update ();
- // Object not found. Make new id for it
- id = IdFactory.newObjectId (ref);
- _oidTable.put (ref, id);
- _idTable.put (new Long (id.getId ()), id);
+ // Object not found. Make new id for it
+ id = IdFactory.newObjectId (ref);
+ _oidTable.put (ref, id);
+ _idTable.put (new Long (id.getId ()), id);
}
return id;
@@ -371,11 +371,11 @@ public class VMIdManager
// Special case: null
if (id == 0)
return new NullObjectId ();
-
+
ObjectId oid = (ObjectId) _idTable.get (new Long (id));
if (oid == null)
throw new InvalidObjectException (id);
-
+
return oid;
}
@@ -399,10 +399,10 @@ public class VMIdManager
ReferenceTypeId id = (ReferenceTypeId)_classTable.get (ref);
if (id == null)
{
- // Object not found. Make new id for it
- id = IdFactory.newReferenceTypeId (ref);
- _classTable.put (ref, id);
- _ridTable.put (new Long (id.getId ()), id);
+ // Object not found. Make new id for it
+ id = IdFactory.newReferenceTypeId (ref);
+ _classTable.put (ref, id);
+ _ridTable.put (new Long (id.getId ()), id);
}
return id;
@@ -422,7 +422,7 @@ public class VMIdManager
ReferenceTypeId rid = (ReferenceTypeId) _ridTable.get (new Long (id));
if (rid == null)
throw new InvalidClassException (id);
-
+
return rid;
}
OpenPOWER on IntegriCloud