package reader
Defines convenience methods related to reading in class files.
- Alphabetic
- By Inheritance
- reader
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
trait
AnnotationAttributesBinding extends AnnotationsBinding with AnnotationsReader with ParametersAnnotationsReader with RuntimeInvisibleAnnotations_attributeReader with RuntimeVisibleAnnotations_attributeReader with RuntimeInvisibleParameterAnnotations_attributeReader with RuntimeVisibleParameterAnnotations_attributeReader with AnnotationDefault_attributeReader with AttributeBinding
Factory methods to create representations of the attributes related to Java annotations.
-
trait
AnnotationsBinding extends AnnotationsAbstractions with ElementValuePairsReader with ConstantPoolBinding
Factory methods to create representations of Java annotations.
-
trait
AttributeBinding extends AttributesAbstractions
Defines the common bindings for all "resolved" attributes.
-
trait
BootstrapMethods_attributeBinding extends BootstrapMethods_attributeReader with ConstantPoolBinding with AttributeBinding
Final bindings and factory methods for the BoostrapMethods attribute.
- class BytecodeInstructionsCache extends AnyRef
-
trait
BytecodeOptimizer extends MethodsBinding
Performs some very basic, in-place control-flow simplifications to make the code more regular.
Performs some very basic, in-place control-flow simplifications to make the code more regular. In particular to make it more likely that an
ifthat is actually a loop'sifactually jumps back.The following transformations are performed:
- trivial gotos which jump to the immediately succeeding instruction are replaced by nops (the CFG may contain less basic blocks afterwards)
- goto chains are shortened (i.e., a goto jumping to another goto) (this primarily reduces the number of instructions that need to be evaluated at abstract interpretation time; it may - however - also reduce the number of basic blocks)
- useless ifs where the jump target is the next instruction are replaced by nops (the CFG may contain less basic blocks afterwards)
- if -> goto instruction sequences are resolved (this primarily reduces the number of instructions that need to be evaluated at abstract interpretation time; it may - however - also reduce the number of basic blocks)
- useless switches are replaced (the CFG may contain less basic blocks afterwards)
The target array has the same size as the source array to make sure that branch offsets/line- numbers etc. point to the correct instruction. Furthermore, we try to avoid the introduction of dead code.
- Note
All transformation always only reduce the number of basic blocks and never create new basic blocks. The existing stack map table attributes are never effected and remain valid; they may just contain more entries than strictly necessary.
-
trait
BytecodeReaderAndBinding extends InstructionsDeserializer
Defines a method to parse an array of bytes (containing Java bytecode instructions) and to return an array of org.opalj.br.instructions.Instruction's.
Defines a method to parse an array of bytes (containing Java bytecode instructions) and to return an array of org.opalj.br.instructions.Instruction's.
The target array has the same size as the source array to make sure that branch offsets etc. point to the correct instruction.
-
trait
CachedBytecodeReaderAndBinding extends InstructionsDeserializer
Defines a method to parse an array of bytes (containing Java bytecode instructions) and to return an array of org.opalj.br.instructions.Instruction
s.Defines a method to parse an array of bytes (containing Java bytecode instructions) and to return an array of org.opalj.br.instructions.Instruction
s.The target array has the same size as the source array to make sure that branch offsets etc. point to the correct instruction.
This reader caches the instructions – primarily – to save memory once all class files are loaded.
- trait ClassFileBinding extends ClassFileReader
-
trait
CodeAttributeBinding extends Code_attributeReader with ConstantPoolBinding with CodeBinding with AttributeBinding
Binding for the code attribute.
- trait CodeBinding extends AnyRef
-
trait
CompactLineNumberTable_attributeBinding extends CompactLineNumberTable_attributeReader with ConstantPoolBinding with AttributeBinding
Implements the factory methods to create line number tables.
-
trait
ConstantPoolBinding extends Constant_PoolReader
A representation of the constant pool.
A representation of the constant pool.
- Note
The constant pool is considered to be static; i.e., references between constant pool entries are always resolved at most once and the results are cached. Hence, after reading the constant pool the constant pool is treated as immutable; the referenced constant pool entry must not change.
- trait ConstantValue_attributeBinding extends ConstantValue_attributeReader with ConstantPoolBinding with AttributeBinding
-
trait
DeferredInvokedynamicResolution extends ConstantPoolBinding with CodeBinding
Mixin this trait to resolve links between org.opalj.br.instructions.INVOKEDYNAMIC instructions and the BootstrapMethodTable.
- trait Deprecated_attributeBinding extends Deprecated_attributeReader with ConstantPoolBinding with AttributeBinding
- trait EnclosingMethod_attributeBinding extends EnclosingMethod_attributeReader with ConstantPoolBinding with AttributeBinding
-
trait
Exceptions_attributeBinding extends Exceptions_attributeReader with ConstantPoolBinding with AttributeBinding
The factory method to create a method's exception attribute.
- trait FieldsBinding extends FieldsReader
-
trait
InnerClasses_attributeBinding extends InnerClasses_attributeReader with ConstantPoolBinding with AttributeBinding
The factory methods to create inner classes attributes and entries.
- trait InstructionsDeserializer extends DeferredInvokedynamicResolution
-
trait
InvokedynamicRewriting extends DeferredInvokedynamicResolution
Provides support for rewriting Java 8/Scala lambda or method reference expressions that were compiled to org.opalj.br.instructions.INVOKEDYNAMIC instructions.
Provides support for rewriting Java 8/Scala lambda or method reference expressions that were compiled to org.opalj.br.instructions.INVOKEDYNAMIC instructions. This trait should be mixed in alongside a BytecodeReaderAndBinding, which extracts basic
invokedynamicinformation from the BootstrapMethodTable.Specifically, whenever an
invokedynamicinstruction is encountered that is the result of a lambda/method reference expression compiled by Oracle's JDK8, it creates a proxy class file that represents the synthetic object that the JVM generates after executing theinvokedynamiccall site. This proxy is then stored in the temporary ClassFile attribute SynthesizedClassFiles. All such ClassFiles will be picked up later for inclusion in the project.- See also
DismantlingInvokeDynamic for further information.
-
trait
Java7Framework extends Java7LibraryFramework with CodeAttributeBinding with SourceDebugExtension_attributeBinding with BootstrapMethods_attributeBinding with StackMapTable_attributeBinding with CompactLineNumberTable_attributeBinding with LocalVariableTable_attributeBinding with LocalVariableTypeTable_attributeBinding with Exceptions_attributeBinding with BytecodeReaderAndBinding with BytecodeOptimizer with CodeReader
This "framework" can be used to read in Java 7 (version 51) class files.
This "framework" can be used to read in Java 7 (version 51) class files. All standard information (as defined in the Java Virtual Machine Specification) is represented.
-
trait
Java7LibraryFramework extends ConstantPoolBinding with FieldsBinding with MethodsBinding with ClassFileBinding with AttributesReader with SkipUnknown_attributeReader with AnnotationAttributesBinding with InnerClasses_attributeBinding with EnclosingMethod_attributeBinding with SourceFile_attributeBinding with Deprecated_attributeBinding with Signature_attributeBinding with Synthetic_attributeBinding with ConstantValue_attributeBinding with Exceptions_attributeBinding with Module_attributeBinding
This "framework" can be used to read in Java 7 (version 51) class files if only the public interface of a class is needed.
-
trait
Java8Framework extends Java7Framework with Java8LibraryFramework
This "framework" can be used to read Java 8 (version 52) class files.
This "framework" can be used to read Java 8 (version 52) class files. All standard information (as defined in the Java Virtual Machine Specification) is represented.
-
class
Java8FrameworkWithCaching extends Java8LibraryFramework with CodeAttributeBinding with SourceDebugExtension_attributeBinding with BootstrapMethods_attributeBinding with StackMapTable_attributeBinding with CompactLineNumberTable_attributeBinding with LocalVariableTable_attributeBinding with LocalVariableTypeTable_attributeBinding with Exceptions_attributeBinding with CachedBytecodeReaderAndBinding with BytecodeOptimizer with CodeReader
This configuration can be used to read in Java 8 (version 52) class files.
This configuration can be used to read in Java 8 (version 52) class files. All standard information (as defined in the Java Virtual Machine Specification) is represented. Instructions will be cached.
-
class
Java8FrameworkWithInvokedynamicSupportAndCaching extends Java8FrameworkWithCaching with InvokedynamicRewriting
This configuration can be used to read in Java 8 (version 52) class files with full support for rewriting
invokedynamicinstructions created by the JDK(8) compiler for lambda and method reference expressions.This configuration can be used to read in Java 8 (version 52) class files with full support for rewriting
invokedynamicinstructions created by the JDK(8) compiler for lambda and method reference expressions. All standard information (as defined in the Java Virtual Machine Specification) is represented. Instructions will be cached. -
trait
Java8LibraryFramework extends Java7LibraryFramework with MethodParameters_attributeBinding with TypeAnnotationAttributesBinding
This "framework" can be used to read in Java 8 (version 52) class files.
This "framework" can be used to read in Java 8 (version 52) class files. All standard information (as defined in the Java Virtual Machine Specification) is represented except of method implementations.
-
trait
Java9Framework extends Java8Framework with Java9LibraryFramework
This "framework" can be used to read Java 9 (version 53) and Java 10 (version 54) class files.
This "framework" can be used to read Java 9 (version 53) and Java 10 (version 54) class files. All standard information (as defined in the Java Virtual Machine Specification) is represented. (Java 10 did not introduce new attributes.)
-
class
Java9FrameworkWithCaching extends Java8FrameworkWithCaching with Java9LibraryFramework
This configuration can be used to read in Java 9 (version 53) class files.
This configuration can be used to read in Java 9 (version 53) class files. All standard information (as defined in the Java Virtual Machine Specification) is represented. Instructions will be cached.
-
class
Java9FrameworkWithInvokedynamicSupportAndCaching extends Java8FrameworkWithInvokedynamicSupportAndCaching with Java9LibraryFramework
This configuration can be used to read in Java 9 (version 53) class files.
This configuration can be used to read in Java 9 (version 53) class files. All standard information (as defined in the Java Virtual Machine Specification) is represented. Instructions will be cached.
-
trait
Java9LibraryFramework extends Java8LibraryFramework with ModuleMainClass_attributeBinding with ModulePackages_attributeBinding
This "framework" can be used to read in Java 9 (version 53) class files.
This "framework" can be used to read in Java 9 (version 53) class files. All standard information (as defined in the Java Virtual Machine Specification) is represented except of method implementations.
-
trait
LibraryClassFileBinding extends ClassFileBinding
Default class file binding where all private fields and methods are not represented.
-
trait
LocalVariableTable_attributeBinding extends LocalVariableTable_attributeReader with ConstantPoolBinding with AttributeBinding
The factory methods to create local variable tables and their entries.
-
trait
LocalVariableTypeTable_attributeBinding extends LocalVariableTypeTable_attributeReader with ConstantPoolBinding with AttributeBinding
The factory methods to create local variable type tables and their entries.
-
trait
MethodParameters_attributeBinding extends MethodParameters_attributeReader with ConstantPoolBinding with AttributeBinding
Implements the factory methods to create method parameter tables and their entries.
- trait MethodsBinding extends MethodsReader
-
trait
ModuleMainClass_attributeBinding extends ModuleMainClass_attributeReader with ConstantPoolBinding with AttributeBinding
The factory method to create the
ModuleMainClassattribute (Java 9). -
trait
ModulePackages_attributeBinding extends ModulePackages_attributeReader with ConstantPoolBinding with AttributeBinding
The factory method to create the
ModulePackagesattribute (Java 9). -
trait
Module_attributeBinding extends Module_attributeReader with ConstantPoolBinding with AttributeBinding
The factory method to create the "class level"
Moduleattribute (Java 9). -
trait
Signature_attributeBinding extends Signature_attributeReader with ConstantPoolBinding with AttributeBinding
Implements the factory method defined and used by the generic signature attribute reader.
- type Source = AnyRef
-
trait
SourceDebugExtension_attributeBinding extends SourceDebugExtension_attributeReader with ConstantPoolBinding with AttributeBinding
Provides the factory method to create a source debug extension attribute.
-
trait
SourceFile_attributeBinding extends SourceFile_attributeReader with ConstantPoolBinding with AttributeBinding
The factory method to create the source file attribute.
-
trait
StackMapTable_attributeBinding extends StackMapTable_attributeReader with StackMapFrameReader with VerificationTypeInfoReader with ConstantPoolBinding with AttributeBinding
Provides the factory methods to create a stack map table attribute and its entries.
-
trait
Synthetic_attributeBinding extends Synthetic_attributeReader with ConstantPoolBinding with AttributeBinding
Represents Java's Synthetic attribute.
-
trait
TypeAnnotationAttributesBinding extends TypeAnnotationsBinding with RuntimeInvisibleTypeAnnotations_attributeReader with RuntimeVisibleTypeAnnotations_attributeReader with AttributeBinding
Factory methods to create representations of the attributes related to Java type annotations.
-
trait
TypeAnnotationsBinding extends TypeAnnotationsReader with TypeAnnotationTargetReader with TypeAnnotationPathReader with AnnotationsBinding with AttributeBinding
Factory methods to create representations of Java type annotations.
-
trait
Unknown_attributeBinding extends Unknown_attributeReader with ConstantPoolBinding with AttributeBinding
"Factory" to create unknown attributes which are used to represent class file attributes that are not understood by this framework.
-
trait
UnpackedLineNumberTable_attributeBinding extends LineNumberTable_attributeReader with ConstantPoolBinding with AttributeBinding
Implements the factory methods to create line number tables and their entries.
Value Members
- final val ConfigKeyPrefix: String
-
def
read(args: Iterable[String], classFilesReader: (File, (Source, Throwable) ⇒ Unit) ⇒ Iterable[(ClassFile, URL)]): (Iterable[(ClassFile, URL)], List[Throwable])
Reads in all class files found in the jar files or jar and class files in the folders specified by
args.Reads in all class files found in the jar files or jar and class files in the folders specified by
args. The class files are read in using the specified class file reader. This enables, e.g., to use this method to only read in the public interface of a class file or to read in complete class files.- args
An
Iterableof file and folder names that refer to jar files or folders in which jar and class files are found.- classFilesReader
A function that – given a file (jar, folder, class file) – loads the respective class files and returns an
Iterable. The second parameter of the function is a function that should be called back by the reader whenever the processing of given file fails with an exception. This design was chosen to enable a reader of jar file to continue processing class files even if the processing of a class file failed.
- def readClassFiles(files: Iterable[File], classFilesReader: (File, (Source, Throwable) ⇒ Unit) ⇒ Iterable[(ClassFile, URL)], perFile: (File) ⇒ Unit = (f: File) ⇒ { /*do nothing*/ }): (Iterable[(ClassFile, URL)], List[Throwable])
-
def
readJREClassFiles(cache: BytecodeInstructionsCache = new BytecodeInstructionsCache)(implicit reader: ClassFileBinding = ..., logContext: LogContext = GlobalLogContext): Seq[(ClassFile, URL)]
Loads class files from JRE .jars found in the boot classpath.
Loads class files from JRE .jars found in the boot classpath.
- returns
List of class files ready to be passed to a
IndexBasedProject.
- def readRTJarClassFiles(cache: BytecodeInstructionsCache = new BytecodeInstructionsCache)(implicit reader: ClassFileBinding = ..., logContext: LogContext = GlobalLogContext): Traversable[(ClassFile, URL)]
- object BytecodeOptimizer
- object ClassFileBinding
- object ClassFileReaderConfiguration
- object InvokedynamicRewriting
- object Java7Framework extends Java7Framework
- object Java7LibraryFramework extends Java7LibraryFramework
- object Java8Framework extends Java8Framework
- object Java8LibraryFramework extends Java8LibraryFramework
- object Java9Framework extends Java9Framework
- object Java9LibraryFramework extends Java9LibraryFramework
-
object
SignatureParser
Parses Java class file signature strings.
Parses Java class file signature strings.
Thread-Safety
Using this object is thread-safe.