package ba
Implementation of an eDSL for creating Java bytecode. The eDSL is designed to facilitate
the creation of correct class files; i.e., whenever possible it tries to fill wholes. For
example, when an interface is specified the library automatically ensures that the super
class type is (initially) set to java.lang.Object
as required by the JVM specification.
This package in particular provides functionality to convert org.opalj.br classes to org.opalj.da classes.
- Source
- package.scala
- Alphabetic
- By Inheritance
- ba
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- final class AccessModifier extends AnyVal
Represents the access flags of a class (module), method or field declaration.
Represents the access flags of a class (module), method or field declaration.
All standard access flags are predefined.
To create a class file's, a field's or a method's access modifier, you can chain them using post fix notation, e.g.:
PUBLIC FINAL
or you just append the using '.', e.g.:
PUBLIC.FINAL.SYNTHETIC.VARARGS
Example: - case class AnnotatedInstructionElement[+T](instruction: LabeledInstruction, annotation: T) extends InstructionLikeElement[T] with Product with Serializable
Wrapper for annotated org.opalj.br.instructions.LabeledInstructions.
- implicit final class BRConstantsBuffer extends AnyVal
- case class CATCH(id: Symbol, position: Int, handlerType: Option[ObjectType] = None) extends PseudoInstruction with ExceptionHandlerElement with Product with Serializable
Pseudo instruction marking the handler of a org.opalj.br.ExceptionHandler.
Pseudo instruction marking the handler of a org.opalj.br.ExceptionHandler.
- position
The (relative) position in the final exception handler table. The
CATCH
with the lowest position will be the first exception handler (the handler with the highest priority). Overall the order is just used to sort the handlers and nothing more. The sorting is stable - i.e., two handlers with the same number will end up in the same order in the table. Furthermore, it is possible to use negative numbers to ensure that a (custom) handler has precedence over all handlers found in the initial code; the initial handlers will have ids in the range [0...(number of exception handler)).- handlerType
The type of the handled exception or
None
if all exceptions are handled (finally handler).
- See also
- class CLASS[T] extends AnyRef
Builder for org.opalj.br.ClassFile objects.
- class CodeAttributeBuilder[T] extends br.CodeAttributeBuilder[(Map[PC, T], List[String])]
Builder for the org.opalj.br.Code attribute with all its properties.
Builder for the org.opalj.br.Code attribute with all its properties. The Builder is created using the CODE factory.
The
max_stack
andmax_locals
values will be calculated if not explicitly defined. - trait CodeElement[+T] extends AnyRef
Wrapper for elements that will generate the instructions and attributes of a org.opalj.br.Code and the annotations of the bytecode.
Wrapper for elements that will generate the instructions and attributes of a org.opalj.br.Code and the annotations of the bytecode.
- T
The type of the annotations of instructions.
- case class EXCEPTIONS(exceptionTypes: String*) extends MethodAttributeBuilder with Product with Serializable
Builder for the org.opalj.br.ExceptionTable attribute.
- trait ExceptionHandlerElement extends PseudoInstruction
Pseudo instructions which generate the org.opalj.br.ExceptionHandler of the org.opalj.br.Code attribute.
Pseudo instructions which generate the org.opalj.br.ExceptionHandler of the org.opalj.br.Code attribute. An ExceptionHandler is composed of the three pseudo instructions TRY, TRYEND and CATCH with the same identifier symbol. The exceptionHandler includes all instructions between TRY and TRYEND. The
handlerPC
is the pc of the instruction following the CATCH. If the label contains numbers at the end, the ExceptionHandlers are sorted ascending by that number in the ExceptionHandlerTable. Otherwise, the ExceptionHandlers are lexically sorted by their label. - class ExceptionHandlerTableBuilder extends AnyRef
Incrementally builds the org.opalj.br.ExceptionHandlers from the added pseudo instructions (ExceptionHandlerElement) representing an org.opalj.br.ExceptionHandler.
- case class FIELD(accessModifiers: AccessModifier, name: String, descriptor: String, attributesBuilders: ArraySeq[FieldAttributeBuilder] = ArraySeq.empty) extends Product with Serializable
Builder for a org.opalj.br.Field; a
FIELD
object is intended to be stored in a org.opalj.ba.FIELDS collection. - case class FIELDS(fields: FIELD*) extends Product with Serializable
Builder for a sequence of org.opalj.br.Fields.
- case class InstructionElement(instruction: LabeledInstruction) extends InstructionLikeElement[Nothing] with Product with Serializable
Wrapper for org.opalj.br.instructions.LabeledInstructions.
- sealed abstract class InstructionLikeElement[+T] extends CodeElement[T]
Represents an (annotated) labeled instruction.
- case class LINENUMBER(lineNumber: Int) extends PseudoInstruction with Product with Serializable
Pseudo instruction that generates an entry in the org.opalj.br.LineNumberTable with the program counter of the following instruction.
- case class LabelElement(label: InstructionLabel) extends PseudoInstruction with Product with Serializable
Wrapper for
InstructionLabel
s representing branch targets. - class LabeledCode extends AnyRef
Mutable container for some labeled code.
Mutable container for some labeled code. We will use org.opalj.br.instructions.PCLabel labels for those labels which were created based on the original code. This enables the computation ofa mapping from old pcs to new pcs.
- Note
Using
LabeledCode
is NOT thread safe.
- class LineNumberTableBuilder extends AnyRef
Used to incrementally build the org.opalj.br.UnpackedLineNumberTable.
- class METHOD[T] extends AnyRef
Builder for a org.opalj.br.MethodTemplate.
- case class METHODS[T](methods: ArraySeq[METHOD[T]]) extends Product with Serializable
Builder for a list of org.opalj.br.MethodTemplates.
- class PCMapping extends (Int) => Int
Mapping of some pc to some new pc.
Mapping of some pc to some new pc. If no mapping exists, Int.MaxValue == PCMapping.Invalid is returned.
- class ProjectBasedInMemoryClassLoader extends ClassLoader
A simple
ClassLoader
that looks-up the available classes from the given org.opalj.br.analyses.Project. - abstract class PseudoInstruction extends CodeElement[Nothing]
Marker trait for labels (
scala.Symbol
) and pseudo instructions generatingCode
attributes. - case class TRY(id: Symbol) extends PseudoInstruction with ExceptionHandlerElement with Product with Serializable
Pseudo instruction marking the start of a org.opalj.br.ExceptionHandler.
Pseudo instruction marking the start of a org.opalj.br.ExceptionHandler.
- See also
- case class TRYEND(id: Symbol) extends PseudoInstruction with ExceptionHandlerElement with Product with Serializable
Pseudo instruction marking the end of a org.opalj.br.ExceptionHandler.
Pseudo instruction marking the end of a org.opalj.br.ExceptionHandler.
- See also
- case class ToDAConfig(retainOPALAttributes: Boolean = false, retainUnknownAttributes: Boolean = false) extends Product with Serializable
Configures how specific kinds of attributes are handled during the serialization process.
Value Members
- final val ABSTRACT: AccessModifier
- final val ANNOTATION: AccessModifier
- final val BRIDGE: AccessModifier
- final val ENUM: AccessModifier
- final val FINAL: AccessModifier
- final val FrameworkName: String("OPAL Bytecode Assembler")
- final val INTERFACE: AccessModifier
- final val MANDATED: AccessModifier
- final val MODULE: AccessModifier
- final val NATIVE: AccessModifier
- final val OPEN: AccessModifier
- final val PRIVATE: AccessModifier
- final val PROTECTED: AccessModifier
- final val PUBLIC: AccessModifier
- final val STATIC: AccessModifier
- final val STATIC_PHASE: AccessModifier
- final val STRICT: AccessModifier
- final val SUPER: AccessModifier
- final val SYNCHRONIZED: AccessModifier
- final val SYNTHETIC: AccessModifier
- final val TRANSIENT: AccessModifier
- final val TRANSITIVE: AccessModifier
- final val VARARGS: AccessModifier
- final val VOLATILE: AccessModifier
- implicit def attributeToClassFileAttributeBuilder(a: Attribute): ClassFileAttributeBuilder
- implicit def attributeToFieldAttributeBuilder(a: Attribute): FieldAttributeBuilder
- implicit def attributeToMethodAttributeBuilder(a: Attribute): MethodAttributeBuilder
- implicit def codeAttributeBuilderToSome[T](b: br.CodeAttributeBuilder[T]): Some[br.CodeAttributeBuilder[T]]
- def createBoostrapMethodTableAttribute(constantsPool: ConstantsPool): Attribute
- implicit def methodAttributeBuilderToSeq(b: MethodAttributeBuilder): Seq[MethodAttributeBuilder]
- def toDA(constantPool: Array[Constant_Pool_Entry]): Array[Constant_Pool_Entry]
- def toDA(attribute: Attribute)(implicit constantsBuffer: ConstantsBuffer, config: ToDAConfig): Option[Attribute]
Converts the given org.opalj.br.Attribute to a org.opalj.da.Attribute using the given configuration.
Converts the given org.opalj.br.Attribute to a org.opalj.da.Attribute using the given configuration.
- See also
org.opalj.br.Attribute#kindId for the list of all supported attributes.
- def toDA(typeAnnotation: TypeAnnotation)(implicit constantsBuffer: ConstantsBuffer, config: ToDAConfig): TypeAnnotation
- def toDA(typeAnnotationPath: TypeAnnotationPath): TypeAnnotationPath
- def toDA(typeAnnotationPathElement: TypeAnnotationPathElement): TypeAnnotationPathElement
- def toDA(typeAnnotationTarget: TypeAnnotationTarget): TypeAnnotationTarget
- def toDA(localvarTableEntry: LocalvarTableEntry): LocalvarTableEntry
- def toDA(annotation: Annotation)(implicit constantsBuffer: ConstantsBuffer, config: ToDAConfig): Annotation
- def toDA(elementValue: ElementValue)(implicit constantsBuffer: ConstantsBuffer, config: ToDAConfig): ElementValue
- def toDA(exceptionHandler: ExceptionHandler)(implicit constantsBuffer: ConstantsBuffer): ExceptionTableEntry
- def toDA(code: Code)(implicit constantsBuffer: ConstantsBuffer, config: ToDAConfig): Code_attribute
- def toDA(method: Method)(implicit constantsBuffer: ConstantsBuffer, config: ToDAConfig): Method_Info
- def toDA(field: Field)(implicit constantsBuffer: ConstantsBuffer, config: ToDAConfig): Field_Info
- def toDA(classFile: ClassFile)(implicit toDAConfig: ToDAConfig = ToDAConfig.RetainAllAttributes): ClassFile
Converts a org.opalj.br.ClassFile to a org.opalj.da.ClassFile and all its attributes to the attributes in org.opalj.da.
- object AnnotatedInstructionElement extends Serializable
- object CATCH extends Serializable
Factory methods to create an CATCH pseudo instruction.
- object CLASS
- object CODE
Factory to create an initial CodeAttributeBuilder.
- object CodeAttributeBuilder
- object CodeElement
Implicit conversions to CodeElement.
- object InsertionPosition extends Enumeration
- object InstructionLikeElement
- object LabeledCode
- object METHOD
- object METHODS extends Serializable
- object PCMapping
- object ToDAConfig extends Serializable