package reader
- Alphabetic
- By Inheritance
- reader
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
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 BootstrapArgumentLoading extends AnyRef
Provides functionality to produce bytecode that loads a bootstrap argument.
Provides functionality to produce bytecode that loads a bootstrap argument. Loading of dynamic constants is rewritten to not use ldc/ldc_w/ldc2_w instructions where possible.
- 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
if
that is actually a loop'sif
actually 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 DeferredDynamicConstantResolution extends ConstantPoolBinding with CodeBinding
Mixin this trait to resolve links between org.opalj.br.instructions.LDC instructions and the BootstrapMethodTable.
- 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 DynamicConstantRewriting extends DeferredDynamicConstantResolution with BootstrapArgumentLoading
Provides support for rewriting Java 11 dynamic constant loading instructions.
Provides support for rewriting Java 11 dynamic constant loading instructions. This trait should be mixed in alongside a BytecodeReaderAndBinding, which extracts basic dynamic constant information from the BootstrapMethodTable.
Specifically, whenever an
ldc
,ldc_w
orldc2_w
instruction is encountered that loads a dynamic constant, this trait tries to rewrite it to a simpler expression providing the same constant or an invocation of a method providing the constant from a lazily-initialized field.- Note
This rewriting is best-effort only. As
ldc
instructions take only two bytes, they cannot easily be rewritten to invocations, etc.ldc_w
andldc2_w
instructions, however, are rewritten more aggressively.- See also
Hands on Java 11's constantdynamic for further information.
- 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 with DeferredDynamicConstantResolution
- trait InvokedynamicRewriting extends DeferredInvokedynamicResolution with BootstrapArgumentLoading
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
invokedynamic
information from the BootstrapMethodTable.Specifically, whenever an
invokedynamic
instruction 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 theinvokedynamic
call 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 Java11Framework extends Java9Framework with Java11LibraryFramework
This configuration can be used to read in Java 11 (version 55) class files.
This configuration can be used to read in Java 11 (version 55) class files. All standard information (as defined in the Java Virtual Machine Specification) is represented.
- class Java11FrameworkWithCaching extends Java9FrameworkWithCaching with Java11LibraryFramework
This configuration can be used to read in Java 11 (version 55) class files.
This configuration can be used to read in Java 11 (version 55) class files. All standard information (as defined in the Java Virtual Machine Specification) is represented. Instructions will be cached.
- class Java11FrameworkWithDynamicRewritingAndCaching extends Java9FrameworkWithInvokedynamicSupportAndCaching with Java11LibraryFramework with DynamicConstantRewriting
This configuration can be used to read in Java 11 (version 55) class files with full support for rewriting
invokedynamic
instructions created by the JDK compiler for lambda and method reference expressions as well as opportunistic support for rewriting dynamic constants.This configuration can be used to read in Java 11 (version 55) class files with full support for rewriting
invokedynamic
instructions created by the JDK compiler for lambda and method reference expressions as well as opportunistic support for rewriting dynamic constants. All standard information (as defined in the Java Virtual Machine Specification) is represented. Instructions will be cached. - trait Java11LibraryFramework extends Java9LibraryFramework with NestHost_attributeBinding with NestMembers_attributeBinding
This configuration can be used to read in Java 11 (version 55) class files.
This configuration can be used to read in Java 11 (version 55) class files. All standard information (as defined in the Java Virtual Machine Specification) is represented except of method implementations.
- trait Java16Framework extends Java11Framework with Java16LibraryFramework
This configuration can be used to read in Java 1t (version 60) class files.
This configuration can be used to read in Java 1t (version 60) class files. All standard information (as defined in the Java Virtual Machine Specification) is represented.
- class Java16FrameworkWithCaching extends Java11FrameworkWithCaching with Java16LibraryFramework
This configuration can be used to read in Java 16 (version 60) class files.
This configuration can be used to read in Java 16 (version 60) class files. All standard information (as defined in the Java Virtual Machine Specification) is represented. Instructions will be cached.
- class Java16FrameworkWithDynamicRewritingAndCaching extends Java11FrameworkWithDynamicRewritingAndCaching with Java16LibraryFramework
This configuration can be used to read in Java 16 (version 60) class files with full support for rewriting
invokedynamic
instructions created by the JDK compiler for lambda and method reference expressions as well as opportunistic support for rewriting dynamic constants.This configuration can be used to read in Java 16 (version 60) class files with full support for rewriting
invokedynamic
instructions created by the JDK compiler for lambda and method reference expressions as well as opportunistic support for rewriting dynamic constants. All standard information (as defined in the Java Virtual Machine Specification) is represented. Instructions will be cached. - trait Java16LibraryFramework extends Java11LibraryFramework with Record_attributeBinding
This configuration can be used to read in Java 16 (version 60) class files.
This configuration can be used to read in Java 16 (version 60) class files. All standard information (as defined in the Java Virtual Machine Specification) is represented except of method implementations.
- trait Java17Framework extends Java16Framework with Java17LibraryFramework
This configuration can be used to read in Java 1t (version 60) class files.
This configuration can be used to read in Java 1t (version 60) class files. All standard information (as defined in the Java Virtual Machine Specification) is represented.
- class Java17FrameworkWithCaching extends Java16FrameworkWithCaching with Java17LibraryFramework
This configuration can be used to read in Java 17 (version 61) class files.
This configuration can be used to read in Java 17 (version 61) class files. All standard information (as defined in the Java Virtual Machine Specification) is represented. Instructions will be cached.
- class Java17FrameworkWithDynamicRewritingAndCaching extends Java16FrameworkWithDynamicRewritingAndCaching with Java17LibraryFramework
This configuration can be used to read in Java 17 (version 61) class files with full support for rewriting
invokedynamic
instructions created by the JDK compiler for lambda and method reference expressions as well as opportunistic support for rewriting dynamic constants.This configuration can be used to read in Java 17 (version 61) class files with full support for rewriting
invokedynamic
instructions created by the JDK compiler for lambda and method reference expressions as well as opportunistic support for rewriting dynamic constants. All standard information (as defined in the Java Virtual Machine Specification) is represented. Instructions will be cached. - trait Java17LibraryFramework extends Java16LibraryFramework with PermittedSubclasses_attributeBinding
This configuration can be used to read in Java 17 (version 61) class files.
This configuration can be used to read in Java 17 (version 61) class files. All standard information (as defined in the Java Virtual Machine Specification) is represented except of method implementations.
- 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
invokedynamic
instructions 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
invokedynamic
instructions 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 with full support for rewriting
invokedynamic
instructions created by the JDK compiler for lambda and method reference expressions.This configuration can be used to read in Java 9 (version 53) class files with full support for rewriting
invokedynamic
instructions created by the JDK 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 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
ModuleMainClass
attribute (Java 9). - trait ModulePackages_attributeBinding extends ModulePackages_attributeReader with ConstantPoolBinding with AttributeBinding
The factory method to create the
ModulePackages
attribute (Java 9). - trait Module_attributeBinding extends Module_attributeReader with ConstantPoolBinding with AttributeBinding
The factory method to create the "class level"
Module
attribute (Java 9). - trait NestHost_attributeBinding extends NestHost_attributeReader with ConstantPoolBinding with AttributeBinding
The factory method to create the
NestHost
attribute (Java 11). - trait NestMembers_attributeBinding extends NestMembers_attributeReader with ConstantPoolBinding with AttributeBinding
The factory method to create the
NestMembers
attribute (Java 11). - trait PermittedSubclasses_attributeBinding extends PermittedSubclasses_attributeReader with ConstantPoolBinding with AttributeBinding
Implements the factory methods to create the
PermittedSubclasses
attribute (Java 17). - trait Record_attributeBinding extends Record_attributeReader with ConstantPoolBinding with AttributeBinding
Implements the factory methods to create the
Record
attribute (Java 16). - 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("org.opalj.br.reader.")
- 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
Iterable
of 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 = new Java11FrameworkWithCaching(cache), 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 = new Java11FrameworkWithCaching(cache), logContext: LogContext = GlobalLogContext): Iterable[(ClassFile, URL)]
- object BytecodeOptimizer
- object ClassFileBinding
- object ClassFileReaderConfiguration
- object DynamicConstantRewriting
- object InvokedynamicRewriting
- object Java11Framework extends Java11Framework
- object Java11LibraryFramework extends Java11LibraryFramework
- object Java16Framework extends Java16Framework
- object Java16LibraryFramework extends Java16LibraryFramework
- object Java17Framework extends Java17Framework
- object Java17LibraryFramework extends Java17LibraryFramework
- 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.