|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.jdt.internal.compiler.ClassFile
public class ClassFile
Represents a class file wrapper on bytes, it is aware of its actual type name. Public APIs are listed below: byte[] getBytes(); Answer the actual bytes of the class file char[][] getCompoundName(); Answer the compound name of the class file. For example, {{java}, {util}, {Hashtable}}. byte[] getReducedBytes(); Answer a smaller byte format, which is only contains some structural information. Those bytes are decodable with a regular class file reader, such as DietClassFileReader
Field Summary | |
---|---|
CodeStream |
codeStream
|
ConstantPool |
constantPool
|
int |
constantPoolOffset
|
byte[] |
contents
|
int |
contentsOffset
|
ClassFile |
enclosingClassFile
|
byte[] |
header
|
int |
headerOffset
|
static int |
INITIAL_CONTENTS_SIZE
|
static int |
INITIAL_HEADER_SIZE
|
static int |
INNER_CLASSES_SIZE
|
java.util.Set |
innerClassesBindings
|
boolean |
isNestedType
|
int |
methodCount
|
int |
methodCountOffset
|
java.util.List |
missingTypes
|
int |
produceAttributes
|
SourceTypeBinding |
referenceBinding
|
long |
targetJDK
|
Constructor Summary | |
---|---|
ClassFile(SourceTypeBinding typeBinding)
|
Method Summary | |
---|---|
void |
addAbstractMethod(AbstractMethodDeclaration method,
MethodBinding methodBinding)
INTERNAL USE-ONLY Generate the byte for a problem method info that correspond to a boggus method. |
void |
addAttributes()
INTERNAL USE-ONLY This methods generate all the attributes for the receiver. |
void |
addDefaultAbstractMethods()
INTERNAL USE-ONLY This methods generate all the default abstract method infos that correpond to the abstract methods inherited from superinterfaces. |
void |
addFieldInfos()
INTERNAL USE-ONLY This methods generate all the fields infos for the receiver. |
void |
addProblemClinit(CategorizedProblem[] problems)
INTERNAL USE-ONLY Generate the byte for a problem clinit method info that correspond to a boggus method. |
void |
addProblemConstructor(AbstractMethodDeclaration method,
MethodBinding methodBinding,
CategorizedProblem[] problems)
INTERNAL USE-ONLY Generate the byte for a problem method info that correspond to a boggus constructor. |
void |
addProblemConstructor(AbstractMethodDeclaration method,
MethodBinding methodBinding,
CategorizedProblem[] problems,
int savedOffset)
INTERNAL USE-ONLY Generate the byte for a problem method info that correspond to a boggus constructor. |
void |
addProblemMethod(AbstractMethodDeclaration method,
MethodBinding methodBinding,
CategorizedProblem[] problems)
INTERNAL USE-ONLY Generate the byte for a problem method info that correspond to a boggus method. |
void |
addProblemMethod(AbstractMethodDeclaration method,
MethodBinding methodBinding,
CategorizedProblem[] problems,
int savedOffset)
INTERNAL USE-ONLY Generate the byte for a problem method info that correspond to a boggus method. |
void |
addSpecialMethods()
INTERNAL USE-ONLY Generate the byte for all the special method infos. |
void |
addSyntheticConstructorAccessMethod(SyntheticMethodBinding methodBinding)
INTERNAL USE-ONLY Generate the bytes for a synthetic method that provides an access to a private constructor. |
void |
addSyntheticEnumValueOfMethod(SyntheticMethodBinding methodBinding)
INTERNAL USE-ONLY Generate the bytes for a synthetic method that implements Enum#valueOf(String) for a given enum type |
void |
addSyntheticEnumValuesMethod(SyntheticMethodBinding methodBinding)
INTERNAL USE-ONLY Generate the bytes for a synthetic method that implements Enum#values() for a given enum type |
void |
addSyntheticFieldReadAccessMethod(SyntheticMethodBinding methodBinding)
INTERNAL USE-ONLY Generate the byte for a problem method info that correspond to a synthetic method that generate an read access to a private field. |
void |
addSyntheticFieldWriteAccessMethod(SyntheticMethodBinding methodBinding)
INTERNAL USE-ONLY Generate the byte for a problem method info that correspond to a synthetic method that generate an write access to a private field. |
void |
addSyntheticMethodAccessMethod(SyntheticMethodBinding methodBinding)
INTERNAL USE-ONLY Generate the bytes for a synthetic method that provides access to a private method. |
void |
addSyntheticSwitchTable(SyntheticMethodBinding methodBinding)
|
void |
completeCodeAttribute(int codeAttributeOffset)
INTERNAL USE-ONLY That method completes the creation of the code attribute by setting - the attribute_length - max_stack - max_locals - code_length - exception table - and debug attributes if necessary. |
void |
completeCodeAttributeForClinit(int codeAttributeOffset)
INTERNAL USE-ONLY That method completes the creation of the code attribute by setting - the attribute_length - max_stack - max_locals - code_length - exception table - and debug attributes if necessary. |
void |
completeCodeAttributeForClinit(int codeAttributeOffset,
int problemLine)
INTERNAL USE-ONLY That method completes the creation of the code attribute by setting - the attribute_length - max_stack - max_locals - code_length - exception table - and debug attributes if necessary. |
void |
completeCodeAttributeForMissingAbstractProblemMethod(MethodBinding binding,
int codeAttributeOffset,
int[] startLineIndexes,
int problemLine)
|
void |
completeCodeAttributeForProblemMethod(AbstractMethodDeclaration method,
MethodBinding binding,
int codeAttributeOffset,
int[] startLineIndexes,
int problemLine)
INTERNAL USE-ONLY That method completes the creation of the code attribute by setting - the attribute_length - max_stack - max_locals - code_length - exception table - and debug attributes if necessary. |
void |
completeCodeAttributeForSyntheticMethod(boolean hasExceptionHandlers,
SyntheticMethodBinding binding,
int codeAttributeOffset,
int[] startLineIndexes)
INTERNAL USE-ONLY That method completes the creation of the code attribute by setting - the attribute_length - max_stack - max_locals - code_length - exception table - and debug attributes if necessary. |
void |
completeCodeAttributeForSyntheticMethod(SyntheticMethodBinding binding,
int codeAttributeOffset,
int[] startLineIndexes)
INTERNAL USE-ONLY That method completes the creation of the code attribute by setting - the attribute_length - max_stack - max_locals - code_length - exception table - and debug attributes if necessary. |
void |
completeMethodInfo(int methodAttributeOffset,
int attributeNumber)
INTERNAL USE-ONLY Complete the creation of a method info by setting up the number of attributes at the right offset. |
static void |
createProblemType(TypeDeclaration typeDeclaration,
CompilationResult unitResult)
INTERNAL USE-ONLY Request the creation of a ClassFile compatible representation of a problematic type |
char[] |
fileName()
INTERNAL USE-ONLY This methods returns a char[] representing the file name of the receiver |
void |
generateCodeAttributeHeader()
INTERNAL USE-ONLY That method generates the header of a code attribute. |
int |
generateMethodInfoAttribute(MethodBinding methodBinding)
INTERNAL USE-ONLY That method generates the attributes of a code attribute. |
int |
generateMethodInfoAttribute(MethodBinding methodBinding,
AnnotationMethodDeclaration declaration)
|
void |
generateMethodInfoHeader(MethodBinding methodBinding)
INTERNAL USE-ONLY That method generates the header of a method info: The header consists in: - the access flags - the name index of the method name inside the constant pool - the descriptor index of the signature of the method inside the constant pool. |
void |
generateMethodInfoHeader(MethodBinding methodBinding,
int accessFlags)
INTERNAL USE-ONLY That method generates the header of a method info: The header consists in: - the access flags - the name index of the method name inside the constant pool - the descriptor index of the signature of the method inside the constant pool. |
void |
generateMethodInfoHeaderForClinit()
INTERNAL USE-ONLY That method generates the method info header of a clinit: The header consists in: - the access flags (always default access + static) - the name index of the method name (always |
void |
generateMissingAbstractMethods(MethodDeclaration[] methodDeclarations,
CompilationResult compilationResult)
INTERNAL USE-ONLY Generate the byte for problem method infos that correspond to missing abstract methods. |
byte[] |
getBytes()
EXTERNAL API Answer the actual bytes of the class file This method encodes the receiver structure into a byte array which is the content of the classfile. |
char[][] |
getCompoundName()
EXTERNAL API Answer the compound name of the class file. |
static ClassFile |
getNewInstance(SourceTypeBinding typeBinding)
|
void |
initialize(SourceTypeBinding aType,
ClassFile parentClassFile,
boolean createProblemType)
|
ClassFile |
outerMostEnclosingClassFile()
INTERNAL USE-ONLY Returns the most enclosing classfile of the receiver. |
void |
recordInnerClasses(TypeBinding binding)
|
void |
reset(SourceTypeBinding typeBinding)
|
void |
setForMethodInfos()
INTERNAL USE-ONLY This methods leaves the space for method counts recording. |
void |
traverse(MethodBinding methodBinding,
int maxLocals,
byte[] bytecodes,
int codeOffset,
int codeLength,
java.util.ArrayList frames,
boolean isClinit)
|
char[] |
utf8At(byte[] reference,
int absoluteOffset,
int bytesAvailable)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public CodeStream codeStream
public ConstantPool constantPool
public int constantPoolOffset
public byte[] contents
public int contentsOffset
public ClassFile enclosingClassFile
public byte[] header
public int headerOffset
public java.util.Set innerClassesBindings
public int methodCount
public int methodCountOffset
public int produceAttributes
public SourceTypeBinding referenceBinding
public boolean isNestedType
public long targetJDK
public java.util.List missingTypes
public static final int INITIAL_CONTENTS_SIZE
public static final int INITIAL_HEADER_SIZE
public static final int INNER_CLASSES_SIZE
Constructor Detail |
---|
public ClassFile(SourceTypeBinding typeBinding)
Method Detail |
---|
public static void createProblemType(TypeDeclaration typeDeclaration, CompilationResult unitResult)
typeDeclaration
- org.eclipse.jdt.internal.compiler.ast.TypeDeclarationunitResult
- org.eclipse.jdt.internal.compiler.CompilationUnitResultpublic static ClassFile getNewInstance(SourceTypeBinding typeBinding)
public void addAbstractMethod(AbstractMethodDeclaration method, MethodBinding methodBinding)
method
- org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclarationmethodBinding
- org.eclipse.jdt.internal.compiler.nameloopkup.MethodBindingpublic void addAttributes()
public void addDefaultAbstractMethods()
public void addFieldInfos()
public void addProblemClinit(CategorizedProblem[] problems)
problems
- org.eclipse.jdt.internal.compiler.problem.Problem[]public void addProblemConstructor(AbstractMethodDeclaration method, MethodBinding methodBinding, CategorizedProblem[] problems)
method
- org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclarationmethodBinding
- org.eclipse.jdt.internal.compiler.nameloopkup.MethodBindingproblems
- org.eclipse.jdt.internal.compiler.problem.Problem[]public void addProblemConstructor(AbstractMethodDeclaration method, MethodBinding methodBinding, CategorizedProblem[] problems, int savedOffset)
method
- org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclarationmethodBinding
- org.eclipse.jdt.internal.compiler.nameloopkup.MethodBindingproblems
- org.eclipse.jdt.internal.compiler.problem.Problem[]savedOffset
- int
public void addProblemMethod(AbstractMethodDeclaration method, MethodBinding methodBinding, CategorizedProblem[] problems)
method
- org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclarationmethodBinding
- org.eclipse.jdt.internal.compiler.nameloopkup.MethodBindingproblems
- org.eclipse.jdt.internal.compiler.problem.Problem[]public void addProblemMethod(AbstractMethodDeclaration method, MethodBinding methodBinding, CategorizedProblem[] problems, int savedOffset)
method
- org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclarationmethodBinding
- org.eclipse.jdt.internal.compiler.nameloopkup.MethodBindingproblems
- org.eclipse.jdt.internal.compiler.problem.Problem[]savedOffset
- int
public void addSpecialMethods()
public void addSyntheticConstructorAccessMethod(SyntheticMethodBinding methodBinding)
methodBinding
- org.eclipse.jdt.internal.compiler.nameloopkup.SyntheticAccessMethodBindingpublic void addSyntheticEnumValueOfMethod(SyntheticMethodBinding methodBinding)
methodBinding
- org.eclipse.jdt.internal.compiler.nameloopkup.SyntheticAccessMethodBindingpublic void addSyntheticEnumValuesMethod(SyntheticMethodBinding methodBinding)
methodBinding
- org.eclipse.jdt.internal.compiler.nameloopkup.SyntheticAccessMethodBindingpublic void addSyntheticFieldReadAccessMethod(SyntheticMethodBinding methodBinding)
methodBinding
- org.eclipse.jdt.internal.compiler.nameloopkup.SyntheticAccessMethodBindingpublic void addSyntheticFieldWriteAccessMethod(SyntheticMethodBinding methodBinding)
methodBinding
- org.eclipse.jdt.internal.compiler.nameloopkup.SyntheticAccessMethodBindingpublic void addSyntheticMethodAccessMethod(SyntheticMethodBinding methodBinding)
methodBinding
- org.eclipse.jdt.internal.compiler.nameloopkup.SyntheticAccessMethodBindingpublic void addSyntheticSwitchTable(SyntheticMethodBinding methodBinding)
public void completeCodeAttribute(int codeAttributeOffset)
codeAttributeOffset
- int
public void completeCodeAttributeForClinit(int codeAttributeOffset)
codeAttributeOffset
- int
public void completeCodeAttributeForClinit(int codeAttributeOffset, int problemLine)
public void completeCodeAttributeForMissingAbstractProblemMethod(MethodBinding binding, int codeAttributeOffset, int[] startLineIndexes, int problemLine)
public void completeCodeAttributeForProblemMethod(AbstractMethodDeclaration method, MethodBinding binding, int codeAttributeOffset, int[] startLineIndexes, int problemLine)
codeAttributeOffset
- int
public void completeCodeAttributeForSyntheticMethod(boolean hasExceptionHandlers, SyntheticMethodBinding binding, int codeAttributeOffset, int[] startLineIndexes)
binding
- org.eclipse.jdt.internal.compiler.lookup.SyntheticAccessMethodBindingcodeAttributeOffset
- int
public void completeCodeAttributeForSyntheticMethod(SyntheticMethodBinding binding, int codeAttributeOffset, int[] startLineIndexes)
binding
- org.eclipse.jdt.internal.compiler.lookup.SyntheticAccessMethodBindingcodeAttributeOffset
- int
public void completeMethodInfo(int methodAttributeOffset, int attributeNumber)
methodAttributeOffset
- int
attributeNumber
- int
public char[] fileName()
public void generateCodeAttributeHeader()
public int generateMethodInfoAttribute(MethodBinding methodBinding)
methodBinding
- org.eclipse.jdt.internal.compiler.lookup.MethodBinding
int
public int generateMethodInfoAttribute(MethodBinding methodBinding, AnnotationMethodDeclaration declaration)
public void generateMethodInfoHeader(MethodBinding methodBinding)
methodBinding
- org.eclipse.jdt.internal.compiler.lookup.MethodBindingpublic void generateMethodInfoHeader(MethodBinding methodBinding, int accessFlags)
methodBinding
- org.eclipse.jdt.internal.compiler.lookup.MethodBindingaccessFlags
- the access flagspublic void generateMethodInfoHeaderForClinit()
public void generateMissingAbstractMethods(MethodDeclaration[] methodDeclarations, CompilationResult compilationResult)
methodDeclarations
- Array of all missing abstract methodspublic byte[] getBytes()
public char[][] getCompoundName()
public void initialize(SourceTypeBinding aType, ClassFile parentClassFile, boolean createProblemType)
public ClassFile outerMostEnclosingClassFile()
public void recordInnerClasses(TypeBinding binding)
public void reset(SourceTypeBinding typeBinding)
public void setForMethodInfos()
public void traverse(MethodBinding methodBinding, int maxLocals, byte[] bytecodes, int codeOffset, int codeLength, java.util.ArrayList frames, boolean isClinit)
public char[] utf8At(byte[] reference, int absoluteOffset, int bytesAvailable)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |