org.eclipse.jdt.internal.compiler
Class ClassFile

java.lang.Object
  extended by org.eclipse.jdt.internal.compiler.ClassFile
All Implemented Interfaces:
TypeConstants, TypeIds
Direct Known Subclasses:
CodeSnippetClassFile

public class ClassFile
extends java.lang.Object
implements TypeConstants, TypeIds

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
           
 
Fields inherited from interface org.eclipse.jdt.internal.compiler.lookup.TypeConstants
ANNOTATION, ANNOTATION_PREFIX, ANNOTATION_SUFFIX, ANONYM_PREFIX, ANONYM_SUFFIX, BOOLEAN, BYTE, CHAR, CharArray_JAVA_IO_OBJECTINPUTSTREAM, CharArray_JAVA_IO_OBJECTOUTPUTSTREAM, CharArray_JAVA_IO_OBJECTSTREAMFIELD, CharArray_JAVA_LANG_ANNOTATION_ANNOTATION, CharArray_JAVA_LANG_ENUM, CharArray_JAVA_LANG_OBJECT, CLINIT, CLONE, CONSTRAINT_EQUAL, CONSTRAINT_EXTENDS, CONSTRAINT_SUPER, DOUBLE, FLOAT, GETCLASS, INIT, INT, IO, JAVA, JAVA_IO, JAVA_IO_EXTERNALIZABLE, JAVA_IO_IOEXCEPTION, JAVA_IO_OBJECTINPUTSTREAM, JAVA_IO_OBJECTOUTPUTSTREAM, JAVA_IO_OBJECTSTREAMEXCEPTION, JAVA_IO_PRINTSTREAM, JAVA_IO_SERIALIZABLE, JAVA_LANG, JAVA_LANG_ANNOTATION_ANNOTATION, JAVA_LANG_ANNOTATION_DOCUMENTED, JAVA_LANG_ANNOTATION_ELEMENTTYPE, JAVA_LANG_ANNOTATION_INHERITED, JAVA_LANG_ANNOTATION_RETENTION, JAVA_LANG_ANNOTATION_RETENTIONPOLICY, JAVA_LANG_ANNOTATION_TARGET, JAVA_LANG_ASSERTIONERROR, JAVA_LANG_BOOLEAN, JAVA_LANG_BYTE, JAVA_LANG_CHARACTER, JAVA_LANG_CLASS, JAVA_LANG_CLASSNOTFOUNDEXCEPTION, JAVA_LANG_CLONEABLE, JAVA_LANG_DEPRECATED, JAVA_LANG_DOUBLE, JAVA_LANG_ENUM, JAVA_LANG_ERROR, JAVA_LANG_EXCEPTION, JAVA_LANG_FLOAT, JAVA_LANG_ILLEGALARGUMENTEXCEPTION, JAVA_LANG_INTEGER, JAVA_LANG_ITERABLE, JAVA_LANG_LONG, JAVA_LANG_NOCLASSDEFERROR, JAVA_LANG_OBJECT, JAVA_LANG_OVERRIDE, JAVA_LANG_REFLECT_CONSTRUCTOR, JAVA_LANG_REFLECT_FIELD, JAVA_LANG_REFLECT_METHOD, JAVA_LANG_RUNTIMEEXCEPTION, JAVA_LANG_SHORT, JAVA_LANG_STRING, JAVA_LANG_STRINGBUFFER, JAVA_LANG_STRINGBUILDER, JAVA_LANG_SUPPRESSWARNINGS, JAVA_LANG_SYSTEM, JAVA_LANG_THROWABLE, JAVA_LANG_VOID, JAVA_UTIL_ITERATOR, JML_ANNOTATION, JML_ANNOTATION_CODE_BIGINT_MATH, JML_ANNOTATION_CODE_JAVA_MATH, JML_ANNOTATION_CODE_SAFE_MATH, JML_ANNOTATION_GHOST, JML_ANNOTATION_HELPER, JML_ANNOTATION_INSTANCE, JML_ANNOTATION_MODEL, JML_ANNOTATION_NON_NULL, JML_ANNOTATION_NON_NULL_BY_DEFAULT, JML_ANNOTATION_NULLABLE, JML_ANNOTATION_NULLABLE_BY_DEFAULT, JML_ANNOTATION_PEER, JML_ANNOTATION_PKG, JML_ANNOTATION_PURE, JML_ANNOTATION_READONLY, JML_ANNOTATION_REP, JML_ANNOTATION_SPEC_BIGINT_MATH, JML_ANNOTATION_SPEC_JAVA_MATH, JML_ANNOTATION_SPEC_PROTECTED, JML_ANNOTATION_SPEC_PUBLIC, JML_ANNOTATION_SPEC_SAFE_MATH, JML_ANNOTATION_TYPE_CODE_BIGINT_MATH, JML_ANNOTATION_TYPE_CODE_JAVA_MATH, JML_ANNOTATION_TYPE_CODE_SAFE_MATH, JML_ANNOTATION_TYPE_GHOST, JML_ANNOTATION_TYPE_HELPER, JML_ANNOTATION_TYPE_INSTANCE, JML_ANNOTATION_TYPE_MODEL, JML_ANNOTATION_TYPE_NON_NULL_BY_DEFAULT, JML_ANNOTATION_TYPE_NONNULL, JML_ANNOTATION_TYPE_NULLABLE, JML_ANNOTATION_TYPE_NULLABLE_BY_DEFAULT, JML_ANNOTATION_TYPE_PEER, JML_ANNOTATION_TYPE_PURE, JML_ANNOTATION_TYPE_READONLY, JML_ANNOTATION_TYPE_REP, JML_ANNOTATION_TYPE_SPEC_BIGINT_MATH, JML_ANNOTATION_TYPE_SPEC_JAVA_MATH, JML_ANNOTATION_TYPE_SPEC_PROTECTED, JML_ANNOTATION_TYPE_SPEC_PUBLIC, JML_ANNOTATION_TYPE_SPEC_SAFE_MATH, JML_ANNOTATION_TYPE_UNINITIALIZED, JML_ANNOTATION_UNINITIALIZED, JML_ORG, JML_RUNTIME, JML_RUNTIME_ANNOTATION, JML4, JMLSPECS, LANG, LENGTH, LONG, MAIN, MISMATCH, NULL, OBJECT, OK, PACKAGE_INFO_NAME, READOBJECT, READRESOLVE, REFLECT, SERIALPERSISTENTFIELDS, SERIALVERSIONUID, SHORT, SYNTHETIC_ACCESS_METHOD_PREFIX, SYNTHETIC_ASSERT_DISABLED, SYNTHETIC_CLASS, SYNTHETIC_ENCLOSING_INSTANCE_PREFIX, SYNTHETIC_ENUM_VALUES, SYNTHETIC_OUTER_LOCAL_PREFIX, SYNTHETIC_SWITCH_ENUM_TABLE, TYPE, UNCHECKED, UPPER_ANNOTATION_TYPE, UPPER_CLASS, UPPER_CONSTRUCTOR, UPPER_FIELD, UPPER_LOCAL_VARIABLE, UPPER_METHOD, UPPER_PACKAGE, UPPER_PARAMETER, UPPER_RUNTIME, UPPER_SOURCE, UTIL, VALUE, VALUEOF, VALUES, VOID, WILDCARD_CAPTURE, WILDCARD_CAPTURE_NAME_PREFIX, WILDCARD_CAPTURE_NAME_SUFFIX, WILDCARD_EXTENDS, WILDCARD_MINUS, WILDCARD_NAME, WILDCARD_PLUS, WILDCARD_STAR, WILDCARD_SUPER, WRITEOBJECT, WRITEREPLACE
 
Fields inherited from interface org.eclipse.jdt.internal.compiler.lookup.TypeIds
Boolean2Boolean, Boolean2Int, Boolean2String, BOXING, Byte2Byte, Byte2Char, Byte2Double, Byte2Float, Byte2Int, Byte2Long, Byte2Short, Byte2String, Char2Byte, Char2Char, Char2Double, Char2Float, Char2Int, Char2Long, Char2Short, Char2String, COMPILE_TYPE_MASK, Double2Byte, Double2Char, Double2Double, Double2Float, Double2Int, Double2Long, Double2Short, Double2String, Float2Byte, Float2Char, Float2Double, Float2Float, Float2Int, Float2Long, Float2Short, Float2String, IMPLICIT_CONVERSION_MASK, Int2Byte, Int2Char, Int2Double, Int2Float, Int2Int, Int2Long, Int2Short, Int2String, Long2Byte, Long2Char, Long2Double, Long2Float, Long2Int, Long2Long, Long2Short, Long2String, NoId, Null2String, Object2Object, Object2String, Short2Byte, Short2Char, Short2Double, Short2Float, Short2Int, Short2Long, Short2Short, Short2String, String2String, T_boolean, T_byte, T_char, T_double, T_float, T_int, T_JavaIoException, T_JavaIoExternalizable, T_JavaIoObjectStreamException, T_JavaIoPrintStream, T_JavaIoSerializable, T_JavaLangAnnotationAnnotation, T_JavaLangAnnotationDocumented, T_JavaLangAnnotationElementType, T_JavaLangAnnotationInherited, T_JavaLangAnnotationRetention, T_JavaLangAnnotationRetentionPolicy, T_JavaLangAnnotationTarget, T_JavaLangAssertionError, T_JavaLangBoolean, T_JavaLangByte, T_JavaLangCharacter, T_JavaLangClass, T_JavaLangClassNotFoundException, T_JavaLangCloneable, T_JavaLangDeprecated, T_JavaLangDouble, T_JavaLangEnum, T_JavaLangError, T_JavaLangException, T_JavaLangFloat, T_JavaLangIllegalArgumentException, T_JavaLangInteger, T_JavaLangIterable, T_JavaLangLong, T_JavaLangNoClassDefError, T_JavaLangObject, T_JavaLangOverride, T_JavaLangReflectConstructor, T_JavaLangReflectField, T_JavaLangReflectMethod, T_JavaLangRuntimeException, T_JavaLangShort, T_JavaLangString, T_JavaLangStringBuffer, T_JavaLangStringBuilder, T_JavaLangSuppressWarnings, T_JavaLangSystem, T_JavaLangThrowable, T_JavaLangVoid, T_JavaUtilIterator, T_long, T_null, T_short, T_undefined, T_void, UNBOXING
 
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 ) inside the constant pool - the descriptor index of the signature (always ()V) of the method inside the constant pool.
 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

codeStream

public CodeStream codeStream

constantPool

public ConstantPool constantPool

constantPoolOffset

public int constantPoolOffset

contents

public byte[] contents

contentsOffset

public int contentsOffset

enclosingClassFile

public ClassFile enclosingClassFile

header

public byte[] header

headerOffset

public int headerOffset

innerClassesBindings

public java.util.Set innerClassesBindings

methodCount

public int methodCount

methodCountOffset

public int methodCountOffset

produceAttributes

public int produceAttributes

referenceBinding

public SourceTypeBinding referenceBinding

isNestedType

public boolean isNestedType

targetJDK

public long targetJDK

missingTypes

public java.util.List missingTypes

INITIAL_CONTENTS_SIZE

public static final int INITIAL_CONTENTS_SIZE
See Also:
Constant Field Values

INITIAL_HEADER_SIZE

public static final int INITIAL_HEADER_SIZE
See Also:
Constant Field Values

INNER_CLASSES_SIZE

public static final int INNER_CLASSES_SIZE
See Also:
Constant Field Values
Constructor Detail

ClassFile

public ClassFile(SourceTypeBinding typeBinding)
Method Detail

createProblemType

public static void createProblemType(TypeDeclaration typeDeclaration,
                                     CompilationResult unitResult)
INTERNAL USE-ONLY Request the creation of a ClassFile compatible representation of a problematic type

Parameters:
typeDeclaration - org.eclipse.jdt.internal.compiler.ast.TypeDeclaration
unitResult - org.eclipse.jdt.internal.compiler.CompilationUnitResult

getNewInstance

public static ClassFile getNewInstance(SourceTypeBinding typeBinding)

addAbstractMethod

public void addAbstractMethod(AbstractMethodDeclaration method,
                              MethodBinding methodBinding)
INTERNAL USE-ONLY Generate the byte for a problem method info that correspond to a boggus method.

Parameters:
method - org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration
methodBinding - org.eclipse.jdt.internal.compiler.nameloopkup.MethodBinding

addAttributes

public void addAttributes()
INTERNAL USE-ONLY This methods generate all the attributes for the receiver. For a class they could be: - source file attribute - inner classes attribute - deprecated attribute


addDefaultAbstractMethods

public void addDefaultAbstractMethods()
INTERNAL USE-ONLY This methods generate all the default abstract method infos that correpond to the abstract methods inherited from superinterfaces.


addFieldInfos

public void addFieldInfos()
INTERNAL USE-ONLY This methods generate all the fields infos for the receiver. This includes: - a field info for each defined field of that class - a field info for each synthetic field (e.g. this$0)


addProblemClinit

public void addProblemClinit(CategorizedProblem[] problems)
INTERNAL USE-ONLY Generate the byte for a problem clinit method info that correspond to a boggus method.

Parameters:
problems - org.eclipse.jdt.internal.compiler.problem.Problem[]

addProblemConstructor

public 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.

Parameters:
method - org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration
methodBinding - org.eclipse.jdt.internal.compiler.nameloopkup.MethodBinding
problems - org.eclipse.jdt.internal.compiler.problem.Problem[]

addProblemConstructor

public 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. Reset the position inside the contents byte array to the savedOffset.

Parameters:
method - org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration
methodBinding - org.eclipse.jdt.internal.compiler.nameloopkup.MethodBinding
problems - org.eclipse.jdt.internal.compiler.problem.Problem[]
savedOffset - int

addProblemMethod

public 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.

Parameters:
method - org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration
methodBinding - org.eclipse.jdt.internal.compiler.nameloopkup.MethodBinding
problems - org.eclipse.jdt.internal.compiler.problem.Problem[]

addProblemMethod

public 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. Reset the position inside the contents byte array to the savedOffset.

Parameters:
method - org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration
methodBinding - org.eclipse.jdt.internal.compiler.nameloopkup.MethodBinding
problems - org.eclipse.jdt.internal.compiler.problem.Problem[]
savedOffset - int

addSpecialMethods

public void addSpecialMethods()
INTERNAL USE-ONLY Generate the byte for all the special method infos. They are: - synthetic access methods - default abstract methods


addSyntheticConstructorAccessMethod

public void addSyntheticConstructorAccessMethod(SyntheticMethodBinding methodBinding)
INTERNAL USE-ONLY Generate the bytes for a synthetic method that provides an access to a private constructor.

Parameters:
methodBinding - org.eclipse.jdt.internal.compiler.nameloopkup.SyntheticAccessMethodBinding

addSyntheticEnumValueOfMethod

public void addSyntheticEnumValueOfMethod(SyntheticMethodBinding methodBinding)
INTERNAL USE-ONLY Generate the bytes for a synthetic method that implements Enum#valueOf(String) for a given enum type

Parameters:
methodBinding - org.eclipse.jdt.internal.compiler.nameloopkup.SyntheticAccessMethodBinding

addSyntheticEnumValuesMethod

public void addSyntheticEnumValuesMethod(SyntheticMethodBinding methodBinding)
INTERNAL USE-ONLY Generate the bytes for a synthetic method that implements Enum#values() for a given enum type

Parameters:
methodBinding - org.eclipse.jdt.internal.compiler.nameloopkup.SyntheticAccessMethodBinding

addSyntheticFieldReadAccessMethod

public 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.

Parameters:
methodBinding - org.eclipse.jdt.internal.compiler.nameloopkup.SyntheticAccessMethodBinding

addSyntheticFieldWriteAccessMethod

public 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.

Parameters:
methodBinding - org.eclipse.jdt.internal.compiler.nameloopkup.SyntheticAccessMethodBinding

addSyntheticMethodAccessMethod

public void addSyntheticMethodAccessMethod(SyntheticMethodBinding methodBinding)
INTERNAL USE-ONLY Generate the bytes for a synthetic method that provides access to a private method.

Parameters:
methodBinding - org.eclipse.jdt.internal.compiler.nameloopkup.SyntheticAccessMethodBinding

addSyntheticSwitchTable

public void addSyntheticSwitchTable(SyntheticMethodBinding methodBinding)

completeCodeAttribute

public 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.

Parameters:
codeAttributeOffset - int

completeCodeAttributeForClinit

public 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.

Parameters:
codeAttributeOffset - int

completeCodeAttributeForClinit

public 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.


completeCodeAttributeForMissingAbstractProblemMethod

public void completeCodeAttributeForMissingAbstractProblemMethod(MethodBinding binding,
                                                                 int codeAttributeOffset,
                                                                 int[] startLineIndexes,
                                                                 int problemLine)

completeCodeAttributeForProblemMethod

public 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.

Parameters:
codeAttributeOffset - int

completeCodeAttributeForSyntheticMethod

public 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.

Parameters:
binding - org.eclipse.jdt.internal.compiler.lookup.SyntheticAccessMethodBinding
codeAttributeOffset - int

completeCodeAttributeForSyntheticMethod

public 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.

Parameters:
binding - org.eclipse.jdt.internal.compiler.lookup.SyntheticAccessMethodBinding
codeAttributeOffset - int

completeMethodInfo

public 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.

Parameters:
methodAttributeOffset - int
attributeNumber - int

fileName

public char[] fileName()
INTERNAL USE-ONLY This methods returns a char[] representing the file name of the receiver

Returns:
char[]

generateCodeAttributeHeader

public void generateCodeAttributeHeader()
INTERNAL USE-ONLY That method generates the header of a code attribute. - the index inside the constant pool for the attribute name ("Code") - leave some space for attribute_length(4), max_stack(2), max_locals(2), code_length(4).


generateMethodInfoAttribute

public int generateMethodInfoAttribute(MethodBinding methodBinding)
INTERNAL USE-ONLY That method generates the attributes of a code attribute. They could be: - an exception attribute for each try/catch found inside the method - a deprecated attribute - a synthetic attribute for synthetic access methods It returns the number of attributes created for the code attribute.

Parameters:
methodBinding - org.eclipse.jdt.internal.compiler.lookup.MethodBinding
Returns:
int

generateMethodInfoAttribute

public int generateMethodInfoAttribute(MethodBinding methodBinding,
                                       AnnotationMethodDeclaration declaration)

generateMethodInfoHeader

public 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.

Parameters:
methodBinding - org.eclipse.jdt.internal.compiler.lookup.MethodBinding

generateMethodInfoHeader

public 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.

Parameters:
methodBinding - org.eclipse.jdt.internal.compiler.lookup.MethodBinding
accessFlags - the access flags

generateMethodInfoHeaderForClinit

public 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 ) inside the constant pool - the descriptor index of the signature (always ()V) of the method inside the constant pool.


generateMissingAbstractMethods

public void generateMissingAbstractMethods(MethodDeclaration[] methodDeclarations,
                                           CompilationResult compilationResult)
INTERNAL USE-ONLY Generate the byte for problem method infos that correspond to missing abstract methods. http://dev.eclipse.org/bugs/show_bug.cgi?id=3179

Parameters:
methodDeclarations - Array of all missing abstract methods

getBytes

public 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. Returns the byte array that represents the encoded structure of the receiver.

Returns:
byte[]

getCompoundName

public char[][] getCompoundName()
EXTERNAL API Answer the compound name of the class file.

Returns:
char[][] e.g. {{java}, {util}, {Hashtable}}.

initialize

public void initialize(SourceTypeBinding aType,
                       ClassFile parentClassFile,
                       boolean createProblemType)

outerMostEnclosingClassFile

public ClassFile outerMostEnclosingClassFile()
INTERNAL USE-ONLY Returns the most enclosing classfile of the receiver. This is used know to store the constant pool name for all inner types of the receiver.

Returns:
org.eclipse.jdt.internal.compiler.codegen.ClassFile

recordInnerClasses

public void recordInnerClasses(TypeBinding binding)

reset

public void reset(SourceTypeBinding typeBinding)

setForMethodInfos

public void setForMethodInfos()
INTERNAL USE-ONLY This methods leaves the space for method counts recording.


traverse

public void traverse(MethodBinding methodBinding,
                     int maxLocals,
                     byte[] bytecodes,
                     int codeOffset,
                     int codeLength,
                     java.util.ArrayList frames,
                     boolean isClinit)

utf8At

public char[] utf8At(byte[] reference,
                     int absoluteOffset,
                     int bytesAvailable)