Packages

final class Code extends Attribute with CommonAttributes with InstructionsContainer with CodeSequence[Instruction] with Iterable[PCAndInstruction]

Representation of a method's code attribute, that is, representation of a method's implementation.

Self Type
Code
Source
Code.scala
Linear Supertypes
Iterable[PCAndInstruction], IterableFactoryDefaults[PCAndInstruction, Iterable], IterableOps[PCAndInstruction, Iterable, Iterable[PCAndInstruction]], IterableOnceOps[PCAndInstruction, Iterable, Iterable[PCAndInstruction]], IterableOnce[PCAndInstruction], CodeSequence[Instruction], InstructionsContainer, CommonAttributes, Attribute, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Code
  2. Iterable
  3. IterableFactoryDefaults
  4. IterableOps
  5. IterableOnceOps
  6. IterableOnce
  7. CodeSequence
  8. InstructionsContainer
  9. CommonAttributes
  10. Attribute
  11. AnyRef
  12. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ++[B >: PCAndInstruction](suffix: IterableOnce[B]): Iterable[B]
    Definition Classes
    IterableOps
    Annotations
    @inline()
  4. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  5. final def addString(b: StringBuilder): b.type
    Definition Classes
    IterableOnceOps
    Annotations
    @inline()
  6. final def addString(b: StringBuilder, sep: String): b.type
    Definition Classes
    IterableOnceOps
    Annotations
    @inline()
  7. def addString(b: StringBuilder, start: String, sep: String, end: String): b.type
    Definition Classes
    IterableOnceOps
  8. def alwaysResultsInException(pc: Int, cfJoins: IntTrieSet, anInvocation: (Int) => Boolean, aThrow: (Int) => Boolean): Boolean

    Tests if the straight-line sequence of instructions that starts with the given pc always ends with an ATHROW instruction or a method call that always throws an exception.

    Tests if the straight-line sequence of instructions that starts with the given pc always ends with an ATHROW instruction or a method call that always throws an exception. The call sequence furthermore has to contain no complex logic. Here, complex means that evaluating the instruction may result in multiple control flows. If the sequence contains complex logic, false will be returned.

    One use case of this method is, e.g., to check if the code of the default case of a switch instruction always throws some error (e.g., an UnknownError or AssertionError).

    switch(...) {
     case X : ....
     default :
         throw new AssertionError();
    }

    This is a typical idiom used in Java programs and which may be relevant for certain analyses to detect.

    pc

    The program counter of an instruction that strictly dominates all succeeding instructions up until the next instruction (as determined by #cfJoins where two or more paths join. If the pc belongs to an instruction where multiple paths join, false will be returned.

    anInvocation

    When the analysis finds a method call, it calls this method to let the caller decide whether the called method is an (indirect) way of always throwing an exception. If true is returned the analysis terminates and returns true; otherwise the analysis continues.

    aThrow

    If all (non-exception) paths will always end in one specific ATHROW instruction then this function is called (callback) to let the caller decide if the "expected" exception is thrown. This analysis will return with the result of this call.

    returns

    true if the bytecode sequence starting with the instruction with the given pc always ends with an org.opalj.br.instructions.ATHROW instruction. false in all other cases (i.e., the sequence does not end with an athrow instruction or the control flow is more complex.)

    Annotations
    @inline()
    Note

    If complex control flows should also be considered it is possible to compute a methods org.opalj.br.cfg.CFG and use that one.

  9. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  10. val attributes: Attributes
    Definition Classes
    CodeCommonAttributes
  11. def belongsToSubroutine(): Array[Int]

    Calculates for each instruction the subroutine to which it belongs to – if any.

    Calculates for each instruction the subroutine to which it belongs to – if any. This information is required to, e.g., identify the subroutine contexts that need to be reset in case of an exception in a subroutine.

    returns

    Basically a map that maps the pc of each instruction to the id of the subroutine. For each instruction (with a specific pc) the pc of the first instruction of the subroutine it belongs to is returned. The pc 0 identifies the instruction as belonging to the core method. The pc -1 identifies the instruction as dead by compilation.

    Note

    Calling this method only makes sense for Java bytecode that actually contains org.opalj.br.instructions.JSR and org.opalj.br.instructions.RET instructions.

  12. def cfJoins(implicit classHierarchy: ClassHierarchy = PreInitializedClassHierarchy): IntTrieSet

    Returns the set of all program counters where two or more control flow paths may join.

    Returns the set of all program counters where two or more control flow paths may join.

    Example

     0: iload_1
     1: ifgt    6
     2: iconst_1
     5: goto 10
     6: ...
     9: iload_1
    10: return // <= PATH JOIN: the predecessors are the instructions 5 and 9.

    In case of exception handlers the sound overapproximation is made that all exception handlers with a fitting type may be reached on multiple paths.

  13. def cfPCs(implicit classHierarchy: ClassHierarchy = PreInitializedClassHierarchy): (PCs, PCs, IntMap[PCs])

    Returns the set of all program counters where two or more control flow paths join or fork.

    Returns the set of all program counters where two or more control flow paths join or fork.

    Example

     0: iload_1
     1: ifgt    6 // <= PATH FORK
     2: iconst_1
     5: goto 10
     6: ...
     9: iload_1
    10: return // <= PATH JOIN: the predecessors are the instructions 5 and 9.

    In case of exception handlers the sound overapproximation is made that all exception handlers may be reached on multiple paths.

    returns

    A triple which contains (1) the set of pcs of those instructions where multiple control-flow paths join; (2) the pcs of the instructions which may result in multiple different control-flow paths and (3) for each of the later instructions the set of all potential targets.

  14. def className: String
    Attributes
    protected[this]
    Definition Classes
    Iterable
  15. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @IntrinsicCandidate()
  16. final def codeSize: Int
    Annotations
    @inline()
  17. final def coll: Code.this.type
    Attributes
    protected
    Definition Classes
    Iterable → IterableOps
  18. def collect[B <: AnyRef](f: PartialFunction[Instruction, B]): List[PCAndAnyRef[B]]

    Collects all instructions for which the given function is defined.

    Collects all instructions for which the given function is defined.

    Usage scenario

    Use this function if you want to search for and collect specific instructions and when you do not immediately require the program counter/index of the instruction in the instruction array to make the decision whether you want to collect the instruction.

    Examples

    Example usage to collect the declaring class of all get field accesses where the field name is "last".

    collect({
     case GETFIELD(declaringClass, "last", _) => declaringClass
    })

    Example usage to collect all instances of a "DUP" instruction.

    code.collect({ case dup @ DUP => dup })
    returns

    The result of applying the function f to all instructions for which f is defined combined with the index (program counter) of the instruction in the code array.

  19. def collect[B](pf: PartialFunction[PCAndInstruction, B]): Iterable[B]
    Definition Classes
    IterableOps → IterableOnceOps
  20. def collectFirst[B](pf: PartialFunction[PCAndInstruction, B]): Option[B]
    Definition Classes
    IterableOnceOps
  21. def collectFirstWithIndex[B](f: PartialFunction[PCAndInstruction, B]): Option[B]

    Applies the given function to the first instruction for which the given function is defined.

  22. def collectInstructions[B <: AnyRef](f: PartialFunction[Instruction, B]): List[B]

    Collects all instructions for which the given function is defined.

    Collects all instructions for which the given function is defined. The order in which the instructions are collected is reversed when compared to the order in the instructions array.

  23. def collectInstructionsWithPC[B <: AnyRef](f: PartialFunction[PCAndInstruction, B]): List[PCAndAnyRef[B]]

    Collects all instructions for which the given function is defined.

  24. def collectPair[B <: AnyRef](f: PartialFunction[(Instruction, Instruction), B]): List[PCAndAnyRef[B]]

    Finds a pair of consecutive instructions that are matched by the given partial function.

    Finds a pair of consecutive instructions that are matched by the given partial function.

    Example Usage

    (pc, _) <- body.findPair {
         case (
             INVOKESPECIAL(receiver1, _, SingleArgumentMethodDescriptor((paramType: BaseType, _))),
             INVOKEVIRTUAL(receiver2, name, NoArgumentMethodDescriptor(returnType: BaseType))
         ) if (...) => (...)
         } yield ...
  25. def collectUntil[B <: AnyRef](f: PartialFunction[PCAndInstruction, B]): PCAndAnyRef[List[B]]

    Collects the results of the evaluation of the partial function until the partial function is not defined.

    Collects the results of the evaluation of the partial function until the partial function is not defined.

    returns

    The program counter of the instruction for which the given partial function was not defined along with the list of previous results. The results are sorted in descending order w.r.t. the PC.

  26. def collectWithIndex[B](f: PartialFunction[PCAndInstruction, B])(implicit arg0: ClassTag[B]): List[B]

    Applies the given function f to all instruction objects for which the function is defined.

    Applies the given function f to all instruction objects for which the function is defined. The function is passed a tuple consisting of the current program counter/index in the code array and the corresponding instruction.

    Example

    Example usage to collect the program counters (indexes) of all instructions that are the target of a conditional branch instruction:

    code.collectWithIndex({
     case (pc, cbi: ConditionalBranchInstruction) =>
         Seq(cbi.indexOfNextInstruction(pc, code), pc + cbi.branchoffset)
     }) // .flatten should equal (Seq(...))
  27. def compareAttributes(other: Attributes, config: SimilarityTestConfiguration): Option[AnyRef]

    Compares this element's attributes with the given one.

    Compares this element's attributes with the given one.

    returns

    None, if both attribute lists are similar; Some(<description of the difference>) otherwise.

    Attributes
    protected[this]
    Definition Classes
    CommonAttributes
  28. def concat[B >: PCAndInstruction](suffix: IterableOnce[B]): Iterable[B]
    Definition Classes
    IterableOps
  29. def copy(maxStack: Int = this.maxStack, maxLocals: Int = this.maxLocals, instructions: Array[Instruction] = this.instructions, exceptionHandlers: ExceptionHandlers = this.exceptionHandlers, attributes: Attributes = this.attributes): Code
  30. def copyToArray[B >: PCAndInstruction](xs: Array[B], start: Int, len: Int): Int
    Definition Classes
    IterableOnceOps
  31. def copyToArray[B >: PCAndInstruction](xs: Array[B], start: Int): Int
    Definition Classes
    IterableOnceOps
    Annotations
    @deprecatedOverriding()
  32. def copyToArray[B >: PCAndInstruction](xs: Array[B]): Int
    Definition Classes
    IterableOnceOps
    Annotations
    @deprecatedOverriding()
  33. def corresponds[B](that: IterableOnce[B])(p: (PCAndInstruction, B) => Boolean): Boolean
    Definition Classes
    IterableOnceOps
  34. def count(p: (PCAndInstruction) => Boolean): Int
    Definition Classes
    IterableOnceOps
  35. def drop(n: Int): Iterable[PCAndInstruction]
    Definition Classes
    IterableOps → IterableOnceOps
  36. def dropRight(n: Int): Iterable[PCAndInstruction]
    Definition Classes
    IterableOps
  37. def dropWhile(p: (PCAndInstruction) => Boolean): Iterable[PCAndInstruction]
    Definition Classes
    IterableOps → IterableOnceOps
  38. def empty: Iterable[PCAndInstruction]
    Definition Classes
    IterableFactoryDefaults → IterableOps
  39. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  40. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  41. val exceptionHandlers: ExceptionHandlers
  42. def exceptionHandlersFor(pc: PC): List[ExceptionHandler]

    Returns a view of all potential exception handlers (if any) for the instruction with the given program counter (pc).

    Returns a view of all potential exception handlers (if any) for the instruction with the given program counter (pc). Finally handlers (catchType == None) are not returned but will stop the evaluation (as all further exception handlers have no further meaning w.r.t. the runtime)! In case of identical caught exceptions only the first of them will be returned. No further checks (w.r.t. the typehierarchy) are done.

    pc

    The program counter of an instruction of this Code array.

  43. def exists(p: (PCAndInstruction) => Boolean): Boolean
    Definition Classes
    IterableOnceOps
  44. def filter[B](f: (PC, Instruction) => Boolean): IntArraySet
  45. def filter(pred: (PCAndInstruction) => Boolean): Iterable[PCAndInstruction]
    Definition Classes
    IterableOps → IterableOnceOps
  46. def filterNot(pred: (PCAndInstruction) => Boolean): Iterable[PCAndInstruction]
    Definition Classes
    IterableOps → IterableOnceOps
  47. def find(p: (PCAndInstruction) => Boolean): Option[PCAndInstruction]
    Definition Classes
    IterableOnceOps
  48. def findSequence[B <: AnyRef](windowSize: Int)(f: PartialFunction[Queue[Instruction], B]): List[PCAndAnyRef[B]]

    Finds a sequence of instructions that are matched by the given partial function.

    Finds a sequence of instructions that are matched by the given partial function.

    returns

    List of pairs where the first element is the pc of the first instruction of a matched sequence and the second value is the result of the evaluation of the partial function.

    Note

    If possible, use one of the more specialized methods, such as, collectPair. The pure iteration overhead caused by this method is roughly 10-20 times higher than this one.

  49. def firstLineNumber: Option[Int]

    Returns the smallest line number (if any).

    Returns the smallest line number (if any).

    Note

    The line number associated with the first instruction (pc === 0) is not necessarily the smallest one.

    public void foo(int i) {
      super.foo( // The call has the smallest line number.
        i+=1; // THIS IS THE FIRST OPERATION...
      )
    }
  50. def flatMap[B](f: (PCAndInstruction) => IterableOnce[B]): Iterable[B]
    Definition Classes
    IterableOps → IterableOnceOps
  51. def flatten[B](implicit asIterable: (PCAndInstruction) => IterableOnce[B]): Iterable[B]
    Definition Classes
    IterableOps → IterableOnceOps
  52. def fold[A1 >: PCAndInstruction](z: A1)(op: (A1, A1) => A1): A1
    Definition Classes
    IterableOnceOps
  53. def foldLeft[T](start: T)(f: (T, Int, Instruction) => T): T
  54. def foldLeft[B](z: B)(op: (B, PCAndInstruction) => B): B
    Definition Classes
    IterableOnceOps
  55. def foldRight[B](z: B)(op: (PCAndInstruction, B) => B): B
    Definition Classes
    IterableOnceOps
  56. final def forall(f: (Int, Instruction) => Boolean): Boolean
    Annotations
    @inline()
  57. def forall(p: (PCAndInstruction) => Boolean): Boolean
    Definition Classes
    IterableOnceOps
  58. def foreach[U](f: (PCAndInstruction) => U): Unit
    Definition Classes
    IterableOnceOps
  59. final def foreachInstruction[U](f: (Instruction) => U): Unit

    Iterates over all instructions and calls the given function f for every instruction.

    Iterates over all instructions and calls the given function f for every instruction.

    Annotations
    @inline()
  60. final def foreachPC[U](f: (PC) => U): Unit

    Iterates over all instructions and calls the given function f for every instruction.

    Iterates over all instructions and calls the given function f for every instruction.

    Annotations
    @inline()
  61. def foreachProgramCounter[U](f: (Int) => U): Unit
  62. final def foreachTypeAnnotation[U](f: (TypeAnnotation) => U): Unit
    Definition Classes
    CommonAttributes
  63. def fromSpecific(coll: IterableOnce[PCAndInstruction]): Iterable[PCAndInstruction]
    Attributes
    protected
    Definition Classes
    IterableFactoryDefaults → IterableOps
  64. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  65. def groupBy[K](f: (PCAndInstruction) => K): Map[K, Iterable[PCAndInstruction]]
    Definition Classes
    IterableOps
  66. def groupMap[K, B](key: (PCAndInstruction) => K)(f: (PCAndInstruction) => B): Map[K, Iterable[B]]
    Definition Classes
    IterableOps
  67. def groupMapReduce[K, B](key: (PCAndInstruction) => K)(f: (PCAndInstruction) => B)(reduce: (B, B) => B): Map[K, B]
    Definition Classes
    IterableOps
  68. def grouped(size: Int): Iterator[Iterable[PCAndInstruction]]
    Definition Classes
    IterableOps
  69. def handlerInstructionsFor(pc: Int): List[Int]

    The list of pcs of those instructions that may handle an exception if the evaluation of the instruction with the given pc throws an exception.

    The list of pcs of those instructions that may handle an exception if the evaluation of the instruction with the given pc throws an exception.

    In case of multiple finally handlers only the first one will be returned and no further exception handlers will be returned. In case of identical caught exceptions only the first of them will be returned. No further checks (w.r.t. the type hierarchy) are done.

    If different exceptions are handled by the same handler, the corresponding pc is returned multiple times.

  70. def handlersFor(pc: Int, justExceptions: Boolean = false): List[ExceptionHandler]

    Returns a view of all handlers (exception and finally handlers) for the instruction with the given program counter (pc) that may catch an exception; as soon as a finally handler is found no further handlers will be returned!

    Returns a view of all handlers (exception and finally handlers) for the instruction with the given program counter (pc) that may catch an exception; as soon as a finally handler is found no further handlers will be returned!

    In case of multiple exception handlers that are identical (in particular in case of the finally handlers) only the first one is returned as that one is the one that will be used by the JVM at runtime. No further checks (w.r.t. the type hierarchy) are done.

    pc

    The program counter of an instruction of this Code array.

  71. def handlersForException(pc: Int, exception: ObjectType)(implicit classHierarchy: ClassHierarchy = ClassHierarchy.PreInitializedClassHierarchy): List[ExceptionHandler]

    Returns the handlers that may handle the given exception.

    Returns the handlers that may handle the given exception.

    The (known/given) type hierarchy is taken into account as well as the order between the exception handlers.

  72. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @IntrinsicCandidate()
  73. def haveSameLineNumber(firstPC: Int, secondPC: Int): Option[Boolean]

    Returns Some(true) if both pcs have the same line number.

    Returns Some(true) if both pcs have the same line number. If line number information is not available None is returned.

  74. def head: PCAndInstruction
    Definition Classes
    IterableOps
  75. def headOption: Option[PCAndInstruction]
    Definition Classes
    IterableOps
  76. def init: Iterable[PCAndInstruction]
    Definition Classes
    IterableOps
  77. def inits: Iterator[Iterable[PCAndInstruction]]
    Definition Classes
    IterableOps
  78. def instructionIterator: Iterator[Instruction]
  79. val instructions: Array[Instruction]
    Definition Classes
    CodeCodeSequence
  80. def instructionsCount: Int

    Counts the number of instructions.

    Counts the number of instructions.

    Note

    The number of instructions is always smaller or equal to the size of the code array.

    ,

    This operation has complexity O(n).

  81. def instructionsOption: Some[Array[Instruction]]
    Definition Classes
    CodeInstructionsContainer
  82. def isEmpty: Boolean
    Definition Classes
    IterableOnceOps
  83. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  84. def isModifiedByWide(pc: Int): Boolean

    True if the instruction with the given program counter is modified by wide.

    True if the instruction with the given program counter is modified by wide.

    pc

    A valid index in the code array.

    Annotations
    @inline()
  85. def isTraversableAgain: Boolean
    Definition Classes
    IterableOps → IterableOnceOps
  86. def iterableFactory: IterableFactory[Iterable]
    Definition Classes
    Iterable → IterableOps
  87. final def iterate[U](instructionType: InstructionMetaInformation)(f: (Int, Instruction) => U): Unit

    Iterates over all instructions with the given opcode and calls the given function f for every instruction.

    Iterates over all instructions with the given opcode and calls the given function f for every instruction.

    Annotations
    @inline()
  88. final def iterate[U](f: (Int, Instruction) => U): Unit

    Iterates over all instructions and calls the given function f for every instruction.

    Iterates over all instructions and calls the given function f for every instruction.

    Annotations
    @inline()
  89. def iterator: Iterator[PCAndInstruction]
    Definition Classes
    Code → IterableOnce
  90. def kindId: Int

    This attribute's kind id.

    This attribute's kind id.

    Definition Classes
    CodeAttribute
  91. def knownSize: Int
    Definition Classes
    IterableOnce
  92. def last: PCAndInstruction
    Definition Classes
    IterableOps
  93. def lastOption: Option[PCAndInstruction]
    Definition Classes
    IterableOps
  94. def lazyZip[B](that: Iterable[B]): LazyZip2[PCAndInstruction, B, Code.this.type]
    Definition Classes
    Iterable
  95. def lineNumber(pc: Int): Option[Int]

    Returns the line number associated with the instruction with the given pc if it is available.

    Returns the line number associated with the instruction with the given pc if it is available.

    pc

    Index of the instruction for which we want to get the line number.

    returns

    Some line number or None if no line-number information is available.

  96. def lineNumberTable: Option[LineNumberTable]

    Returns the line number table - if any.

    Returns the line number table - if any.

    Note

    A code attribute is allowed to have multiple line number tables. However, all tables are merged into one by OPAL at class loading time.

    ,

    Depending on the configuration of the reader for ClassFiles this attribute may not be reified.

  97. def liveVariables(predecessorPCs: Array[PCs], finalPCs: PCs, cfJoins: PCs): LiveVariables

    Performs a live variable analysis restricted to a method's locals.

    Performs a live variable analysis restricted to a method's locals.

    returns

    For each instruction (identified by its pc) the set of variables (register values) which are live (identified by their index) is determined. I.e., if you need to know if the variable with the index 5 is (still) live at instruction j with pc 37 it is sufficient to test if the bit set stored at index 37 contains the value 5.

  98. def liveVariables(implicit classHierarchy: ClassHierarchy): LiveVariables

    Computes for each instruction which variables are live; see liveVariables(predecessorPCs: Array[PCs], finalPCs: PCs, cfJoins: BitSet) for further details.

  99. def localVariable(pc: Int, index: Int): Option[LocalVariable]

    Returns the local variable stored at the given local variable index that is live at the given instruction (pc).

  100. def localVariableTable: Option[LocalVariables]

    Collects (the merged if necessary) local variable table.

    Collects (the merged if necessary) local variable table.

    Note

    A code attribute is allowed to have multiple local variable tables. However, all tables are merged into one by OPAL at class loading time.

    ,

    Depending on the configuration of the reader for ClassFiles this attribute may not be reified.

  101. def localVariableTypeTable: Iterable[LocalVariableTypes]

    Collects all local variable type tables.

    Collects all local variable type tables.

    Note

    Depending on the configuration of the reader for ClassFiles this attribute may not be reified.

  102. def localVariablesAt(pc: Int): Map[Int, LocalVariable]

    Returns the set of local variables defined at the given pc base on debug information.

    Returns the set of local variables defined at the given pc base on debug information.

    returns

    A mapping of the index to the name of the local variable. The map is empty if no debug information is available.

  103. def map[B](f: (PCAndInstruction) => B): Iterable[B]
    Definition Classes
    IterableOps → IterableOnceOps
  104. def matchPair(f: (Instruction, Instruction) => Boolean): List[Int]

    Matches pairs of two consecutive instructions.

    Matches pairs of two consecutive instructions. For each matched pair, the program counter of the first instruction is returned.

    Example Usage

    for {
     classFile <- project.view.map(_._1).par
     method @ MethodWithBody(body) <- classFile.methods
     pc <- body.matchPair({
         case (
             INVOKESPECIAL(receiver1, _, TheArgument(parameterType: BaseType)),
             INVOKEVIRTUAL(receiver2, name, NoArgumentMethodDescriptor(returnType: BaseType))
         ) => { (receiver1 eq receiver2) && (returnType ne parameterType) }
         case _ => false
         })
     } yield (classFile, method, pc)
  105. def matchTriple(matchMaxTriples: Int = Int.MaxValue, f: (Instruction, Instruction, Instruction) => Boolean): List[Int]

    Finds a sequence of 3 consecutive instructions for which the given function returns true, and returns the PC of the first instruction in each found sequence.

    Finds a sequence of 3 consecutive instructions for which the given function returns true, and returns the PC of the first instruction in each found sequence.

    matchMaxTriples

    Is the maximum number of triples that is passed to f. E.g., if matchMaxTriples is "1" only the first three instructions are passed to f.

  106. def matchTriple(f: (Instruction, Instruction, Instruction) => Boolean): List[Int]

    Finds all sequences of three consecutive instructions that are matched by f.

  107. def max[B >: PCAndInstruction](implicit ord: Ordering[B]): PCAndInstruction
    Definition Classes
    IterableOnceOps
  108. def maxBy[B](f: (PCAndInstruction) => B)(implicit cmp: Ordering[B]): PCAndInstruction
    Definition Classes
    IterableOnceOps
  109. def maxByOption[B](f: (PCAndInstruction) => B)(implicit cmp: Ordering[B]): Option[PCAndInstruction]
    Definition Classes
    IterableOnceOps
  110. val maxLocals: Int
  111. def maxOption[B >: PCAndInstruction](implicit ord: Ordering[B]): Option[PCAndInstruction]
    Definition Classes
    IterableOnceOps
  112. val maxStack: Int
  113. def min[B >: PCAndInstruction](implicit ord: Ordering[B]): PCAndInstruction
    Definition Classes
    IterableOnceOps
  114. def minBy[B](f: (PCAndInstruction) => B)(implicit cmp: Ordering[B]): PCAndInstruction
    Definition Classes
    IterableOnceOps
  115. def minByOption[B](f: (PCAndInstruction) => B)(implicit cmp: Ordering[B]): Option[PCAndInstruction]
    Definition Classes
    IterableOnceOps
  116. def minOption[B >: PCAndInstruction](implicit ord: Ordering[B]): Option[PCAndInstruction]
    Definition Classes
    IterableOnceOps
  117. final def mkString: String
    Definition Classes
    IterableOnceOps
    Annotations
    @inline()
  118. final def mkString(sep: String): String
    Definition Classes
    IterableOnceOps
    Annotations
    @inline()
  119. final def mkString(start: String, sep: String, end: String): String
    Definition Classes
    IterableOnceOps
  120. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  121. def newSpecificBuilder: Builder[PCAndInstruction, Iterable[PCAndInstruction]]
    Attributes
    protected
    Definition Classes
    IterableFactoryDefaults → IterableOps
  122. def nextNonGotoInstruction(pc: Int): Int

    Returns the next instruction that will be executed at runtime that is not a org.opalj.br.instructions.GotoInstruction.

    Returns the next instruction that will be executed at runtime that is not a org.opalj.br.instructions.GotoInstruction. If the given instruction is not a org.opalj.br.instructions.GotoInstruction, the given instruction is returned.

    Annotations
    @tailrec()
  123. def nonEmpty: Boolean
    Definition Classes
    IterableOnceOps
    Annotations
    @deprecatedOverriding()
  124. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  125. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @IntrinsicCandidate()
  126. def partition(p: (PCAndInstruction) => Boolean): (Iterable[PCAndInstruction], Iterable[PCAndInstruction])
    Definition Classes
    IterableOps
  127. def partitionMap[A1, A2](f: (PCAndInstruction) => Either[A1, A2]): (Iterable[A1], Iterable[A2])
    Definition Classes
    IterableOps
  128. final def pcOfNextInstruction(currentPC: Int): Int

    Returns the program counter of the next instruction after the instruction with the given counter (currentPC).

    Returns the program counter of the next instruction after the instruction with the given counter (currentPC).

    currentPC

    The program counter of an instruction. If currentPC is the program counter of the last instruction of the code block then the returned program counter will be equivalent to the length of the Code/Instructions array.

    Definition Classes
    CodeCodeSequence
    Annotations
    @inline()
  129. final def pcOfPreviousInstruction(currentPC: Int): Int

    Returns the program counter of the previous instruction in the code array.

    Returns the program counter of the previous instruction in the code array. currentPC must be the program counter of an instruction.

    This function is only defined if currentPC is larger than 0; i.e., if there is a previous instruction! If currentPC is larger than instructions.size the behavior is undefined.

    Definition Classes
    CodeCodeSequence
    Annotations
    @inline()
  130. def predecessorPCs(implicit classHierarchy: ClassHierarchy): (Array[PCs], PCs, PCs)

    Computes for each instruction the set of predecessor instructions as well as all instructions without predecessors.

    Computes for each instruction the set of predecessor instructions as well as all instructions without predecessors. Those instructions with multiple predecessors are also returned.

    returns

    (1) An array which contains for each instruction the set of all predecessors, (2) the set of all instructions which have only predecessors; i.e., no successors and (3) the set of all instructions where multiple paths join. ´(Array[PCs]/*PREDECESSOR_PCs*/, PCs/*FINAL_PCs*/, PCs/*CF_JOINS*/)´. Note, that in case of completely broken code, set 2 may contain other instructions than return and athrow instructions. If the code contains jsr/ret instructions, the full blown CFG is computed.

  131. def product[B >: PCAndInstruction](implicit num: Numeric[B]): B
    Definition Classes
    IterableOnceOps
  132. def programCounters: IntIterator

    Returns an iterator to iterate over the program counters (pcs) of the instructions of this Code block.

    Returns an iterator to iterate over the program counters (pcs) of the instructions of this Code block.

    See also

    See the method foreach for an alternative.

  133. def reduce[B >: PCAndInstruction](op: (B, B) => B): B
    Definition Classes
    IterableOnceOps
  134. def reduceLeft[B >: PCAndInstruction](op: (B, PCAndInstruction) => B): B
    Definition Classes
    IterableOnceOps
  135. def reduceLeftOption[B >: PCAndInstruction](op: (B, PCAndInstruction) => B): Option[B]
    Definition Classes
    IterableOnceOps
  136. def reduceOption[B >: PCAndInstruction](op: (B, B) => B): Option[B]
    Definition Classes
    IterableOnceOps
  137. def reduceRight[B >: PCAndInstruction](op: (PCAndInstruction, B) => B): B
    Definition Classes
    IterableOnceOps
  138. def reduceRightOption[B >: PCAndInstruction](op: (PCAndInstruction, B) => B): Option[B]
    Definition Classes
    IterableOnceOps
  139. def reversed: Iterable[PCAndInstruction]
    Attributes
    protected
    Definition Classes
    IterableOnceOps
  140. def runtimeInvisibleTypeAnnotations: TypeAnnotations
    Definition Classes
    CommonAttributes
  141. def runtimeVisibleTypeAnnotations: TypeAnnotations
    Definition Classes
    CommonAttributes
  142. def scan[B >: PCAndInstruction](z: B)(op: (B, B) => B): Iterable[B]
    Definition Classes
    IterableOps
  143. def scanLeft[B](z: B)(op: (B, PCAndInstruction) => B): Iterable[B]
    Definition Classes
    IterableOps → IterableOnceOps
  144. def scanRight[B](z: B)(op: (PCAndInstruction, B) => B): Iterable[B]
    Definition Classes
    IterableOps
  145. def similar(other: Code, config: SimilarityTestConfiguration): Boolean
  146. def similar(other: Attribute, config: SimilarityTestConfiguration): Boolean

    Returns true if this attribute and the given one are guaranteed to be indistinguishable at runtime.

    Returns true if this attribute and the given one are guaranteed to be indistinguishable at runtime.

    Definition Classes
    CodeAttribute
    Note

    If this class is implemented as a proper case class, this method can often be implemented by forwarding to the default equals method.

  147. def size: Int
    Definition Classes
    IterableOnceOps
  148. def sizeCompare(that: Iterable[_]): Int
    Definition Classes
    IterableOps
  149. def sizeCompare(otherSize: Int): Int
    Definition Classes
    IterableOps
  150. final def sizeIs: SizeCompareOps
    Definition Classes
    IterableOps
    Annotations
    @inline()
  151. def slice(from: Int, until: Int): Iterable[PCAndInstruction]
    Definition Classes
    IterableOps → IterableOnceOps
  152. def sliding(size: Int, step: Int): Iterator[Iterable[PCAndInstruction]]
    Definition Classes
    IterableOps
  153. def sliding(size: Int): Iterator[Iterable[PCAndInstruction]]
    Definition Classes
    IterableOps
  154. def slidingCollect[B <: AnyRef](windowSize: Int)(f: PartialFunction[PCAndAnyRef[Queue[Instruction]], B]): List[B]

    Slides over the code array and tries to apply the given function to each sequence of instructions consisting of windowSize elements.

    Slides over the code array and tries to apply the given function to each sequence of instructions consisting of windowSize elements.

    Scenario

    If you want to search for specific patterns of bytecode instructions. Some "bug patterns" are directly related to specific bytecode sequences and these patterns can easily be identified using this method.

    Example

    Search for sequences of the bytecode instructions PUTFIELD and ALOAD_O in the method's body and return the list of program counters of the start of the identified sequences.

    code.slidingCollect(2)({
         case (pc, Seq(PUTFIELD(_, _, _), ALOAD_0)) => (pc)
    }) should be(Seq(...))
    windowSize

    The size of the sequence of instructions that is passed to the partial function. It must be larger than 0. **Do not use this method with windowSize "1"**; it is more efficient to use the collect or collectWithIndex methods instead.

    returns

    The list of results of applying the function f for each matching sequence.

    Note

    If possible, use one of the more specialized methods, such as, collectPair. The pure iteration overhead caused by this method is roughly 10-20 times higher than this one.

  155. def span(p: (PCAndInstruction) => Boolean): (Iterable[PCAndInstruction], Iterable[PCAndInstruction])
    Definition Classes
    IterableOps → IterableOnceOps
  156. def splitAt(n: Int): (Iterable[PCAndInstruction], Iterable[PCAndInstruction])
    Definition Classes
    IterableOps → IterableOnceOps
  157. def stackDepthAt(atPC: Int, cfg: CFG[Instruction, Code]): Int

    Computes the stack depth for the instruction with the given pc (atPC).

    Computes the stack depth for the instruction with the given pc (atPC). I.e, computes the stack depth before executing the instruction! This function is intended to be used if and only if the stack depth is only required for a single instruction; it recomputes the stack depth for all instructions whenever the function is called.

    returns

    the stack depth or -1 if the instruction is invalid/dead.

    Annotations
    @throws("if it is impossible to compute the maximum height of the stack")
    Note

    If the CFG is already available, it should be passed as the computation is potentially the most expensive part.

  158. def stackDepthAt(atPC: Int, classHierarchy: ClassHierarchy = ClassHierarchy.PreInitializedClassHierarchy): Int
    Annotations
    @throws("if it is impossible to compute the maximum height of the stack")
  159. def stackMapTable: Option[StackMapTable]

    The JVM specification mandates that a Code attribute has at most one StackMapTable attribute.

    The JVM specification mandates that a Code attribute has at most one StackMapTable attribute.

    Note

    Depending on the configuration of the reader for ClassFiles this attribute may not be reified.

  160. def stackMapTablePCs(implicit classHierarchy: ClassHierarchy): IntArraySet

    Computes the set of PCs for which a stack map frame is required.

    Computes the set of PCs for which a stack map frame is required. Calling this method (i.e., the generation of stack map tables in general) is only defined for Java > 5 code; i.e., cocde which does not use JSR/RET; therefore the behavior for Java 5 or earlier code is deliberately undefined.

    classHierarchy

    The computation of the stack map table generally requires the presence of a complete type hierarchy.

    returns

    The sorted set of PCs for which a stack map frame is required.

  161. def stepper[S <: Stepper[_]](implicit shape: StepperShape[PCAndInstruction, S]): S
    Definition Classes
    IterableOnce
  162. def stringPrefix: String
    Attributes
    protected[this]
    Definition Classes
    Iterable
    Annotations
    @deprecatedOverriding()
  163. def sum[B >: PCAndInstruction](implicit num: Numeric[B]): B
    Definition Classes
    IterableOnceOps
  164. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  165. def tail: Iterable[PCAndInstruction]
    Definition Classes
    IterableOps
  166. def tails: Iterator[Iterable[PCAndInstruction]]
    Definition Classes
    IterableOps
  167. def take(n: Int): Iterable[PCAndInstruction]
    Definition Classes
    IterableOps → IterableOnceOps
  168. def takeRight(n: Int): Iterable[PCAndInstruction]
    Definition Classes
    IterableOps
  169. def takeWhile(p: (PCAndInstruction) => Boolean): Iterable[PCAndInstruction]
    Definition Classes
    IterableOps → IterableOnceOps
  170. def tapEach[U](f: (PCAndInstruction) => U): Iterable[PCAndInstruction]
    Definition Classes
    IterableOps → IterableOnceOps
  171. def to[C1](factory: Factory[PCAndInstruction, C1]): C1
    Definition Classes
    IterableOnceOps
  172. def toArray[B >: PCAndInstruction](implicit arg0: ClassTag[B]): Array[B]
    Definition Classes
    IterableOnceOps
  173. final def toBuffer[B >: PCAndInstruction]: Buffer[B]
    Definition Classes
    IterableOnceOps
    Annotations
    @inline()
  174. def toIndexedSeq: IndexedSeq[PCAndInstruction]
    Definition Classes
    IterableOnceOps
  175. def toList: List[PCAndInstruction]
    Definition Classes
    IterableOnceOps
  176. def toMap[K, V](implicit ev: <:<[PCAndInstruction, (K, V)]): Map[K, V]
    Definition Classes
    IterableOnceOps
  177. def toSeq: Seq[PCAndInstruction]
    Definition Classes
    IterableOnceOps
  178. def toSet[B >: PCAndInstruction]: Set[B]
    Definition Classes
    IterableOnceOps
  179. def toString(): String

    A complete representation of this code attribute (including instructions, attributes, etc.).

    A complete representation of this code attribute (including instructions, attributes, etc.).

    Definition Classes
    Code → Iterable → AnyRef → Any
  180. def toVector: Vector[PCAndInstruction]
    Definition Classes
    IterableOnceOps
  181. def transpose[B](implicit asIterable: (PCAndInstruction) => Iterable[B]): Iterable[Iterable[B]]
    Definition Classes
    IterableOps
  182. def unzip[A1, A2](implicit asPair: (PCAndInstruction) => (A1, A2)): (Iterable[A1], Iterable[A2])
    Definition Classes
    IterableOps
  183. def unzip3[A1, A2, A3](implicit asTriple: (PCAndInstruction) => (A1, A2, A3)): (Iterable[A1], Iterable[A2], Iterable[A3])
    Definition Classes
    IterableOps
  184. def view: View[PCAndInstruction]
    Definition Classes
    IterableOps
  185. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  186. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  187. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  188. def withFilter(p: (PCAndInstruction) => Boolean): WithFilter[PCAndInstruction, Iterable]
    Definition Classes
    IterableOps
  189. def zip[B](that: IterableOnce[B]): Iterable[(PCAndInstruction, B)]
    Definition Classes
    IterableOps
  190. def zipAll[A1 >: PCAndInstruction, B](that: Iterable[B], thisElem: A1, thatElem: B): Iterable[(A1, B)]
    Definition Classes
    IterableOps
  191. def zipWithIndex: Iterable[(PCAndInstruction, Int)]
    Definition Classes
    IterableOps → IterableOnceOps

Deprecated Value Members

  1. def ++:[B >: PCAndInstruction](that: IterableOnce[B]): Iterable[B]
    Definition Classes
    IterableOps
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.0) Use ++ instead of ++: for collections of type Iterable

  2. final def /:[B](z: B)(op: (B, PCAndInstruction) => B): B
    Definition Classes
    IterableOnceOps
    Annotations
    @deprecated @inline()
    Deprecated

    (Since version 2.13.0) Use foldLeft instead of /:

  3. final def :\[B](z: B)(op: (PCAndInstruction, B) => B): B
    Definition Classes
    IterableOnceOps
    Annotations
    @deprecated @inline()
    Deprecated

    (Since version 2.13.0) Use foldRight instead of :\

  4. def aggregate[B](z: => B)(seqop: (B, PCAndInstruction) => B, combop: (B, B) => B): B
    Definition Classes
    IterableOnceOps
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.0) aggregate is not relevant for sequential collections. Use foldLeft(z)(seqop) instead.

  5. def companion: IterableFactory[Iterable]
    Definition Classes
    IterableOps
    Annotations
    @deprecated @deprecatedOverriding() @inline()
    Deprecated

    (Since version 2.13.0) Use iterableFactory instead

  6. final def copyToBuffer[B >: PCAndInstruction](dest: Buffer[B]): Unit
    Definition Classes
    IterableOnceOps
    Annotations
    @deprecated @inline()
    Deprecated

    (Since version 2.13.0) Use dest ++= coll instead

  7. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated
  8. def hasDefiniteSize: Boolean
    Definition Classes
    IterableOnceOps
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.0) Check .knownSize instead of .hasDefiniteSize for more actionable information (see scaladoc for details)

  9. final def repr: Iterable[PCAndInstruction]
    Definition Classes
    IterableOps
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.0) Use coll instead of repr in a collection implementation, use the collection value itself from the outside

  10. def seq: Code.this.type
    Definition Classes
    Iterable
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.0) Iterable.seq always returns the iterable itself

  11. final def toIterable: Code.this.type
    Definition Classes
    Iterable → IterableOps
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.7) toIterable is internal and will be made protected; its name is similar to toList or toSeq, but it doesn't copy non-immutable collections

  12. final def toIterator: Iterator[PCAndInstruction]
    Definition Classes
    IterableOnceOps
    Annotations
    @deprecated @inline()
    Deprecated

    (Since version 2.13.0) Use .iterator instead of .toIterator

  13. final def toStream: Stream[PCAndInstruction]
    Definition Classes
    IterableOnceOps
    Annotations
    @deprecated @inline()
    Deprecated

    (Since version 2.13.0) Use .to(LazyList) instead of .toStream

  14. final def toTraversable: Traversable[PCAndInstruction]
    Definition Classes
    IterableOps
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.0) toTraversable is internal and will be made protected; its name is similar to toList or toSeq, but it doesn't copy non-immutable collections

  15. def view(from: Int, until: Int): View[PCAndInstruction]
    Definition Classes
    IterableOps
    Annotations
    @deprecated
    Deprecated

    (Since version 2.13.0) Use .view.slice(from, until) instead of .view(from, until)

Inherited from Iterable[PCAndInstruction]

Inherited from IterableFactoryDefaults[PCAndInstruction, Iterable]

Inherited from IterableOps[PCAndInstruction, Iterable, Iterable[PCAndInstruction]]

Inherited from IterableOnceOps[PCAndInstruction, Iterable, Iterable[PCAndInstruction]]

Inherited from IterableOnce[PCAndInstruction]

Inherited from CodeSequence[Instruction]

Inherited from InstructionsContainer

Inherited from CommonAttributes

Inherited from Attribute

Inherited from AnyRef

Inherited from Any

Ungrouped