edu.mit.ai.psg.jeva
Class InterpretedClass

java.lang.Object
  |
  +--edu.mit.ai.psg.jeva.InterpretedMember
        |
        +--edu.mit.ai.psg.jeva.InterpretedClass

public class InterpretedClass
extends InterpretedMember
implements IClass

InterpretedClass provides IClass methods for interpreted classes.

Does not implement array classes. Does not implement Security or Access checks on callers.

See Also:
Class

Field Summary
static IClass[] emptyArray
           
 
Constructor Summary
InterpretedClass(int modifiers, String name, IClass extendClass, IClass[] interfaces, InterpretedField[] fields, InterpretedConstructor[] constructors, InterpretedMethod[] methods, InterpretedClass[] enclosedClasses, IEnv env, JNDClassDeclaration source)
           
InterpretedClass(int modifiers, String fullName, JNDClassDeclaration classDeclaration, IEnv env)
           
 
Method Summary
 void ensureActivated()
          [Java Language Specification 1.0, sec 12.4 Initialization of Classes and Interfaces] "A class or interface type T will be *initialized* at its first active use*...".
 void evalConstructorBody(Class[] proxyConstrParamTypes, Object target, Object[] constrArguments)
          Called by constructors in generated proxy classes to evaluate the body of the constructor after the explicit constructor invocation
 Object evalExplicitConstructorCallParameter(int paramIndex, Class[] proxyConstrParamTypes, Object[] constrArguments)
          Called by constructors in generated proxy classes to evaluate each argument of its ExplicitConstructorInvocation.
 void evalObjectInitializations(Object obj)
          Called by constructors in generated proxy classes to evaluate the class's field and object initializers
 IClass[] getClasses()
          get all public nested classes of class and superclasses
 ClassLoader getClassLoader()
           
 IClass getComponentType()
           
 IConstructor getConstructor(IClass[] parameterTypes)
          return public constructor with exactly these parameter types
 IConstructor[] getConstructors()
          get all public constructors of this class (not superclass)
 JNDClassDeclaration getDeclarationNode()
           
 IClass[] getDeclaredClasses()
          get all enclosed classes declared locally by this class
 IConstructor getDeclaredConstructor(IClass[] parameterTypes)
          get constructor with exact parameter types declared locally by class
 IConstructor[] getDeclaredConstructors()
          get all constructors declared locally by this class
 IField getDeclaredField(String name)
          get field with this name declared locally by this class
 IField[] getDeclaredFields()
          get all fields declared locally by this class
 IMethod getDeclaredMethod(String name, IClass[] parameterTypes)
          get method with name & exact parameter types declared locally by class
 IMethod[] getDeclaredMethods()
          get all methods declared locally by this class
 IEnv getEnv()
           
 IField getField(String name)
          return public field with this name
 IField[] getFields()
          get all public fields of class, including those inherited (and not hidden) from its superclass, & their interfaces
 IClass[] getInterfaces()
           
 IMethod getMethod(String name, IClass[] parameterTypes)
          return public method with this name and exactly these parameter types
 IMethod[] getMethods()
          get all public methods of class, including those inherited (and not overridden) from its superclass
protected  Class getProxyClass()
           
 URL getResource(String name)
          not implemented
 InputStream getResourceAsStream(String name)
          not implemented
 Object[] getSigners()
           
 IClass getSuperclass()
           
protected  boolean hasProxyClass()
           
 void initializeConstructors(InterpretedConstructor[] constructors)
           
 void initializeEnv(IEnv env)
           
 void initializeFields(InterpretedField[] fields)
           
 void initializeInterfaces(IClass[] interfaces)
           
 void initializeMethods(InterpretedMethod[] methods)
           
 void initializeNestedClasses(InterpretedClass[] classes)
           
 void initializeSuperclass(IClass superClass)
          throws IllegalStateException if already initialized.
 Object invokeMethod(String methodName, Class[] parameterTypes, Object target, Object[] parameters)
          Called by methods in generated proxy classes to evaluate interpreted method declared by this class.
 boolean isArray()
           
 boolean isAssignableFrom(IClass from)
           
 boolean isInstance(Object obj)
           
 boolean isInterface()
           
 boolean isPrimitive()
           
 Object newInstance()
           
 String toString()
           
 IEnv verifyTypes(IEnv env)
           
 
Methods inherited from class edu.mit.ai.psg.jeva.InterpretedMember
getDeclaringClass, getModifiers, getName, initializeDeclaringClass, isAccessible, modifiersString, setAccessible, shouldNotHappen, shouldNotHappen, shouldNotHappen, typeListString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

emptyArray

public static final IClass[] emptyArray
Constructor Detail

InterpretedClass

public InterpretedClass(int modifiers,
                        String name,
                        IClass extendClass,
                        IClass[] interfaces,
                        InterpretedField[] fields,
                        InterpretedConstructor[] constructors,
                        InterpretedMethod[] methods,
                        InterpretedClass[] enclosedClasses,
                        IEnv env,
                        JNDClassDeclaration source)

InterpretedClass

public InterpretedClass(int modifiers,
                        String fullName,
                        JNDClassDeclaration classDeclaration,
                        IEnv env)
Method Detail

verifyTypes

public IEnv verifyTypes(IEnv env)
                 throws VerifyingException

initializeSuperclass

public void initializeSuperclass(IClass superClass)
throws IllegalStateException if already initialized.

initializeInterfaces

public void initializeInterfaces(IClass[] interfaces)

initializeFields

public void initializeFields(InterpretedField[] fields)

initializeConstructors

public void initializeConstructors(InterpretedConstructor[] constructors)

initializeMethods

public void initializeMethods(InterpretedMethod[] methods)

initializeNestedClasses

public void initializeNestedClasses(InterpretedClass[] classes)

initializeEnv

public void initializeEnv(IEnv env)

getEnv

public IEnv getEnv()

getDeclarationNode

public JNDClassDeclaration getDeclarationNode()

ensureActivated

public void ensureActivated()
[Java Language Specification 1.0, sec 12.4 Initialization of Classes and Interfaces] "A class or interface type T will be *initialized* at its first active use*...". Ensure class is activated when We call this ensureActivated rather than initialize since it occurs when the class becomes active for runtime use; it may be initialized for use during type checking long before it becomes active, or without ever being actively used at runtime.

hasProxyClass

protected boolean hasProxyClass()

getProxyClass

protected Class getProxyClass()

invokeMethod

public Object invokeMethod(String methodName,
                           Class[] parameterTypes,
                           Object target,
                           Object[] parameters)
                    throws InvocationTargetException
Called by methods in generated proxy classes to evaluate interpreted method declared by this class. Does not invoke overriding method.

evalExplicitConstructorCallParameter

public Object evalExplicitConstructorCallParameter(int paramIndex,
                                                   Class[] proxyConstrParamTypes,
                                                   Object[] constrArguments)
                                            throws ThrowException
Called by constructors in generated proxy classes to evaluate each argument of its ExplicitConstructorInvocation. (This is necessary since the explicit constructor call itself must be made by the constructor, and cannot be delegated to the interpreter.)
Parameters:
paramIndex - which argument of the constructor's explicit constructor invocation to evaluate.
constrParamTypes - are the parameter types identifying which constructor's explicit constructor invocation.
constrArguments - are the parameter values to this constructor.

evalObjectInitializations

public void evalObjectInitializations(Object obj)
                               throws ThrowException
Called by constructors in generated proxy classes to evaluate the class's field and object initializers

evalConstructorBody

public void evalConstructorBody(Class[] proxyConstrParamTypes,
                                Object target,
                                Object[] constrArguments)
                         throws ThrowException
Called by constructors in generated proxy classes to evaluate the body of the constructor after the explicit constructor invocation
Parameters:
constrParamTypes - the parameter types identifying from which constructor's the explicit constructor invocation argument expressions are to be taken.
constrArguments - the parameter values to this constructor.

newInstance

public Object newInstance()
                   throws InstantiationException,
                          IllegalAccessException
Specified by:
newInstance in interface IClass

isInstance

public boolean isInstance(Object obj)
Specified by:
isInstance in interface IClass

isAssignableFrom

public boolean isAssignableFrom(IClass from)
Specified by:
isAssignableFrom in interface IClass

isInterface

public boolean isInterface()
Specified by:
isInterface in interface IClass

isArray

public boolean isArray()
Specified by:
isArray in interface IClass

isPrimitive

public boolean isPrimitive()
Specified by:
isPrimitive in interface IClass

getClassLoader

public ClassLoader getClassLoader()
Specified by:
getClassLoader in interface IClass

getSuperclass

public IClass getSuperclass()
Specified by:
getSuperclass in interface IClass

getInterfaces

public IClass[] getInterfaces()
Specified by:
getInterfaces in interface IClass

getComponentType

public IClass getComponentType()
Specified by:
getComponentType in interface IClass

getSigners

public Object[] getSigners()
Specified by:
getSigners in interface IClass

getClasses

public IClass[] getClasses()
get all public nested classes of class and superclasses
Specified by:
getClasses in interface IClass

getFields

public IField[] getFields()
                   throws SecurityException
get all public fields of class, including those inherited (and not hidden) from its superclass, & their interfaces
Specified by:
getFields in interface IClass

getMethods

public IMethod[] getMethods()
                     throws SecurityException
get all public methods of class, including those inherited (and not overridden) from its superclass
Specified by:
getMethods in interface IClass

getConstructors

public IConstructor[] getConstructors()
                               throws SecurityException
get all public constructors of this class (not superclass)
Specified by:
getConstructors in interface IClass

getField

public IField getField(String name)
                throws NoSuchFieldException,
                       SecurityException
return public field with this name
Specified by:
getField in interface IClass

getMethod

public IMethod getMethod(String name,
                         IClass[] parameterTypes)
                  throws NoSuchMethodException,
                         SecurityException
return public method with this name and exactly these parameter types
Specified by:
getMethod in interface IClass

getConstructor

public IConstructor getConstructor(IClass[] parameterTypes)
                            throws NoSuchMethodException,
                                   SecurityException
return public constructor with exactly these parameter types
Specified by:
getConstructor in interface IClass

getDeclaredClasses

public IClass[] getDeclaredClasses()
                            throws SecurityException
get all enclosed classes declared locally by this class
Specified by:
getDeclaredClasses in interface IClass

getDeclaredFields

public IField[] getDeclaredFields()
                           throws SecurityException
get all fields declared locally by this class
Specified by:
getDeclaredFields in interface IClass

getDeclaredMethods

public IMethod[] getDeclaredMethods()
                             throws SecurityException
get all methods declared locally by this class
Specified by:
getDeclaredMethods in interface IClass

getDeclaredConstructors

public IConstructor[] getDeclaredConstructors()
                                       throws SecurityException
get all constructors declared locally by this class
Specified by:
getDeclaredConstructors in interface IClass

getDeclaredField

public IField getDeclaredField(String name)
                        throws NoSuchFieldException,
                               SecurityException
get field with this name declared locally by this class
Specified by:
getDeclaredField in interface IClass

getDeclaredMethod

public IMethod getDeclaredMethod(String name,
                                 IClass[] parameterTypes)
                          throws NoSuchMethodException,
                                 SecurityException
get method with name & exact parameter types declared locally by class
Specified by:
getDeclaredMethod in interface IClass

getDeclaredConstructor

public IConstructor getDeclaredConstructor(IClass[] parameterTypes)
                                    throws NoSuchMethodException,
                                           SecurityException
get constructor with exact parameter types declared locally by class
Specified by:
getDeclaredConstructor in interface IClass

getResourceAsStream

public InputStream getResourceAsStream(String name)
not implemented
Specified by:
getResourceAsStream in interface IClass

getResource

public URL getResource(String name)
not implemented
Specified by:
getResource in interface IClass

toString

public String toString()
Overrides:
toString in class Object

Copyright (c) 1996-1999
Massachusetts Institute of Technology

Feedback: jeva-feedback@ai.mit.edu