public final class Verifier extends Analyzer
MethodData md = ...;
try {
(new Verifier(md)).verify();
} catch (Verifier.FailureException ex) {
System.out.println("Verification failed at instruction "
+ ex.getOffset() + ": " + ex.getReason());
}
For full verification you need to provide class hierarchy information using setClassHierarchy.
Without this information, we can't compute the exact types of variables at control flow merge
points. If you don't provide a hierarchy, or the hierarchy you provide is partial, then the
Verifier will be optimistic.
This method can also be used to gather type information for every stack and local variable at every program point. Just call computeTypes() instead of verify() and then retrieve the results with getLocalTypes() and getStackTypes().
Analyzer.FailureException, Analyzer.PathElement, Analyzer.TypeVisitor| Constructor and Description |
|---|
Verifier(boolean isConstructor,
boolean isStatic,
java.lang.String classType,
java.lang.String signature,
IInstruction[] instructions,
ExceptionHandler[][] handlers,
int[] instToBC,
java.lang.String[][] vars)
Initialize a verifier.
|
Verifier(MethodData info)
Initialize a verifier.
|
Verifier(MethodData info,
int[] instToBC,
java.lang.String[][] vars) |
| Modifier and Type | Method and Description |
|---|---|
void |
computeTypes() |
void |
verify()
Try to verify the method.
|
void |
verifyCollectAll() |
computeTypes, createAnalyzer, findCommonSupertype, getBackEdges, getBasicBlockStarts, getInstructions, getLocalTypes, getReachableFrom, getReachableFrom, getReachableFromUpdate, getReachingToUpdate, getStackSizes, getStackTypes, initTypeInfo, isSubtypeOf, setClassHierarchy, stripSharppublic Verifier(boolean isConstructor,
boolean isStatic,
java.lang.String classType,
java.lang.String signature,
IInstruction[] instructions,
ExceptionHandler[][] handlers,
int[] instToBC,
java.lang.String[][] vars)
public Verifier(MethodData info) throws java.lang.NullPointerException
java.lang.NullPointerException - if info is nullpublic Verifier(MethodData info, int[] instToBC, java.lang.String[][] vars) throws java.lang.NullPointerException
java.lang.NullPointerExceptionpublic void verify()
throws Analyzer.FailureException
FailureException - the method contains invalid bytecodeAnalyzer.FailureExceptionpublic void verifyCollectAll()
throws Analyzer.FailureException
Analyzer.FailureExceptionpublic void computeTypes()
throws Analyzer.FailureException
Analyzer.FailureException