Package org.codehaus.janino
Class ClassFileIClass
- java.lang.Object
-
- org.codehaus.janino.IClass
-
- org.codehaus.janino.ClassFileIClass
-
public class ClassFileIClass extends IClass
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.codehaus.janino.IClass
IClass.IAnnotation, IClass.IConstructor, IClass.IField, IClass.IInvocable, IClass.IMember, IClass.IMethod
-
-
Field Summary
Fields Modifier and Type Field Description private short
accessFlags
private ClassFile
classFile
private IClassLoader
iClassLoader
private static java.util.logging.Logger
LOGGER
private java.util.Map<java.lang.String,IClass>
resolvedClasses
private java.util.Map<ClassFile.FieldInfo,IClass.IField>
resolvedFields
private java.util.Map<ClassFile.MethodInfo,IClass.IInvocable>
resolvedMethods
-
Constructor Summary
Constructors Constructor Description ClassFileIClass(ClassFile classFile, IClassLoader iClassLoader)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static Access
accessFlags2Access(short accessFlags)
Access
getAccess()
protected IClass
getComponentType2()
protected IClass[]
getDeclaredIClasses2()
protected IClass.IConstructor[]
getDeclaredIConstructors2()
The uncached version ofIClass.getDeclaredIConstructors()
which must be implemented by derived classes.protected IClass.IField[]
getDeclaredIFields2()
Uncached version ofIClass.getDeclaredIFields()
.protected IClass.IMethod[]
getDeclaredIMethods2()
The uncached version ofIClass.getDeclaredIMethods()
which must be implemented by derived classes.protected IClass
getDeclaringIClass2()
protected java.lang.String
getDescriptor2()
protected IClass.IAnnotation[]
getIAnnotations2()
protected IClass[]
getInterfaces2()
protected IClass
getOuterIClass2()
protected IClass
getSuperclass2()
boolean
isAbstract()
Whether the class may be instantiated (JVMS 4.1 access_flags).boolean
isArray()
boolean
isEnum()
boolean
isFinal()
Whether subclassing is allowed (JVMS 4.1 access_flags)boolean
isInterface()
boolean
isPrimitive()
boolean
isPrimitiveNumeric()
void
resolveAllClasses()
Resolves all classes referenced by this class file.private IClass
resolveClass(short index)
private IClass
resolveClass(java.lang.String descriptor)
private IClass[]
resolveClasses(short[] ifs)
private IClass.IField
resolveField(ClassFile.FieldInfo fieldInfo)
private IClass.IInvocable
resolveMethod(ClassFile.MethodInfo methodInfo)
Turns aClassFile.MethodInfo
into anIClass.IInvocable
.private IClass.IAnnotation
toIAnnotation(ClassFile.Annotation annotation)
private IClass.IAnnotation[]
toIAnnotations(ClassFile.Annotation[] annotations)
-
Methods inherited from class org.codehaus.janino.IClass
clearIFieldCaches, findIConstructor, findIMethod, findMemberType, getArrayIClass, getArrayIClass, getComponentType, getDeclaredIClasses, getDeclaredIConstructors, getDeclaredIField, getDeclaredIFields, getDeclaredIMethods, getDeclaredIMethods, getDeclaringIClass, getDescriptor, getDescriptors, getIAnnotations, getIMethods, getInterfaces, getOuterIClass, getSuperclass, getSyntheticIFields, hasIMethod, implementsInterface, invalidateMethodCaches, isAssignableFrom, isSubclassOf, toString
-
-
-
-
Field Detail
-
LOGGER
private static final java.util.logging.Logger LOGGER
-
classFile
private final ClassFile classFile
-
iClassLoader
private final IClassLoader iClassLoader
-
accessFlags
private final short accessFlags
-
resolvedFields
private final java.util.Map<ClassFile.FieldInfo,IClass.IField> resolvedFields
-
resolvedClasses
private final java.util.Map<java.lang.String,IClass> resolvedClasses
-
resolvedMethods
private final java.util.Map<ClassFile.MethodInfo,IClass.IInvocable> resolvedMethods
-
-
Constructor Detail
-
ClassFileIClass
public ClassFileIClass(ClassFile classFile, IClassLoader iClassLoader)
- Parameters:
classFile
- Source of dataiClassLoader
-IClassLoader
through which to load other classes
-
-
Method Detail
-
getDeclaredIConstructors2
protected IClass.IConstructor[] getDeclaredIConstructors2()
Description copied from class:IClass
The uncached version ofIClass.getDeclaredIConstructors()
which must be implemented by derived classes.- Specified by:
getDeclaredIConstructors2
in classIClass
-
getDeclaredIMethods2
protected IClass.IMethod[] getDeclaredIMethods2()
Description copied from class:IClass
The uncached version ofIClass.getDeclaredIMethods()
which must be implemented by derived classes.- Specified by:
getDeclaredIMethods2
in classIClass
-
getDeclaredIFields2
protected IClass.IField[] getDeclaredIFields2()
Description copied from class:IClass
Uncached version ofIClass.getDeclaredIFields()
.- Specified by:
getDeclaredIFields2
in classIClass
-
getDeclaredIClasses2
protected IClass[] getDeclaredIClasses2() throws CompileException
- Specified by:
getDeclaredIClasses2
in classIClass
- Returns:
- The member types of this type
- Throws:
CompileException
-
getDeclaringIClass2
@Nullable protected IClass getDeclaringIClass2() throws CompileException
- Specified by:
getDeclaringIClass2
in classIClass
- Returns:
- If this class is a member class, the declaring class, otherwise
null
- Throws:
CompileException
-
getOuterIClass2
@Nullable protected IClass getOuterIClass2() throws CompileException
- Specified by:
getOuterIClass2
in classIClass
- Throws:
CompileException
- See Also:
IClass.getOuterIClass()
-
getSuperclass2
@Nullable protected IClass getSuperclass2() throws CompileException
- Specified by:
getSuperclass2
in classIClass
- Throws:
CompileException
- See Also:
IClass.getSuperclass()
-
getAccess
public Access getAccess()
-
isFinal
public boolean isFinal()
Description copied from class:IClass
Whether subclassing is allowed (JVMS 4.1 access_flags)
-
getInterfaces2
protected IClass[] getInterfaces2() throws CompileException
- Specified by:
getInterfaces2
in classIClass
- Throws:
CompileException
- See Also:
IClass.getInterfaces()
-
isAbstract
public boolean isAbstract()
Description copied from class:IClass
Whether the class may be instantiated (JVMS 4.1 access_flags).- Specified by:
isAbstract
in classIClass
- Returns:
true
if instantiation is prohibited
-
getDescriptor2
protected java.lang.String getDescriptor2()
- Specified by:
getDescriptor2
in classIClass
- Returns:
- The field descriptor for the type as defined by JVMS 4.3.2.
-
isEnum
public boolean isEnum()
-
isInterface
public boolean isInterface()
- Specified by:
isInterface
in classIClass
- Returns:
- Whether this type represents an interface
-
isArray
public boolean isArray()
-
isPrimitive
public boolean isPrimitive()
- Specified by:
isPrimitive
in classIClass
- Returns:
- Whether this type represents a primitive type or
void
-
isPrimitiveNumeric
public boolean isPrimitiveNumeric()
- Specified by:
isPrimitiveNumeric
in classIClass
- Returns:
- Whether this type represents
byte
,short
,int
,long
,char
,float
ordouble
-
getComponentType2
@Nullable protected IClass getComponentType2()
- Specified by:
getComponentType2
in classIClass
- See Also:
IClass.getComponentType()
-
getIAnnotations2
protected IClass.IAnnotation[] getIAnnotations2() throws CompileException
- Overrides:
getIAnnotations2
in classIClass
- Throws:
CompileException
-
toIAnnotations
private IClass.IAnnotation[] toIAnnotations(ClassFile.Annotation[] annotations) throws CompileException
- Throws:
CompileException
-
toIAnnotation
private IClass.IAnnotation toIAnnotation(ClassFile.Annotation annotation) throws CompileException
- Throws:
CompileException
-
resolveAllClasses
public void resolveAllClasses() throws java.lang.ClassNotFoundException
Resolves all classes referenced by this class file.- Throws:
java.lang.ClassNotFoundException
-
resolveClass
private IClass resolveClass(short index) throws java.lang.ClassNotFoundException
- Parameters:
index
- Index of the CONSTANT_Class_info to resolve (JVMS 4.4.1)- Throws:
java.lang.ClassNotFoundException
-
resolveClass
private IClass resolveClass(java.lang.String descriptor) throws java.lang.ClassNotFoundException
- Throws:
java.lang.ClassNotFoundException
-
resolveClasses
private IClass[] resolveClasses(short[] ifs) throws CompileException
- Throws:
CompileException
-
resolveMethod
private IClass.IInvocable resolveMethod(ClassFile.MethodInfo methodInfo) throws java.lang.ClassNotFoundException
Turns aClassFile.MethodInfo
into anIClass.IInvocable
. This includes the checking and the removal of the magic first parameter of an inner class constructor.- Parameters:
methodInfo
-- Throws:
java.lang.ClassNotFoundException
-
resolveField
private IClass.IField resolveField(ClassFile.FieldInfo fieldInfo) throws java.lang.ClassNotFoundException
- Throws:
java.lang.ClassNotFoundException
-
accessFlags2Access
private static Access accessFlags2Access(short accessFlags)
-
-