com.jrockit.memleak.util
Class DummyClassInfo

java.lang.Object
  extended by com.jrockit.memleak.util.DummyClassInfo
All Implemented Interfaces:
IAccessibleInfo, IClassInfo, IClassRef, INamedType, ITypeSpecifier, IDummy

public class DummyClassInfo
extends java.lang.Object
implements IClassInfo, IDummy

Dummy implementation of IClassInfo.

Author:
mpersson

Field Summary
 
Fields inherited from interface com.jrockit.memleak.IClassInfo
ANNOTATION, CLASS_TYPE_NAME, EMPTY_ARRAY, ENUM
 
Fields inherited from interface com.jrockit.memleak.IAccessibleInfo
SYNTHETIC, UNKNOWN_MODIFIERS
 
Constructor Summary
DummyClassInfo(java.lang.String name, IObjectInfo classLoader)
           
 
Method Summary
static DummyClassInfo createNested(java.lang.String name, int depth)
          Create a dummy IClassInfo with a dummy IObjectInfo as class loader, both with the display name name.
 int getClassId()
           
 IObjectInfo getClassLoaderInfo(Policy policy)
          Get the class loader of this class, or null if it is the boot class loader.
 IObjectSpecifier getClassLoaderSpec()
          Get the class loader of this class, or null if it is the boot class loader.
 IObjectInfo getClassObjectInfo(Policy policy)
          For implementations with Feature.CLASS_IDS_ARE_OBJECT_IDS this should never return null (when called with a blocking policy).
 IObjectSpecifier getClassObjectSpec()
          For implementations with Feature.CLASS_IDS_ARE_OBJECT_IDS this should never return null.
 int getModifiers()
           
 java.lang.String getName()
          Returns the name of the entity (class, interface, array class, primitive type, or void) represented by this IClassInfo object.
 int getNumDeclaredStaticFields()
           
 int getNumInstanceFields()
           
 java.lang.String getSourceFileName()
          Returns the name of the source file for this class.
 boolean isArrayClass()
           
 boolean isDiscarded()
           
<T> T
select(ITypeResolver<T> resolver)
          Select the type or types using operations on resolver.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DummyClassInfo

public DummyClassInfo(java.lang.String name,
                      IObjectInfo classLoader)
Parameters:
name -
classLoader -
Method Detail

createNested

public static final DummyClassInfo createNested(java.lang.String name,
                                                int depth)
Create a dummy IClassInfo with a dummy IObjectInfo as class loader, both with the display name name. The class loader will also have a class, which will have a class loader and so forth, until depth dummy instances have been created.

Note that a similar effect could be produced by circular references, but it isn't recommended since that wouldn't be possible in a real JVM. Also someone might attempt to navigate this structure until the bootstrap class loader, normally designated by null, is found. (Although that type of navigation should stop once it sees anything implementing IDummy.)

Parameters:
name - the display name to use for classes and class loaders
depth - the total number of dummy instances to create
Returns:
a IClassInfo or null if depth is zero.

getClassLoaderSpec

public IObjectSpecifier getClassLoaderSpec()
Description copied from interface: IClassInfo
Get the class loader of this class, or null if it is the boot class loader. Implementations without Feature.CLASS_LOADERS may also return null.

Specified by:
getClassLoaderSpec in interface IClassInfo
Returns:
Returns the IObjectSpecifier of the class loader that loaded this class.

getClassLoaderInfo

public IObjectInfo getClassLoaderInfo(Policy policy)
Description copied from interface: IClassInfo
Get the class loader of this class, or null if it is the boot class loader. Null may also be returned if the value is not yet available, according to policy. Finally, implementations without Feature.CLASS_LOADERS may also return null.

Specified by:
getClassLoaderInfo in interface IClassInfo
Returns:
Returns the IObjectInfo of the class loader that loaded this class, or null.

getClassObjectSpec

public IObjectSpecifier getClassObjectSpec()
Description copied from interface: IClassInfo
For implementations with Feature.CLASS_IDS_ARE_OBJECT_IDS this should never return null. Other implementations might.

Specified by:
getClassObjectSpec in interface IClassInfo
Returns:
Returns the IObjectSpecifier of the Class instance that corresponds to this class, or null.

getClassObjectInfo

public IObjectInfo getClassObjectInfo(Policy policy)
Description copied from interface: IClassInfo
For implementations with Feature.CLASS_IDS_ARE_OBJECT_IDS this should never return null (when called with a blocking policy). Other implementations might.

Specified by:
getClassObjectInfo in interface IClassInfo
Returns:
Returns the IObjectInfo of the Class instance that corresponds to this class, or null.

getModifiers

public int getModifiers()
Specified by:
getModifiers in interface IAccessibleInfo
Returns:
access modifiers for the entity
See Also:
Modifier

getName

public java.lang.String getName()
Description copied from interface: IClassInfo
Returns the name of the entity (class, interface, array class, primitive type, or void) represented by this IClassInfo object.

Specified by:
getName in interface IClassInfo
Specified by:
getName in interface INamedType
Returns:
the name of the class represented by this IClassInfo object.
See Also:
Class.getName()

getNumDeclaredStaticFields

public int getNumDeclaredStaticFields()
Specified by:
getNumDeclaredStaticFields in interface IClassInfo
Returns:
the number of declared static fields in this class.

getNumInstanceFields

public int getNumInstanceFields()
Specified by:
getNumInstanceFields in interface IClassInfo
Returns:
the number of instance fields, including all inherited instance fields from super classes.

getSourceFileName

public java.lang.String getSourceFileName()
Description copied from interface: IClassInfo
Returns the name of the source file for this class. Generally, this corresponds to the SourceFile attribute of the relevant class file (as per The Java Virtual Machine Specification, Section 4.7.7).

Specified by:
getSourceFileName in interface IClassInfo
Returns:
the name of the source file, or null if this information is unavailable.

isArrayClass

public boolean isArrayClass()
Specified by:
isArrayClass in interface IClassInfo
Returns:
true of this is an array class, false otherwise.

getClassId

public int getClassId()
Specified by:
getClassId in interface IClassRef
Returns:
Returns the class ID.

isDiscarded

public boolean isDiscarded()
Specified by:
isDiscarded in interface IClassInfo
Returns:
true iff the class is known to have been garbage collected.

select

public <T> T select(ITypeResolver<T> resolver)
Description copied from interface: ITypeSpecifier
Select the type or types using operations on resolver.

NOTE: It is strictly forbidden to keep a reference to the given resolver (including weak references etc.) as well as any type of caching based on values returned from the resolver. Only the resolver itself is capable of determining if results may be cached.

Specified by:
select in interface ITypeSpecifier
Returns:
a resolved type


Copyright © 1999, 2011, Oracle and/or its affiliates. All rights reserved.