sofya.mutator.verifier
Class PlatformJVMVerifier

java.lang.Object
  extended by sofya.mutator.verifier.PlatformJVMVerifier
All Implemented Interfaces:
Verifier

public final class PlatformJVMVerifier
extends java.lang.Object
implements Verifier

Adapter to use the runtime verifier of the current JVM to verify class files.

This verifier has the desirable property of indicating whether or not a mutation verifies on the particular JVM you intend to use to run the mutated class. In an ideal world, this would make no sense, but in the real world some verifiers are more forgiving and/or buggy than others.

For each class, this verifier uses a new class loader to load the mutated bytecodes, triggering the JVM verifier to verify the class. The same class loader is used until a new mutated class is loaded, which permits transitive class verification.

This verifier has limited reporting capabilities. It will only report verification success or failure; specific failure causes are not reported in a manner easily handled programmatically. The quality of the messages on verification failure depend on the quality of the messages produced by the JVM verifier. If the result is a failure, the verification result can report whether the failure occurred before or after pass 3, but it cannot distinguish between passes 1 and 2, or passes 3a and 3b.

Version:
10/20/2005
Author:
Alex Kinneer

Nested Class Summary
 
Nested classes/interfaces inherited from interface sofya.mutator.verifier.Verifier
Verifier.Pass
 
Constructor Summary
PlatformJVMVerifier()
           
 
Method Summary
 void loadClass(org.apache.bcel.classfile.JavaClass clazz)
          Loads a class, overriding any existing definition of the class.
 void loadClass(java.lang.String className, byte[] classBytes)
          Loads a class, overriding any existing definition of the class.
 VerificationResult verify(java.lang.String className, java.lang.String methodName, java.lang.String signature, Verifier.Pass level)
          Verifies a method.
 VerificationResult verify(java.lang.String className, Verifier.Pass level)
          Verifies a class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlatformJVMVerifier

public PlatformJVMVerifier()
Method Detail

loadClass

public void loadClass(org.apache.bcel.classfile.JavaClass clazz)
               throws VerifierException
Description copied from interface: Verifier
Loads a class, overriding any existing definition of the class.

This method is used to instruct the verifier to load the mutated bytecode of the class to be verified. The verifier should therefore ensure that no subsequent requests to verify the given class will operate on any cached version of the class.

Specified by:
loadClass in interface Verifier
Parameters:
clazz - BCEL representation of the class to be loaded.
Throws:
VerifierException - If an error prevents the class from being loaded.

loadClass

public void loadClass(java.lang.String className,
                      byte[] classBytes)
               throws VerifierException
Description copied from interface: Verifier
Loads a class, overriding any existing definition of the class.

This method is used to instruct the verifier to load the mutated bytecode of the class to be verified. The verifier should therefore ensure that no subsequent requests to verify the given class will operate on any cached version of the class.

Specified by:
loadClass in interface Verifier
Parameters:
className - Name of the class to be loaded.
classBytes - The bytes comprising the class to be loaded.
Throws:
VerifierException - If an error prevents the class from being loaded.

verify

public VerificationResult verify(java.lang.String className,
                                 java.lang.String methodName,
                                 java.lang.String signature,
                                 Verifier.Pass level)
                          throws VerifierException
Description copied from interface: Verifier
Verifies a method.

Specified by:
verify in interface Verifier
Parameters:
className - Name of the class implementing the method to be verified.
methodName - Name of the method to be verified.
signature - Signature of the method to be verified.
level - Verification pass to be applied. Only passes 3a and 3b will actually verify the specific method.
Returns:
A verification result, containing information about the cause of failure if the method did not verify.
Throws:
VerifierException - If the verifier is unable to execute on the method for any reason, such as if requested method cannot be found in the given class.

verify

public VerificationResult verify(java.lang.String className,
                                 Verifier.Pass level)
                          throws VerifierException
Description copied from interface: Verifier
Verifies a class.

Specified by:
verify in interface Verifier
Parameters:
className - Name of the class to be verified.
level - Verification pass to be applied. When chosen, passes 3a and 3b will be applied to every method in the class.
Returns:
A verification result, containing information about the cause of failure if the class did not verify.
Throws:
VerifierException - If the verifier is unable to execute on the class for any reason.