Package com.strobel.assembler.metadata
Class ClassFileReader
- java.lang.Object
-
- com.strobel.assembler.ir.MetadataReader
-
- com.strobel.assembler.metadata.ClassFileReader
-
public final class ClassFileReader extends MetadataReader
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) class
ClassFileReader.FieldInfo
(package private) class
ClassFileReader.MethodInfo
private class
ClassFileReader.ResolverFrame
(package private) static class
ClassFileReader.Scope
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<SourceAttribute>
_attributes
private ConstantPool.TypeInfoEntry
_baseClassEntry
private Buffer
_buffer
private ConstantPool
_constantPool
private java.util.List<ClassFileReader.FieldInfo>
_fields
private ConstantPool.TypeInfoEntry[]
_interfaceEntries
private java.lang.String
_internalName
private java.util.List<ClassFileReader.MethodInfo>
_methods
private int
_options
private MetadataParser
_parser
private IMetadataResolver
_resolver
private ClassFileReader.ResolverFrame
_resolverFrame
private ClassFileReader.Scope
_scope
private TypeDefinition
_typeDefinition
(package private) static long
MAGIC
private static MethodHandleType[]
METHOD_HANDLE_TYPES
static int
OPTION_PROCESS_ANNOTATIONS
static int
OPTION_PROCESS_CODE
static int
OPTIONS_DEFAULT
-
Constructor Summary
Constructors Modifier Constructor Description private
ClassFileReader(int options, IMetadataResolver resolver, int majorVersion, int minorVersion, Buffer buffer, ConstantPool constantPool, int accessFlags, ConstantPool.TypeInfoEntry thisClassEntry, ConstantPool.TypeInfoEntry baseClassEntry, ConstantPool.TypeInfoEntry[] interfaceEntries)
-
Method Summary
-
Methods inherited from class com.strobel.assembler.ir.MetadataReader
inflateAttribute, inflateAttribute, inflateAttributes, inflateAttributes, readAttribute, readAttributes
-
-
-
-
Field Detail
-
OPTION_PROCESS_ANNOTATIONS
public static final int OPTION_PROCESS_ANNOTATIONS
- See Also:
- Constant Field Values
-
OPTION_PROCESS_CODE
public static final int OPTION_PROCESS_CODE
- See Also:
- Constant Field Values
-
OPTIONS_DEFAULT
public static final int OPTIONS_DEFAULT
- See Also:
- Constant Field Values
-
MAGIC
static final long MAGIC
- See Also:
- Constant Field Values
-
_options
private final int _options
-
_resolver
private final IMetadataResolver _resolver
-
_buffer
private final Buffer _buffer
-
_constantPool
private final ConstantPool _constantPool
-
_baseClassEntry
private final ConstantPool.TypeInfoEntry _baseClassEntry
-
_interfaceEntries
private final ConstantPool.TypeInfoEntry[] _interfaceEntries
-
_fields
private final java.util.List<ClassFileReader.FieldInfo> _fields
-
_methods
private final java.util.List<ClassFileReader.MethodInfo> _methods
-
_attributes
private final java.util.List<SourceAttribute> _attributes
-
_internalName
private final java.lang.String _internalName
-
_typeDefinition
private final TypeDefinition _typeDefinition
-
_parser
private final MetadataParser _parser
-
_resolverFrame
private final ClassFileReader.ResolverFrame _resolverFrame
-
_scope
private final ClassFileReader.Scope _scope
-
METHOD_HANDLE_TYPES
private static final MethodHandleType[] METHOD_HANDLE_TYPES
-
-
Constructor Detail
-
ClassFileReader
private ClassFileReader(int options, IMetadataResolver resolver, int majorVersion, int minorVersion, Buffer buffer, ConstantPool constantPool, int accessFlags, ConstantPool.TypeInfoEntry thisClassEntry, ConstantPool.TypeInfoEntry baseClassEntry, ConstantPool.TypeInfoEntry[] interfaceEntries)
-
-
Method Detail
-
shouldProcessAnnotations
protected boolean shouldProcessAnnotations()
-
shouldProcessCode
protected boolean shouldProcessCode()
-
getScope
protected IMetadataScope getScope()
- Specified by:
getScope
in classMetadataReader
-
getParser
public MetadataParser getParser()
- Specified by:
getParser
in classMetadataReader
-
readAttributeCore
protected SourceAttribute readAttributeCore(java.lang.String name, Buffer buffer, int originalOffset, int length)
Reads aSourceAttribute
from the specified buffer.- Overrides:
readAttributeCore
in classMetadataReader
- Parameters:
name
- The name of the attribute to decode.buffer
- A buffer containing the attribute blob.originalOffset
- The offset of position 0 in the buffer relative to the start of the original class file. This is needed during lazy inflation ofCodeAttribute
(and possibly others). In the case ofCodeAttribute
, it is helpful to know exactly where each method's body begins so we can load it on demand at some point in the future.length
- The length of the attribute. Implementations should not rely onbuffer.size()
.
-
readModuleDependency
protected final ModuleDependency readModuleDependency(Buffer buffer)
-
readPackageInfo
protected final PackageInfo readPackageInfo(Buffer buffer)
-
readServiceInfo
protected final ServiceInfo readServiceInfo(Buffer buffer)
-
readAttributesPhaseOne
private void readAttributesPhaseOne(Buffer buffer, SourceAttribute[] attributes)
-
readClass
public static TypeDefinition readClass(IMetadataResolver resolver, Buffer b)
-
readClass
public static TypeDefinition readClass(int options, IMetadataResolver resolver, Buffer b)
-
readClass
final TypeDefinition readClass()
-
checkModuleAttribute
private void checkModuleAttribute()
-
checkEnclosingMethodAttributes
private void checkEnclosingMethodAttributes()
-
populateMemberInfo
private void populateMemberInfo()
-
populateDeclaringType
private void populateDeclaringType()
-
populateBaseTypes
private void populateBaseTypes()
-
populatePermittedSubclasses
private void populatePermittedSubclasses()
-
checkSealed0
private boolean checkSealed0(TypeReference type)
-
populateNamedInnerTypes
private void populateNamedInnerTypes()
-
populateAnonymousInnerTypes
private void populateAnonymousInnerTypes()
-
visitFields
private void visitFields()
-
tryParseTypeSignature
private TypeReference tryParseTypeSignature(java.lang.String signature, java.lang.String fallback)
-
defineMethods
private void defineMethods()
-
tryParseMethodSignature
private IMethodSignature tryParseMethodSignature(java.lang.String signature, IMethodSignature fallback)
-
readMethodBody
private void readMethodBody(ClassFileReader.MethodInfo methodInfo, MethodDefinition methodDefinition)
-
visitAttributes
private void visitAttributes()
-
-