Top Description Inners Fields Constructors Methods
org.apache.bcel.verifier.structurals

public final Class Pass3bVerifier

extends PassVerifier
Class Inheritance
Imports
java.io.PrintWriter, .StringWriter, java.util.ArrayList, .List, .Random, .Vector, org.apache.bcel.Const, .Repository, org.apache.bcel.classfile.JavaClass, .Method, org.apache.bcel.generic.ConstantPoolGen, .InstructionHandle, .JsrInstruction, .MethodGen, .ObjectType, .RET, .ReferenceType, .ReturnInstruction, .ReturnaddressType, .Type, org.apache.bcel.verifier.PassVerifier, .VerificationResult, .Verifier, org.apache.bcel.verifier.exc.AssertionViolatedException, .StructuralCodeConstraintException, .VerifierConstraintViolatedException

This PassVerifier verifies a method of class file according to pass 3, so-called structural verification as described in The Java Virtual Machine Specification, 2nd edition. More detailed information is to be found at the do_verify() method's documentation.
See Also
do_verify()

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
Pass3bVerifier.InstructionContextQueue

An InstructionContextQueue is a utility class that holds (InstructionContext, ArrayList) pairs in a Queue data structure.

Field Summary

Modifier and TypeField and Description
private static final boolean
DEBUG

In DEBUG mode, the verification algorithm is not randomized.

private final int
methodNo

The method number to verify.

private final Verifier
myOwner

The Verifier that created this.

Constructor Summary

AccessConstructor and Description
public
Pass3bVerifier(final Verifier myOwner, final int methodNo)

This class should only be instantiated by a Verifier.

Method Summary

Modifier and TypeMethod and Description
private void
circulationPump(final MethodGen m, final ControlFlowGraph cfg, final InstructionContext start, final Frame vanillaFrame, final InstConstraintVisitor icv, final ExecutionVisitor ev)

Whenever the outgoing frame situation of an InstructionContext changes, all its successors are put [back] into the queue [as if they were unvisited].

public VerificationResult
do_verify()

Implements abstract org.apache.bcel.verifier.PassVerifier.do_verify.

Pass 3b implements the data flow analysis as described in the Java Virtual Machine Specification, Second Edition.
public int
getMethodNo()

Returns the method number as supplied when instantiating.

public void
invalidReturnTypeError(final Type
the type of the returned expression
returnedType
,
final MethodGen
the method we are processing
m
)

Throws an exception indicating the returned type is not compatible with the return type of the given method.

Inherited from org.apache.bcel.verifier.PassVerifier:
addMessagegetMessagesgetMessagesListverify

Field Detail

DEBUGback to summary
private static final boolean DEBUG

In DEBUG mode, the verification algorithm is not randomized.

methodNoback to summary
private final int methodNo

The method number to verify.

myOwnerback to summary
private final Verifier myOwner

The Verifier that created this.

Constructor Detail

Pass3bVerifierback to summary
public Pass3bVerifier(final Verifier myOwner, final int methodNo)

This class should only be instantiated by a Verifier.

See Also
org.apache.bcel.verifier.Verifier

Method Detail

circulationPumpback to summary
private void circulationPump(final MethodGen m, final ControlFlowGraph cfg, final InstructionContext start, final Frame vanillaFrame, final InstConstraintVisitor icv, final ExecutionVisitor ev)

Whenever the outgoing frame situation of an InstructionContext changes, all its successors are put [back] into the queue [as if they were unvisited]. The proof of termination is about the existence of a fix point of frame merging.

do_verifyback to summary
public VerificationResult do_verify()

Implements abstract org.apache.bcel.verifier.PassVerifier.do_verify.

Pass 3b implements the data flow analysis as described in the Java Virtual Machine Specification, Second Edition. Later versions will use LocalVariablesInfo objects to verify if the verifier-inferred types and the class file's debug information (LocalVariables attributes) match [TODO].

Returns:VerificationResult

Doc from org.apache.bcel.verifier.PassVerifier.do_verify.

The VerificationResult

Annotations
@Override
See Also
org.apache.bcel.verifier.statics.LocalVariablesInfo, org.apache.bcel.verifier.statics.Pass2Verifier#getLocalVariablesInfo(int)
getMethodNoback to summary
public int getMethodNo()

Returns the method number as supplied when instantiating.

invalidReturnTypeErrorback to summary
public void invalidReturnTypeError(final Type returnedType, final MethodGen m)

Throws an exception indicating the returned type is not compatible with the return type of the given method.

Parameters
returnedType:Type

the type of the returned expression

m:MethodGen

the method we are processing

Exceptions
StructuralCodeConstraintException:
always
Since
6.0
org.apache.bcel.verifier.structurals back to summary

private final Class Pass3bVerifier.InstructionContextQueue

extends Object
Class Inheritance
  • java.lang.Object
  • org.apache.bcel.verifier.structurals.Pass3bVerifier.InstructionContextQueue

An InstructionContextQueue is a utility class that holds (InstructionContext, ArrayList) pairs in a Queue data structure. This is used to hold information about InstructionContext objects externally --- i.e. that information is not saved inside the InstructionContext object itself. This is useful to save the execution path of the symbolic execution of the Pass3bVerifier - this is not information that belongs into the InstructionContext object itself. Only at "execute()"ing time, an InstructionContext object will get the current information we have about its symbolic execution predecessors.

Field Summary

Modifier and TypeField and Description
private final List<ArrayList<InstructionContext>>
ecs

The second elements from pairs in the queue.

private final List<InstructionContext>
ics

The first elements from pairs in the queue.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
add(final InstructionContext
the InstructionContext
ic
,
final ArrayList<InstructionContext>
the ExecutionChain
executionChain
)

Adds an (InstructionContext, ExecutionChain) pair to this queue.

public ArrayList<InstructionContext>

Returns:

the indicated ExecutionChain
getEC
(final int
the index of the item to be fetched
i
)

Gets a specific ExecutionChain from the queue.

public InstructionContext

Returns:

the indicated InstructionContext
getIC
(final int
the index of the item to be fetched
i
)

Gets a specific InstructionContext from the queue.

public boolean

Returns:

true if the InstructionContext queue is empty.
isEmpty
()

Tests if InstructionContext queue is empty.

public void
remove(final int
the index of the items to be removed
i
)

Removes a specific (InstructionContext, ExecutionChain) pair from their respective queues.

public int

Returns:

the size of the InstructionQueue
size
()

Gets the size of the InstructionContext queue.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ecsback to summary
private final List<ArrayList<InstructionContext>> ecs

The second elements from pairs in the queue.

icsback to summary
private final List<InstructionContext> ics

The first elements from pairs in the queue.

Constructor Detail

InstructionContextQueueback to summary
private InstructionContextQueue()

Method Detail

addback to summary
public void add(final InstructionContext ic, final ArrayList<InstructionContext> executionChain)

Adds an (InstructionContext, ExecutionChain) pair to this queue.

Parameters
ic:InstructionContext

the InstructionContext

executionChain:ArrayList<InstructionContext>

the ExecutionChain

getECback to summary
public ArrayList<InstructionContext> getEC(final int i)

Gets a specific ExecutionChain from the queue.

Parameters
i:int

the index of the item to be fetched

Returns:ArrayList<InstructionContext>

the indicated ExecutionChain

getICback to summary
public InstructionContext getIC(final int i)

Gets a specific InstructionContext from the queue.

Parameters
i:int

the index of the item to be fetched

Returns:InstructionContext

the indicated InstructionContext

isEmptyback to summary
public boolean isEmpty()

Tests if InstructionContext queue is empty.

Returns:boolean

true if the InstructionContext queue is empty.

removeback to summary
public void remove(final int i)

Removes a specific (InstructionContext, ExecutionChain) pair from their respective queues.

Parameters
i:int

the index of the items to be removed

sizeback to summary
public int size()

Gets the size of the InstructionContext queue.

Returns:int

the size of the InstructionQueue