Packages

p

org.opalj.br

reader

package reader

Defines convenience methods related to reading in class files.

Source
package.scala
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. reader
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

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

  2. trait AnnotationsBinding extends AnnotationsAbstractions with ElementValuePairsReader with ConstantPoolBinding

    Factory methods to create representations of Java annotations.

  3. trait AttributeBinding extends AttributesAbstractions

    Defines the common bindings for all "resolved" attributes.

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

  5. trait BootstrapMethods_attributeBinding extends BootstrapMethods_attributeReader with ConstantPoolBinding with AttributeBinding

    Final bindings and factory methods for the BoostrapMethods attribute.

  6. class BytecodeInstructionsCache extends AnyRef
  7. 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's if 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.

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

  9. 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.Instructions.

    Defines a method to parse an array of bytes (containing Java bytecode instructions) and to return an array of org.opalj.br.instructions.Instructions.

    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.

  10. trait ClassFileBinding extends ClassFileReader

  11. trait CodeAttributeBinding extends Code_attributeReader with ConstantPoolBinding with CodeBinding with AttributeBinding

    Binding for the code attribute.

  12. trait CodeBinding extends AnyRef

  13. trait CompactLineNumberTable_attributeBinding extends CompactLineNumberTable_attributeReader with ConstantPoolBinding with AttributeBinding

    Implements the factory methods to create line number tables.

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

  15. trait ConstantValue_attributeBinding extends ConstantValue_attributeReader with ConstantPoolBinding with AttributeBinding

  16. trait DeferredDynamicConstantResolution extends ConstantPoolBinding with CodeBinding

    Mixin this trait to resolve links between org.opalj.br.instructions.LDC instructions and the BootstrapMethodTable.

  17. trait DeferredInvokedynamicResolution extends ConstantPoolBinding with CodeBinding

    Mixin this trait to resolve links between org.opalj.br.instructions.INVOKEDYNAMIC instructions and the BootstrapMethodTable.

  18. trait Deprecated_attributeBinding extends Deprecated_attributeReader with ConstantPoolBinding with AttributeBinding

  19. 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 or ldc2_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 and ldc2_w instructions, however, are rewritten more aggressively.

    See also

    Hands on Java 11's constantdynamic for further information.

  20. trait EnclosingMethod_attributeBinding extends EnclosingMethod_attributeReader with ConstantPoolBinding with AttributeBinding

  21. trait Exceptions_attributeBinding extends Exceptions_attributeReader with ConstantPoolBinding with AttributeBinding

    The factory method to create a method's exception attribute.

  22. trait FieldsBinding extends FieldsReader

  23. trait InnerClasses_attributeBinding extends InnerClasses_attributeReader with ConstantPoolBinding with AttributeBinding

    The factory methods to create inner classes attributes and entries.

  24. trait InstructionsDeserializer extends DeferredInvokedynamicResolution with DeferredDynamicConstantResolution

  25. 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 the invokedynamic 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.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  44. 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.)

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

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

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

  48. trait LibraryClassFileBinding extends ClassFileBinding

    Default class file binding where all private fields and methods are not represented.

  49. trait LocalVariableTable_attributeBinding extends LocalVariableTable_attributeReader with ConstantPoolBinding with AttributeBinding

    The factory methods to create local variable tables and their entries.

  50. trait LocalVariableTypeTable_attributeBinding extends LocalVariableTypeTable_attributeReader with ConstantPoolBinding with AttributeBinding

    The factory methods to create local variable type tables and their entries.

  51. trait MethodParameters_attributeBinding extends MethodParameters_attributeReader with ConstantPoolBinding with AttributeBinding

    Implements the factory methods to create method parameter tables and their entries.

  52. trait MethodsBinding extends MethodsReader

  53. trait ModuleMainClass_attributeBinding extends ModuleMainClass_attributeReader with ConstantPoolBinding with AttributeBinding

    The factory method to create the ModuleMainClass attribute (Java 9).

  54. trait ModulePackages_attributeBinding extends ModulePackages_attributeReader with ConstantPoolBinding with AttributeBinding

    The factory method to create the ModulePackages attribute (Java 9).

  55. trait Module_attributeBinding extends Module_attributeReader with ConstantPoolBinding with AttributeBinding

    The factory method to create the "class level" Module attribute (Java 9).

  56. trait NestHost_attributeBinding extends NestHost_attributeReader with ConstantPoolBinding with AttributeBinding

    The factory method to create the NestHost attribute (Java 11).

  57. trait NestMembers_attributeBinding extends NestMembers_attributeReader with ConstantPoolBinding with AttributeBinding

    The factory method to create the NestMembers attribute (Java 11).

  58. trait PermittedSubclasses_attributeBinding extends PermittedSubclasses_attributeReader with ConstantPoolBinding with AttributeBinding

    Implements the factory methods to create the PermittedSubclasses attribute (Java 17).

  59. trait Record_attributeBinding extends Record_attributeReader with ConstantPoolBinding with AttributeBinding

    Implements the factory methods to create the Record attribute (Java 16).

  60. trait Signature_attributeBinding extends Signature_attributeReader with ConstantPoolBinding with AttributeBinding

    Implements the factory method defined and used by the generic signature attribute reader.

  61. type Source = AnyRef
  62. trait SourceDebugExtension_attributeBinding extends SourceDebugExtension_attributeReader with ConstantPoolBinding with AttributeBinding

    Provides the factory method to create a source debug extension attribute.

  63. trait SourceFile_attributeBinding extends SourceFile_attributeReader with ConstantPoolBinding with AttributeBinding

    The factory method to create the source file attribute.

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

  65. trait Synthetic_attributeBinding extends Synthetic_attributeReader with ConstantPoolBinding with AttributeBinding

    Represents Java's Synthetic attribute.

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

  67. trait TypeAnnotationsBinding extends TypeAnnotationsReader with TypeAnnotationTargetReader with TypeAnnotationPathReader with AnnotationsBinding with AttributeBinding

    Factory methods to create representations of Java type annotations.

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

  69. trait UnpackedLineNumberTable_attributeBinding extends LineNumberTable_attributeReader with ConstantPoolBinding with AttributeBinding

    Implements the factory methods to create line number tables and their entries.

Value Members

  1. final val ConfigKeyPrefix: String("org.opalj.br.reader.")
  2. 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.

  3. 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])
  4. 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.

  5. def readRTJarClassFiles(cache: BytecodeInstructionsCache = new BytecodeInstructionsCache)(implicit reader: ClassFileBinding = new Java11FrameworkWithCaching(cache), logContext: LogContext = GlobalLogContext): Iterable[(ClassFile, URL)]
  6. object BytecodeOptimizer
  7. object ClassFileBinding
  8. object ClassFileReaderConfiguration

  9. object DynamicConstantRewriting
  10. object InvokedynamicRewriting
  11. object Java11Framework extends Java11Framework
  12. object Java11LibraryFramework extends Java11LibraryFramework
  13. object Java16Framework extends Java16Framework
  14. object Java16LibraryFramework extends Java16LibraryFramework
  15. object Java17Framework extends Java17Framework
  16. object Java17LibraryFramework extends Java17LibraryFramework
  17. object Java7Framework extends Java7Framework
  18. object Java7LibraryFramework extends Java7LibraryFramework
  19. object Java8Framework extends Java8Framework
  20. object Java8LibraryFramework extends Java8LibraryFramework
  21. object Java9Framework extends Java9Framework
  22. object Java9LibraryFramework extends Java9LibraryFramework
  23. object SignatureParser

    Parses Java class file signature strings.

    Parses Java class file signature strings.

    Thread-Safety

    Using this object is thread-safe.

Inherited from AnyRef

Inherited from Any

Ungrouped