Klasse ClassFileReader
java.lang.Object
org.aspectj.org.eclipse.jdt.internal.compiler.classfmt.ClassFileStruct
org.aspectj.org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader
- Alle implementierten Schnittstellen:
IBinaryType,IDependent,IGenericType
-
Feldübersicht
FelderVon Schnittstelle geerbte Felder org.aspectj.org.eclipse.jdt.internal.compiler.env.IBinaryType
NoField, NoInterface, NoMethod, NoNestedTypeVon Schnittstelle geerbte Felder org.aspectj.org.eclipse.jdt.internal.compiler.env.IDependent
JAR_FILE_ENTRY_SEPARATOR -
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungClassFileReader(byte[] classFileBytes, char[] fileName) ClassFileReader(byte[] classFileBytes, char[] fileName, boolean fullyInitialize) ClassFileReader(URI path, byte[] classFileBytes, char[] fileName) -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungintAnswer the receiver's access flags.enrichWithExternalAnnotationsFor(ITypeAnnotationWalker walker, Object member, LookupEnvironment environment) Conditionally add external annotations to the mix.Answer the runtime visible and invisible annotations for this type or null if none.int[]Answer the int array that corresponds to all the offsets of each entry in the constant poolchar[]Answer the enclosing method (including method selector and method descriptor), or null if none.char[]Answer the resolved name of the enclosing type in the class file format as specified in section 4.2 of the Java 2 VM spec or null if the receiver is a top level type.Answer whether a provider for external annotations is associated with this binary type.Answer the receiver's this.fields or null if the array is empty.char[]Answer the file name which defines the type.char[]Answer the receiver's ClassSignature, which describes the type parameters, super class, and super interfaces as specified in section "4.7.9.1 Signatures" of the Java SE 8 VM spec.char[]Answer the source name if the receiver is a inner type.char[][]Answer the resolved names of the receiver's interfaces in the class file format as specified in section 4.2 of the Java 2 VM spec or null if the array is empty.Answer the receiver's nested types or null if the array is empty.getMemberTypes(boolean keepIncorrectlyNamedInners) Answer the receiver's nested types or null if the array is empty.Answer the receiver's this.methods or null if the array is empty.char[][][]Answer the list of missing type names which were referenced from the problem classfile.intAnswer an int whose bits are set according the access constants defined by the VM spec.char[]Answer the module to which this type belongs.Returns the module declaration that this class file represents.char[]getName()Answer the resolved name of the type in the class file format as specified in section 4.2 of the Java 2 VM spec.char[]char[][]Answer the unresolved names of the receiver's permitted sub types or null if the array is empty.Answer the receiver's record components or null if the array is empty.byte[]char[]Answer the simple name of the type in the class file.char[]Answer the resolved name of the receiver's superclass in the class file format as specified in section 4.2 of the Java 2 VM spec or null if it does not have one.longAnswer the tagbits set according to the bits for annotations.Answer the runtime visible and invisible type annotations for this type or null if none.getURI()longAnswer the major/minor version defined in this class file according to the VM spec.booleanhasStructuralChanges(byte[] newBytes) Check if the receiver has structural changes compare to the byte array in argument.booleanhasStructuralChanges(byte[] newBytes, boolean orderRequired, boolean excludesSynthetic) Check if the receiver has structural changes compare to the byte array in argument.booleanAnswer true if the receiver is an anonymous class.booleanAnswer whether the receiver contains the resolved binary form or the unresolved source form of the type.booleanisLocal()Answer true if the receiver is a local class.booleanisMember()Answer true if the receiver is a member class.booleanAnswer true if the receiver is a nested type, false otherwisebooleanisRecord()Answer true if the receiver is a record.booleanisStaticInner(char[] innerTypeName) static ClassFileReaderstatic ClassFileReaderstatic ClassFileReaderread(InputStream stream, String fileName) static ClassFileReaderread(InputStream stream, String fileName, boolean fullyInitialize) static ClassFileReaderstatic ClassFileReaderstatic ClassFileReaderstatic ClassFileReaderstatic ClassFileReaderreadFromJrt(File jrt, IModule module, String filename) static ClassFileReaderchar[]Answer the source file name attribute.toString()
-
Felddetails
-
moduleName
public char[] moduleName
-
-
Konstruktordetails
-
ClassFileReader
- Parameter:
classFileBytes- Actual bytes of a .class filefileName- Actual name of the file that contains the bytes, can be null- Löst aus:
ClassFormatException
-
ClassFileReader
public ClassFileReader(URI path, byte[] classFileBytes, char[] fileName) throws ClassFormatException - Parameter:
path- URI pointing to the resource of the .class fileclassFileBytes- Actual bytes of a .class filefileName- Actual name of the file that contains the bytes, can be null- Löst aus:
ClassFormatException
-
ClassFileReader
public ClassFileReader(byte[] classFileBytes, char[] fileName, boolean fullyInitialize) throws ClassFormatException - Parameter:
classFileBytes- byte[] Actual bytes of a .class filefileName- char[] Actual name of the file that contains the bytes, can be nullfullyInitialize- boolean Flag to fully initialize the new object- Löst aus:
ClassFormatException
-
-
Methodendetails
-
read
- Löst aus:
ClassFormatExceptionIOException
-
read
public static ClassFileReader read(File file, boolean fullyInitialize) throws ClassFormatException, IOException - Löst aus:
ClassFormatExceptionIOException
-
read
public static ClassFileReader read(InputStream stream, String fileName) throws ClassFormatException, IOException - Löst aus:
ClassFormatExceptionIOException
-
read
public static ClassFileReader read(InputStream stream, String fileName, boolean fullyInitialize) throws ClassFormatException, IOException - Löst aus:
ClassFormatExceptionIOException
-
read
public static ClassFileReader read(ZipFile zip, String filename) throws ClassFormatException, IOException - Löst aus:
ClassFormatExceptionIOException
-
readFromJrt
public static ClassFileReader readFromJrt(File jrt, IModule module, String filename) throws ClassFormatException, IOException - Löst aus:
ClassFormatExceptionIOException
-
readFromModule
public static ClassFileReader readFromModule(File jrt, String moduleName, String filename, Predicate<String> moduleNameFilter) throws ClassFormatException, IOException - Löst aus:
ClassFormatExceptionIOException
-
read
public static ClassFileReader read(ZipFile zip, String filename, boolean fullyInitialize) throws ClassFormatException, IOException - Löst aus:
ClassFormatExceptionIOException
-
read
- Löst aus:
ClassFormatExceptionIOException
-
read
public static ClassFileReader read(String fileName, boolean fullyInitialize) throws ClassFormatException, IOException - Löst aus:
ClassFormatExceptionIOException
-
getNestHost
public char[] getNestHost() -
getExternalAnnotationStatus
Beschreibung aus Schnittstelle kopiert:IBinaryTypeAnswer whether a provider for external annotations is associated with this binary type.- Angegeben von:
getExternalAnnotationStatusin SchnittstelleIBinaryType
-
enrichWithExternalAnnotationsFor
public ITypeAnnotationWalker enrichWithExternalAnnotationsFor(ITypeAnnotationWalker walker, Object member, LookupEnvironment environment) Conditionally add external annotations to the mix. If 'member' is given it must be either of IBinaryField or IBinaryMethod, in which case we're seeking annotations for that member. Otherwise we're seeking annotations for top-level elements of a type (type parameters Ungültige Eingabe: "&" super types).- Angegeben von:
enrichWithExternalAnnotationsForin SchnittstelleIBinaryType- Parameter:
walker- previous walker, may be empty, otherwise it will be returned unchangedmember- if either a IBinaryField or a IBinaryMethod is provided, answer a walker specifically for that memberenvironment- for use by the walker- Gibt zurück:
- either a matching walker with data from external annotations or the walker provided via argument 'walker'.
-
accessFlags
public int accessFlags()Answer the receiver's access flags. The value of the access_flags item is a mask of modifiers used with class and interface declarations.- Gibt zurück:
- int
-
getAnnotations
Beschreibung aus Schnittstelle kopiert:IBinaryTypeAnswer the runtime visible and invisible annotations for this type or null if none.- Angegeben von:
getAnnotationsin SchnittstelleIBinaryType- Gibt zurück:
- the annotations or null if there is none.
-
getTypeAnnotations
Beschreibung aus Schnittstelle kopiert:IBinaryTypeAnswer the runtime visible and invisible type annotations for this type or null if none.- Angegeben von:
getTypeAnnotationsin SchnittstelleIBinaryType- Gibt zurück:
- the type annotations or null if there is none.
-
getConstantPoolOffsets
public int[] getConstantPoolOffsets()Answer the int array that corresponds to all the offsets of each entry in the constant pool- Gibt zurück:
- int[]
-
getEnclosingMethod
public char[] getEnclosingMethod()Beschreibung aus Schnittstelle kopiert:IBinaryTypeAnswer the enclosing method (including method selector and method descriptor), or null if none. For example, "foo()Ljava/lang/Object;V"- Angegeben von:
getEnclosingMethodin SchnittstelleIBinaryType
-
getEnclosingTypeName
public char[] getEnclosingTypeName()Beschreibung aus Schnittstelle kopiert:IBinaryTypeAnswer the resolved name of the enclosing type in the class file format as specified in section 4.2 of the Java 2 VM spec or null if the receiver is a top level type. For example, java.lang.String is java/lang/String.- Angegeben von:
getEnclosingTypeNamein SchnittstelleIBinaryType
-
getFields
Answer the receiver's this.fields or null if the array is empty.- Angegeben von:
getFieldsin SchnittstelleIBinaryType- Gibt zurück:
- org.eclipse.jdt.internal.compiler.api.IBinaryField[]
-
getModule
public char[] getModule()Beschreibung aus Schnittstelle kopiert:IBinaryTypeAnswer the module to which this type belongs.nullif the type is associated to the unnamed module.- Angegeben von:
getModulein SchnittstelleIBinaryType- Gibt zurück:
- the module name or
null - Siehe auch:
-
getModuleDeclaration
Returns the module declaration that this class file represents. This will be null for non module-info class files.- Gibt zurück:
- the module declaration this represents
-
getFileName
public char[] getFileName()Beschreibung aus Schnittstelle kopiert:IDependentAnswer the file name which defines the type. The path part (optional) must be separated from the actual file proper name by a separator suitable for the type (java.io.File.separator for example), e.g. "c:\\source\\com\\p\\X.java" or "/com/p/Y.java". The path to the zip or jar file (optional) must be separated from the actual path part by JAR_FILE_ENTRY_SEPARATOR, e.g. "c:\\lib\\some.jar|/com/p/X.class" or "/lib/some.zip|/com/q/Y.class". The proper file name includes the suffix extension (e.g. ".java") e.g. "c:/org/eclipse/jdt/internal/compileri/env/IDependent.java" Return null if no file defines the type.- Angegeben von:
getFileNamein SchnittstelleIDependent- Siehe auch:
-
getGenericSignature
public char[] getGenericSignature()Beschreibung aus Schnittstelle kopiert:IBinaryTypeAnswer the receiver's ClassSignature, which describes the type parameters, super class, and super interfaces as specified in section "4.7.9.1 Signatures" of the Java SE 8 VM spec. Returns null if none.- Angegeben von:
getGenericSignaturein SchnittstelleIBinaryType- Gibt zurück:
- the receiver's signature, null if none
-
getInnerSourceName
public char[] getInnerSourceName()Answer the source name if the receiver is a inner type. Return null if it is an anonymous class or if the receiver is a top-level class. e.g. public class A { public class B { } public void foo() { class C {} } public Runnable bar() { return new Runnable() { public void run() {} }; } } It returns {'B'} for the member A$B It returns null for A It returns {'C'} for the local class A$1$C It returns null for the anonymous A$1- Gibt zurück:
- char[]
-
getInterfaceNames
public char[][] getInterfaceNames()Beschreibung aus Schnittstelle kopiert:IBinaryTypeAnswer the resolved names of the receiver's interfaces in the class file format as specified in section 4.2 of the Java 2 VM spec or null if the array is empty. For example, java.lang.String is java/lang/String.- Angegeben von:
getInterfaceNamesin SchnittstelleIBinaryType
-
getPermittedSubtypeNames
public char[][] getPermittedSubtypeNames()Beschreibung aus Schnittstelle kopiert:IBinaryTypeAnswer the unresolved names of the receiver's permitted sub types or null if the array is empty. A name is a simple name or a qualified, dot separated name. For example, Hashtable or java.util.Hashtable.- Angegeben von:
getPermittedSubtypeNamesin SchnittstelleIBinaryType
-
getMemberTypes
Beschreibung aus Schnittstelle kopiert:IBinaryTypeAnswer the receiver's nested types or null if the array is empty. This nested type info is extracted from the inner class attributes. Ask the name environment to find a member type using its compound name.- Angegeben von:
getMemberTypesin SchnittstelleIBinaryType
-
getMemberTypes
Answer the receiver's nested types or null if the array is empty. This nested type info is extracted from the inner class attributes. Ask the name environment to find a member type using its compound name- Gibt zurück:
- org.eclipse.jdt.internal.compiler.api.IBinaryNestedType[]
-
getMethods
Answer the receiver's this.methods or null if the array is empty.- Angegeben von:
getMethodsin SchnittstelleIBinaryType- Gibt zurück:
- org.eclipse.jdt.internal.compiler.api.env.IBinaryMethod[]
-
getMissingTypeNames
public char[][][] getMissingTypeNames()Beschreibung aus Schnittstelle kopiert:IBinaryTypeAnswer the list of missing type names which were referenced from the problem classfile. This list is encoded via an extra attribute.- Angegeben von:
getMissingTypeNamesin SchnittstelleIBinaryType
-
getModifiers
public int getModifiers()Answer an int whose bits are set according the access constants defined by the VM spec. Set the AccDeprecated and AccSynthetic bits if necessary- Angegeben von:
getModifiersin SchnittstelleIGenericType- Gibt zurück:
- int
-
getName
public char[] getName()Beschreibung aus Schnittstelle kopiert:IBinaryTypeAnswer the resolved name of the type in the class file format as specified in section 4.2 of the Java 2 VM spec. For example, java.lang.String is java/lang/String.- Angegeben von:
getNamein SchnittstelleIBinaryType
-
getSourceName
public char[] getSourceName()Beschreibung aus Schnittstelle kopiert:IBinaryTypeAnswer the simple name of the type in the class file. For member A$B, will answer B. For anonymous will answer null.- Angegeben von:
getSourceNamein SchnittstelleIBinaryType
-
getSuperclassName
public char[] getSuperclassName()Beschreibung aus Schnittstelle kopiert:IBinaryTypeAnswer the resolved name of the receiver's superclass in the class file format as specified in section 4.2 of the Java 2 VM spec or null if it does not have one. For example, java.lang.String is java/lang/String.- Angegeben von:
getSuperclassNamein SchnittstelleIBinaryType
-
getTagBits
public long getTagBits()Beschreibung aus Schnittstelle kopiert:IBinaryTypeAnswer the tagbits set according to the bits for annotations.- Angegeben von:
getTagBitsin SchnittstelleIBinaryType
-
getVersion
public long getVersion()Answer the major/minor version defined in this class file according to the VM spec. as a long: (majorUngültige Eingabe: "<"Ungültige Eingabe: "<"16)+minor- Gibt zurück:
- the major/minor version found
-
hasStructuralChanges
public boolean hasStructuralChanges(byte[] newBytes) Check if the receiver has structural changes compare to the byte array in argument. Structural changes are: - modifiers changes for the class, the this.fields or the this.methods - signature changes for this.fields or this.methods. - changes in the number of this.fields or this.methods - changes for field constants - changes for thrown exceptions - change for the super class or any super interfaces. - changes for member types name or modifiers If any of these changes occurs, the method returns true. false otherwise. The synthetic fields are included and the members are not required to be sorted.- Parameter:
newBytes- the bytes of the .class file we want to compare the receiver to- Gibt zurück:
- boolean Returns true is there is a structural change between the two .class files, false otherwise
-
hasStructuralChanges
public boolean hasStructuralChanges(byte[] newBytes, boolean orderRequired, boolean excludesSynthetic) Check if the receiver has structural changes compare to the byte array in argument. Structural changes are: - modifiers changes for the class, the this.fields or the this.methods - signature changes for this.fields or this.methods. - changes in the number of this.fields or this.methods - changes for field constants - changes for thrown exceptions - change for the super class or any super interfaces. - changes for member types name or modifiers If any of these changes occurs, the method returns true. false otherwise.- Parameter:
newBytes- the bytes of the .class file we want to compare the receiver toorderRequired- a boolean indicating whether the members should be sorted or notexcludesSynthetic- a boolean indicating whether the synthetic members should be used in the comparison- Gibt zurück:
- boolean Returns true is there is a structural change between the two .class files, false otherwise
-
isAnonymous
public boolean isAnonymous()Beschreibung aus Schnittstelle kopiert:IBinaryTypeAnswer true if the receiver is an anonymous class. false otherwise- Angegeben von:
isAnonymousin SchnittstelleIBinaryType
-
isBinaryType
public boolean isBinaryType()Beschreibung aus Schnittstelle kopiert:IGenericTypeAnswer whether the receiver contains the resolved binary form or the unresolved source form of the type.- Angegeben von:
isBinaryTypein SchnittstelleIGenericType
-
isLocal
public boolean isLocal()Beschreibung aus Schnittstelle kopiert:IBinaryTypeAnswer true if the receiver is a local class. false otherwise- Angegeben von:
isLocalin SchnittstelleIBinaryType
-
isMember
public boolean isMember()Beschreibung aus Schnittstelle kopiert:IBinaryTypeAnswer true if the receiver is a member class. false otherwise- Angegeben von:
isMemberin SchnittstelleIBinaryType
-
isNestedType
public boolean isNestedType()Answer true if the receiver is a nested type, false otherwise- Gibt zurück:
boolean
-
sourceFileName
public char[] sourceFileName()Answer the source file name attribute. Return null if there is no source file attribute for the receiver.- Angegeben von:
sourceFileNamein SchnittstelleIBinaryType- Gibt zurück:
- char[]
-
toString
-
isRecord
public boolean isRecord()Beschreibung aus Schnittstelle kopiert:IBinaryTypeAnswer true if the receiver is a record. false otherwise- Angegeben von:
isRecordin SchnittstelleIBinaryType
-
getRecordComponents
Beschreibung aus Schnittstelle kopiert:IBinaryTypeAnswer the receiver's record components or null if the array is empty.- Angegeben von:
getRecordComponentsin SchnittstelleIBinaryType
-
getURI
- Angegeben von:
getURIin SchnittstelleIBinaryType
-
isStaticInner
public boolean isStaticInner(char[] innerTypeName) -
getReferenceBytes
public byte[] getReferenceBytes()
-