[cp-patches] [RFA/JDWP] IdManager

Archie Cobbs archie@dellroad.org
Tue Jun 21 19:20:00 GMT 2005


Keith Seitz wrote:
>>>"Uniquely identifies a reference type in the target VM. It should not be
>>>assumed that for a particular class, the classObjectID and the
>>>referenceTypeID are the same. A particular reference type will be
>>>identified by exactly one ID in JDWP commands and replies throughout its
>>>lifetime A referenceTypeID is not reused to identify a different
>>>reference type, regardless of whether the referenced class has been
>>>unloaded."
>>
>>This seems to only imply that whoever is creating ReferenceTypeID's
>>must create a new and unique one every time, not that you need to
>>cache them after the associated class has been unloaded... ?
> 
> So if a class is unloaded and then consequently reloaded, you read the
> above to mean that it would still get a new ID (not the old one)?

A class that is unloaded and then reloaded is a different class :-)

> I guess our interpretation of "lifetime" is a little different. For me,
> lifetime was considered the lifetime of the type within the application.
> For you, it's the lifetime of the class as it exists in the VM. So when
> it is unloaded, it's ID goes stale.

You're definition of "type" then is the static (compile time type).
But in Java Class objects are associated with runtime types,
not compile time types. I've been confused about this before and
went so far as to document it so I wouldn't get confused again:

   http://jcvm.sourceforge.net/share/jc/doc/jc.html#Classes%20and%20Types

Cheers,
-Archie

__________________________________________________________________________
Archie Cobbs      *        CTO, Awarix        *      http://www.awarix.com



More information about the Java-patches mailing list