Class SimpleVerifier

  • All Implemented Interfaces:
    Opcodes

    public class SimpleVerifier
    extends BasicVerifier
    An extended BasicVerifier that performs more precise verifications. This verifier computes exact class types, instead of using a single "object reference" type (as done in the BasicVerifier).
    Author:
    Eric Bruneton, Bing Ran
    • Constructor Detail

      • SimpleVerifier

        public SimpleVerifier()
        Constructs a new SimpleVerifier.
      • SimpleVerifier

        public SimpleVerifier​(Type currentClass,
                              Type currentSuperClass,
                              boolean isInterface)
        Constructs a new SimpleVerifier to verify a specific class. This class will not be loaded into the JVM since it may be incorrect.
        Parameters:
        currentClass - the class that is verified.
        currentSuperClass - the super class of the class that is verified.
        isInterface - if the class that is verified is an interface.
      • SimpleVerifier

        public SimpleVerifier​(Type currentClass,
                              Type currentSuperClass,
                              java.util.List<Type> currentClassInterfaces,
                              boolean isInterface)
        Constructs a new SimpleVerifier to verify a specific class. This class will not be loaded into the JVM since it may be incorrect.
        Parameters:
        currentClass - the class that is verified.
        currentSuperClass - the super class of the class that is verified.
        currentClassInterfaces - the interfaces implemented by the class that is verified.
        isInterface - if the class that is verified is an interface.
      • SimpleVerifier

        protected SimpleVerifier​(int api,
                                 Type currentClass,
                                 Type currentSuperClass,
                                 java.util.List<Type> currentClassInterfaces,
                                 boolean isInterface)
    • Method Detail

      • setClassLoader

        public void setClassLoader​(java.lang.ClassLoader loader)
        Set the ClassLoader which will be used to load referenced classes. This is useful if you are verifying multiple interdependent classes.
        Parameters:
        loader - a ClassLoader to use
      • newValue

        public BasicValue newValue​(Type type)
        Description copied from class: Interpreter
        Creates a new value that represents the given type. Called for method parameters (including this), exception handler variable and with null type for variables reserved by long and double types.
        Overrides:
        newValue in class BasicInterpreter
        Parameters:
        type - a primitive or reference type, or null to represent an uninitialized value.
        Returns:
        a value that represents the given type. The size of the returned value must be equal to the size of the given type.
      • merge

        public BasicValue merge​(BasicValue v,
                                BasicValue w)
        Description copied from class: Interpreter
        Merges two values. The merge operation must return a value that represents both values (for instance, if the two values are two types, the merged value must be a common super type of the two types. If the two values are integer intervals, the merged value must be an interval that contains the previous ones. Likewise for other types of values).
        Overrides:
        merge in class BasicInterpreter
        Parameters:
        v - a value.
        w - another value.
        Returns:
        the merged value. If the merged value is equal to v, this method must return v.
      • isInterface

        protected boolean isInterface​(Type t)
      • getSuperClass

        protected Type getSuperClass​(Type t)
      • isAssignableFrom

        protected boolean isAssignableFrom​(Type t,
                                           Type u)
      • getClass

        protected java.lang.Class<?> getClass​(Type t)