trait ClassFileBinding extends ClassFileReader
- Self Type
- ClassFileBinding with ConstantPoolBinding with MethodsBinding with FieldsBinding with AttributeBinding
- Source
- ClassFileBinding.scala
- Alphabetic
- By Inheritance
- ClassFileBinding
- ClassFileReader
- Constant_PoolAbstractions
- ClassFileReaderConfiguration
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- abstract type Attributes
The type of the object that represents a class declaration's attributes (e.g., the source file attribute.)
The type of the object that represents a class declaration's attributes (e.g., the source file attribute.)
- Definition Classes
- ClassFileReader
- abstract type CONSTANT_Utf8_info <: (ClassFileBinding.this)#Constant_Pool_Entry
- Definition Classes
- Constant_PoolAbstractions
- type ClassFile = br.ClassFile
The type of the object that represents a Java class file.
The type of the object that represents a Java class file.
- Definition Classes
- ClassFileBinding → ClassFileReader → Constant_PoolAbstractions
- final type Constant_Pool = Array[(ClassFileBinding.this)#Constant_Pool_Entry]
- Definition Classes
- Constant_PoolAbstractions
- abstract type Constant_Pool_Entry <: ConstantPoolEntry
- Definition Classes
- Constant_PoolAbstractions
- final type Constant_Pool_Index = Int
- Definition Classes
- Constant_PoolAbstractions
- type DeferredActionsStore = Buffer[((ClassFileBinding.this)#ClassFile) => (ClassFileBinding.this)#ClassFile] with (ClassFileBinding.this)#Constant_Pool_Entry
A DeferredActionsStore stores all functions that need to perform post load actions.
A DeferredActionsStore stores all functions that need to perform post load actions.
One example is the resolution of references to attributes. (The constant pool is the only structure that is passed around and hence it is the only place where to store information/functions related to a specific class file).
- Definition Classes
- Constant_PoolAbstractions
- abstract type Fields
The type of the object that represents the fields of a class.
The type of the object that represents the fields of a class.
- Definition Classes
- ClassFileReader
- final type Interfaces = Array[(ClassFileBinding.this)#Constant_Pool_Index]
The inherited interfaces.
The inherited interfaces.
- Definition Classes
- ClassFileReader
- abstract type Methods
The type of the object that represents all methods of a class.
The type of the object that represents all methods of a class.
- Definition Classes
- ClassFileReader
Abstract Value Members
- abstract def Attributes(cp: (ClassFileBinding.this)#Constant_Pool, ap: AttributeParent, ap_name_index: (ClassFileBinding.this)#Constant_Pool_Index, ap_descriptor_index: (ClassFileBinding.this)#Constant_Pool_Index, in: DataInputStream): (ClassFileBinding.this)#Attributes
Reads all attributes using the given stream and constant pool.
Reads all attributes using the given stream and constant pool.
The given stream is positioned directly before a class file's "attributes_count" field. This method is called by the template method that reads in a class file to delegate the reading of the attributes.
From the Specification
The attributes [...] appearing in the attributes table of a ClassFile structure are the InnerClasses, EnclosingMethod, Synthetic, Signature, SourceFile, SourceDebugExtension, Deprecated, RuntimeVisibleAnnotations, RuntimeInvisibleAnnotations, BootstrapMethods, RuntimeVisibleTypeAnnotations, and RuntimeInvisibleTypeAnnotations attributes.
- Attributes
- protected
- Definition Classes
- ClassFileReader
- abstract def Constant_Pool(in: DataInputStream): (ClassFileBinding.this)#Constant_Pool
Reads the constant pool using the given stream.
Reads the constant pool using the given stream.
When this method is called the given stream has to be positioned at the very beginning of the constant pool. This method is called by the template method that reads in a class file to delegate the reading of the constant pool. Only information belonging to the constant pool are allowed to be read.
The stream must not be closed after reading the constant pool.
- Attributes
- protected
- Definition Classes
- ClassFileReader
- abstract def Fields(cp: (ClassFileBinding.this)#Constant_Pool, in: DataInputStream): (ClassFileBinding.this)#Fields
Reads all field declarations using the given stream and constant pool.
Reads all field declarations using the given stream and constant pool.
The given stream is positioned directly before a class file's "fields_count" field. This method is called by the template method that reads in a class file to delegate the reading of the declared fields.
- Attributes
- protected
- Definition Classes
- ClassFileReader
- abstract def Methods(cp: (ClassFileBinding.this)#Constant_Pool, in: DataInputStream): (ClassFileBinding.this)#Methods
Reads all method declarations using the given stream and constant pool.
Reads all method declarations using the given stream and constant pool.
The given stream is positioned directly before a class file's "methods_count" field. This method is called by the template method that reads in a class file to delegate the reading of the declared method.
- Attributes
- protected
- Definition Classes
- ClassFileReader
- abstract def applyDeferredActions(cp: (ClassFileBinding.this)#Constant_Pool, classFile: (ClassFileBinding.this)#ClassFile): (ClassFileBinding.this)#ClassFile
This method is called/needs to be called after the class file was completely loaded to perform class file specific transformations.
This method is called/needs to be called after the class file was completely loaded to perform class file specific transformations.
- Definition Classes
- Constant_PoolAbstractions
- implicit abstract val constantPoolEntryType: ClassTag[(ClassFileBinding.this)#Constant_Pool_Entry]
- Definition Classes
- Constant_PoolAbstractions
- abstract def loadsInterfacesOnly: Boolean
If
true
method bodies are never loaded.If
true
method bodies are never loaded.- Definition Classes
- ClassFileReaderConfiguration
Concrete Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def AllClassFiles(files: Iterable[File], exceptionHandler: bi.reader.ClassFileReader.ExceptionHandler = defaultExceptionHandler): Iterable[((ClassFileBinding.this)#ClassFile, URL)]
- Definition Classes
- ClassFileReader
- def ClassFile(cp: (ClassFileBinding.this)#Constant_Pool, minor_version: Int, major_version: Int, access_flags: Int, this_class_index: (ClassFileBinding.this)#Constant_Pool_Index, super_class_index: (ClassFileBinding.this)#Constant_Pool_Index, interfaces: (ClassFileBinding.this)#Interfaces, fields: (ClassFileBinding.this)#Fields, methods: (ClassFileBinding.this)#Methods, attributes: (ClassFileBinding.this)#Attributes): (ClassFileBinding.this)#ClassFile
Factory method to create the
ClassFile
object that represents the class file as a whole, plus anyClassFile
s that have been synthesized in the process of parsing it.Factory method to create the
ClassFile
object that represents the class file as a whole, plus anyClassFile
s that have been synthesized in the process of parsing it.The result will always contain at least one
ClassFile
object, namely the one that is created from this method's parameters. Regardless of how manyClassFile
s the result contains, theClassFile
created from this method's parameters will always be the result's first element.- Definition Classes
- ClassFileBinding → ClassFileReader
- def ClassFile(jarFileName: String, jarFileEntryName: String): List[(ClassFileBinding.this)#ClassFile]
Reads in a single class file from a Jar file.
Reads in a single class file from a Jar file.
- jarFileName
the name of an existing ZIP/JAR file that contains class files.
- jarFileEntryName
the name of a class file stored in the specified ZIP/JAR file.
- Definition Classes
- ClassFileReader
- Annotations
- @throws("if the file is empty or the entry cannot be found")
- def ClassFile(jarFile: File, jarFileEntryName: String): List[(ClassFileBinding.this)#ClassFile]
Reads in a single class file from a Jar file.
Reads in a single class file from a Jar file.
- jarFile
An existing ZIP/JAR file that contains class files.
- jarFileEntryName
The name of a class file stored in the specified ZIP/JAR file.
- Definition Classes
- ClassFileReader
- Annotations
- @throws("if the file is empty or the entry cannot be found")
- def ClassFile(jarFile: ZipFile, jarEntry: ZipEntry): List[(ClassFileBinding.this)#ClassFile]
- Attributes
- protected[this]
- Definition Classes
- ClassFileReader
- def ClassFile(create: () => InputStream): List[(ClassFileBinding.this)#ClassFile]
Reads in a class file.
Reads in a class file.
- create
A function that creates a new
InputStream
and which must not returnnull
. If you already do have an open input stream which should not be closed after reading the class file use...ClassFileReader.ClassFile(java.io.DataInputStream) : ClassFile
instead. The (newly created)InputStream
returned by callingcreate
is closed by this method. The created input stream will automatically be wrapped by OPAL to enable efficient reading of the class file.
- Definition Classes
- ClassFileReader
- def ClassFile(in: DataInputStream): List[(ClassFileBinding.this)#ClassFile]
Template method that reads a Java class file from the given input stream.
Template method that reads a Java class file from the given input stream.
All other methods to read a class file use this method to eventually parse a class file.
Class File Structure
Parses a class file according to the specification:
ClassFile { u4 magic; u2 minor_version; u2 major_version; u2 constant_pool_count; cp_info constant_pool[constant_pool_count-1]; u2 access_flags; u2 this_class; u2 super_class; u2 interfaces_count; u2 interfaces[interfaces_count]; u2 fields_count; field_info fields[fields_count]; u2 methods_count; method_info methods[methods_count]; u2 attributes_count; attribute_info attributes[attributes_count]; }
- in
The
DataInputStream
from which the class file will be read. The stream is not closed by this method. It is highly recommended that the stream is buffered; otherwise the performance will be terrible!
- Definition Classes
- ClassFileReader
- def ClassFiles(file: File, exceptionHandler: bi.reader.ClassFileReader.ExceptionHandler = defaultExceptionHandler): List[((ClassFileBinding.this)#ClassFile, URL)]
Loads class files from the given file location.
Loads class files from the given file location.
- If the file denotes a single ".class" file this class file is loaded.
- If the file object denotes a ".jar|.war|.ear|.zip" file, all class files in the jar file will be loaded.
- If the file object specifies a directory object, all ".class" files
in the directory and in all subdirectories are loaded as well as all
class files stored in ".jar" files in one of the directories. This class loads
all class files in parallel. However, this does not effect analyses working on the
resulting
List
.
- Definition Classes
- ClassFileReader
- def ClassFiles(zipFile: ZipFile, classFileHandler: ((ClassFileBinding.this)#ClassFile, URL) => Unit, exceptionHandler: bi.reader.ClassFileReader.ExceptionHandler): Unit
Reads in parallel all class files stored in the given jar file.
Reads in parallel all class files stored in the given jar file. For each successfully read class file the function
classFileHandler
is called.- zipFile
A valid zip file that contains
.class
files and other.jar
files; other files are ignored. Inner jar files are also unzipped.- classFileHandler
A function that is called for each class file in the given jar file. Given that the jarFile is read in parallel this function has to be thread safe.
- exceptionHandler
The exception handler that is called when the reading of a class file fails. This function has to be thread safe.
- Definition Classes
- ClassFileReader
- def ClassFiles(in: => JarInputStream): List[((ClassFileBinding.this)#ClassFile, String)]
Reads the class files from the given JarInputStream
Reads the class files from the given JarInputStream
- Definition Classes
- ClassFileReader
- def ClassFiles(jarFile: ZipFile, exceptionHandler: bi.reader.ClassFileReader.ExceptionHandler): List[((ClassFileBinding.this)#ClassFile, URL)]
Reads in parallel all class files stored in the given jar/zip file.
Reads in parallel all class files stored in the given jar/zip file.
- jarFile
Some valid (non-empty) jar File.
- returns
The loaded class files.
- Definition Classes
- ClassFileReader
- def JRTClassFiles: Iterable[(String, List[((ClassFileBinding.this)#ClassFile, URL)])]
Returns the class files of the current Java Runtime Image grouped by module.
Returns the class files of the current Java Runtime Image grouped by module.
- Definition Classes
- ClassFileReader
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @IntrinsicCandidate()
- implicit val config: Config
The
Config
object that will be used to read the configuration settings for reading in class files.The
Config
object that will be used to read the configuration settings for reading in class files.- Definition Classes
- ClassFileReaderConfiguration
- def defaultConfig: Config
- Definition Classes
- ClassFileReaderConfiguration
- final val defaultExceptionHandler: bi.reader.ClassFileReader.ExceptionHandler
- Definition Classes
- ClassFileReader
- def defaultLogContext: LogContext
- Definition Classes
- ClassFileReaderConfiguration
- val deleteSynthesizedClassFilesAttributes: Boolean
This property determines whether artificial SynthesizedClassFiles attributes are kept or removed.
This property determines whether artificial SynthesizedClassFiles attributes are kept or removed.
- Note
This setting can be set using the configuration key
ClassFileBinding.DeleteSynthesizedClassFilesAttributesConfigKey
.
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- val extractSynthesizedClassFiles: (List[(ClassFileBinding.this)#ClassFile]) => List[(ClassFileBinding.this)#ClassFile]
Tests if the class file has a SynthesizedClassFiles attribute and – if so – extracts the class file and removes the attribute.
- def findClassFile(files: Iterable[File], progressReporter: (File) => Unit, classFileFilter: ((ClassFileBinding.this)#ClassFile) => Boolean, className: ((ClassFileBinding.this)#ClassFile) => String, exceptionHandler: bi.reader.ClassFileReader.ExceptionHandler = defaultExceptionHandler): Either[((ClassFileBinding.this)#ClassFile, URL), Set[String]]
Searches for the first class file that is accepted by the filter.
Searches for the first class file that is accepted by the filter. If no class file can be found that is accepted by the filter the set of all class names is returned.
- files
Some file. If the file names a .jar file the .jar file is opened and searched for a corresponding class file. If the file identifies a "directory" then, all files in that directory are processed.
- Definition Classes
- ClassFileReader
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
- def isClassFileRepository(filename: String, containerName: Option[String]): Boolean
- Definition Classes
- ClassFileReader
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- implicit val logContext: LogContext
The org.opalj.log.LogContext that should be used to log rewritings.
The org.opalj.log.LogContext that should be used to log rewritings.
- Definition Classes
- ClassFileReaderConfiguration
- Note
The org.opalj.log.LogContext is typically either the org.opalj.log.GlobalLogContext or a project specific log context.
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
- def processClassFiles(files: Iterable[File], progressReporter: (File) => Unit, classFileProcessor: (((ClassFileBinding.this)#ClassFile, URL)) => Unit, exceptionHandler: bi.reader.ClassFileReader.ExceptionHandler = defaultExceptionHandler): Unit
Goes over all files in parallel and calls back the given function which has to be thread-safe!
Goes over all files in parallel and calls back the given function which has to be thread-safe!
- Definition Classes
- ClassFileReader
- def registerClassFilePostProcessor(p: (List[(ClassFileBinding.this)#ClassFile]) => List[(ClassFileBinding.this)#ClassFile]): Unit
Register a class file post processor.
Register a class file post processor. A class file post processor can transform the completely read and reified class file. Post processors can only be registered before the usage of a class file reader. Registering new
ClassFilePostProcessors
while processing class files is not supported and the behavior is undefined.- Definition Classes
- ClassFileReader
- Note
PostProcessors
will be executed in last-in-first-out order.
- val removeBootstrapMethodAttribute: (List[(ClassFileBinding.this)#ClassFile]) => List[(ClassFileBinding.this)#ClassFile]
Removes all BootstrapMethodTable attributes because the
invokedynamic
instructions are either completely resolved by creating code that resembles the code executed by the JVM or the instructions are at least enhanced and have explicit references to the bootstrap methods. - final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated