package bytecode
Defines functionality commonly useful when processing Java bytecode.
- Source
- package.scala
- Alphabetic
- By Inheritance
- bytecode
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- case class BytecodeProcessingFailedException(message: String) extends RuntimeException with Product with Serializable
Indicates that the processing of a class file failed.
Indicates that the processing of a class file failed. The reason is either a bug in the framework or in the class file.
- Note
The Eclipse Luna Java compiler does not generate valid class files in a few cases where type annotations are used in combination with try-with-resources statements.
,The Scala compiler - at least up to version 2.12.5 - sometimes generates invalid type signatures in the combination with parameterized value types.
- final type PC = Int
The program counter of an instruction.
The program counter of an instruction. A value in the range [0..65535].
Value Members
- lazy val JRELibraryFolder: File
Returns the most likely position of the JRE's library folder.
Returns the most likely position of the JRE's library folder. (I.e., the location in which the rt.jar file and the other jar files belonging to the Java runtime environment can be found). If the rt.jar cannot be found an exception is raised.
- def JVMInstructions: List[(Int, String)]
The list of all JVM instructions in the format: "<OPCODE><MNEMONIC>NewLine".
- def JVMOpcodes: BitSet
The set of all valid/used opcodes.
- lazy val RTJar: File
Returns the most likely position of the JAR/JMod that contains Java's main classes.
- def abbreviateType(definingTypeFQN: String, memberTypeFQN: String, pkgSeparatorChar: Int = '.'): String
Abbreviates the given
memberTypeFQN
by abbreviating the common packages (except of the last shared package) of both fully qualified type names using '…'.Abbreviates the given
memberTypeFQN
by abbreviating the common packages (except of the last shared package) of both fully qualified type names using '…'.- pkgSeparatorChar
If the given fully qualified type names are using Java notation (i.e., packages are separated using '.') then the parameter should be
'.'
, which is the default, otherwise the parameter should be'/'
.
scala> org.opalj.abbreviateType("a.b.T","a.T") // <= no abbrev. res: String = a.T scala> org.opalj.abbreviateType("a.b.T","a.b.T") res: String = …b.T scala> org.opalj.abbreviateType("a.b.c.T","a.b.c.T.X") res: String = …c.T.X
Example: - def commonPackage(fqnA: String, fqnB: String, pkgSeparatorChar: Int = '.'): Option[String]
Returns the package definitions shared by both fully qualified type names.
Returns the package definitions shared by both fully qualified type names. If both types do not define a common package
None
is returned.- pkgSeparatorChar
If the given fully qualified type names are using Java notation (i.e., packages are separated using '.') then the parameter should be
'.'
, which is the default, otherwise the parameter should be'/'
.
scala> org.opalj.commonPackage("a.b.T","a.c.T") res: Option[String] = Some(a.) scala> org.opalj.commonPackage("a.b.T","a.T") res: Option[String] = Some(a.) scala> org.opalj.commonPackage("a.b.T","a.b.T") res: Option[String] = Some(a.b.) scala> org.opalj.commonPackage("c.b.T","a.T") res: Option[String] = None scala> org.opalj.commonPackage("a.b.T","d.c.T") res: Option[String] = None
Example: