Top Description Fields Constructors Methods
org.objectweb.asm.tree.analysis

public Class SimpleVerifier

extends BasicVerifier
Class Inheritance
Imports
java.util.List, org.objectweb.asm.Opcodes, .Type

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 BasicVerifier).
Authors
Eric Bruneton, Bing Ran

Field Summary

Modifier and TypeField and Description
private final Type
currentClass

The type of the class that is verified.

private final List<Type>
currentClassInterfaces

The types of the interfaces directly implemented by the class that is verified.

private final Type
currentSuperClass

The type of the super class of the class that is verified.

private final boolean
isInterface

Whether the class that is verified is an interface.

private ClassLoader
loader

The loader to use to load the referenced classes.

Constructor Summary

AccessConstructor and Description
public
SimpleVerifier()

Constructs a new SimpleVerifier.

public
SimpleVerifier(final Type
the type of the class to be verified.
currentClass
,
final Type
the type of the super class of the class to be verified.
currentSuperClass
,
final boolean
whether the class to be verifier is an interface.
isInterface
)

Constructs a new SimpleVerifier to verify a specific class.

public
SimpleVerifier(final Type
the type of the class to be verified.
currentClass
,
final Type
the type of the super class of the class to be verified.
currentSuperClass
,
final List<Type>
the types of the interfaces directly implemented by the class to be verified.
currentClassInterfaces
,
final boolean
whether the class to be verifier is an interface.
isInterface
)

Constructs a new SimpleVerifier to verify a specific class.

protected
SimpleVerifier(final int
the ASM API version supported by this verifier. Must be one of the ASMx values in Opcodes.
api
,
final Type
the type of the class to be verified.
currentClass
,
final Type
the type of the super class of the class to be verified.
currentSuperClass
,
final List<Type>
the types of the interfaces directly implemented by the class to be verified.
currentClassInterfaces
,
final boolean
whether the class to be verifier is an interface.
isInterface
)

Constructs a new SimpleVerifier to verify a specific class.

Method Summary

Modifier and TypeMethod and Description
protected Class<?>

Returns:

the class corresponding to 'type'.
getClass
(final Type
a type.
type
)

Loads the class corresponding to the given type.

protected BasicValue
getElementValue(final BasicValue
a value corresponding to array of object (or array) references.
objectArrayValue
)

Overrides org.objectweb.asm.tree.analysis.BasicVerifier.getElementValue.

Returns the value corresponding to the type of the elements of the given array reference value.
protected Type

Returns:

the type corresponding to the super class of 'type'.
getSuperClass
(final Type
a type.
type
)

Returns the type corresponding to the super class of the given type.

protected boolean
isArrayValue(final BasicValue
a value.
value
)

Overrides org.objectweb.asm.tree.analysis.BasicVerifier.isArrayValue.

Returns whether the given value corresponds to an array reference.
protected boolean

Returns:

whether the class corresponding to 'type1' is either the same as, or is a superclass or superinterface of the class corresponding to 'type2'.
isAssignableFrom
(final Type
a type.
type1
,
final Type
another type.
type2
)

Returns whether the class corresponding to the first argument is either the same as, or is a superclass or superinterface of the class corresponding to the second argument.

protected boolean

Returns:

whether 'type' corresponds to an interface.
isInterface
(final Type
a type.
type
)

Returns whether the given type corresponds to the type of an interface.

protected boolean
isSubTypeOf(final BasicValue
a value.
value
,
final BasicValue
another value.
expected
)

Overrides org.objectweb.asm.tree.analysis.BasicVerifier.isSubTypeOf.

Returns whether the type corresponding to the first argument is a subtype of the type corresponding to the second argument.
public BasicValue
merge(final BasicValue
a value.
value1
,
final BasicValue
another value.
value2
)

Overrides org.objectweb.asm.tree.analysis.BasicInterpreter.merge.

Merges two values.
private BasicValue
newArrayValue(final Type type, final int dimensions)

public BasicValue
newValue(final Type
a primitive or reference type, or null to represent an uninitialized value.
type
)

Overrides org.objectweb.asm.tree.analysis.BasicInterpreter.newValue.

Creates a new value that represents the given type.
public void
setClassLoader(final ClassLoader
the ClassLoader to use.
loader
)

Sets the ClassLoader to be used in getClass.

Inherited from org.objectweb.asm.tree.analysis.BasicVerifier:
binaryOperationcopyOperationnaryOperationreturnOperationternaryOperationunaryOperation

Field Detail

currentClassback to summary
private final Type currentClass

The type of the class that is verified.

currentClassInterfacesback to summary
private final List<Type> currentClassInterfaces

The types of the interfaces directly implemented by the class that is verified.

currentSuperClassback to summary
private final Type currentSuperClass

The type of the super class of the class that is verified.

isInterfaceback to summary
private final boolean isInterface

Whether the class that is verified is an interface.

loaderback to summary
private ClassLoader loader

The loader to use to load the referenced classes.

Constructor Detail

SimpleVerifierback to summary
public SimpleVerifier()

Constructs a new SimpleVerifier. Subclasses must not use this constructor. Instead, they must use the SimpleVerifier(int, Type, Type, List, boolean) version.

SimpleVerifierback to summary
public SimpleVerifier(final Type currentClass, final Type currentSuperClass, final 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. Subclasses must not use this constructor. Instead, they must use the SimpleVerifier(int, Type, Type, List, boolean) version.

Parameters
currentClass:Type

the type of the class to be verified.

currentSuperClass:Type

the type of the super class of the class to be verified.

isInterface:boolean

whether the class to be verifier is an interface.

SimpleVerifierback to summary
public SimpleVerifier(final Type currentClass, final Type currentSuperClass, final List<Type> currentClassInterfaces, final 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. Subclasses must not use this constructor. Instead, they must use the SimpleVerifier(int, Type, Type, List, boolean) version.

Parameters
currentClass:Type

the type of the class to be verified.

currentSuperClass:Type

the type of the super class of the class to be verified.

currentClassInterfaces:List<Type>

the types of the interfaces directly implemented by the class to be verified.

isInterface:boolean

whether the class to be verifier is an interface.

SimpleVerifierback to summary
protected SimpleVerifier(final int api, final Type currentClass, final Type currentSuperClass, final List<Type> currentClassInterfaces, final 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
api:int

the ASM API version supported by this verifier. Must be one of the ASMx values in Opcodes.

currentClass:Type

the type of the class to be verified.

currentSuperClass:Type

the type of the super class of the class to be verified.

currentClassInterfaces:List<Type>

the types of the interfaces directly implemented by the class to be verified.

isInterface:boolean

whether the class to be verifier is an interface.

Method Detail

getClassback to summary
protected Class<?> getClass(final Type type)

Loads the class corresponding to the given type. The class is loaded with the class loader specified with setClassLoader, or with the class loader of this class if no class loader was specified.

Parameters
type:Type

a type.

Returns:Class<?>

the class corresponding to 'type'.

getElementValueback to summary
protected BasicValue getElementValue(final BasicValue objectArrayValue) throws AnalyzerException

Overrides org.objectweb.asm.tree.analysis.BasicVerifier.getElementValue.

Doc from org.objectweb.asm.tree.analysis.BasicVerifier.getElementValue.

Returns the value corresponding to the type of the elements of the given array reference value.

Parameters
objectArrayValue:BasicValue

a value corresponding to array of object (or array) references.

Returns:BasicValue

the value corresponding to the type of the elements of 'objectArrayValue'.

Annotations
@Override
Exceptions
AnalyzerException:
if objectArrayValue does not correspond to an array type.
getSuperClassback to summary
protected Type getSuperClass(final Type type)

Returns the type corresponding to the super class of the given type. The default implementation of this method loads the class and uses the reflection API to return its result (unless the given type corresponds to the class being verified).

Parameters
type:Type

a type.

Returns:Type

the type corresponding to the super class of 'type'.

isArrayValueback to summary
protected boolean isArrayValue(final BasicValue value)

Overrides org.objectweb.asm.tree.analysis.BasicVerifier.isArrayValue.

Doc from org.objectweb.asm.tree.analysis.BasicVerifier.isArrayValue.

Returns whether the given value corresponds to an array reference.

Parameters
value:BasicValue

a value.

Returns:boolean

whether 'value' corresponds to an array reference.

Annotations
@Override
isAssignableFromback to summary
protected boolean isAssignableFrom(final Type type1, final Type type2)

Returns whether the class corresponding to the first argument is either the same as, or is a superclass or superinterface of the class corresponding to the second argument. The default implementation of this method loads the classes and uses the reflection API to return its result (unless the result can be computed from the class being verified, and the types of its super classes and implemented interfaces).

Parameters
type1:Type

a type.

type2:Type

another type.

Returns:boolean

whether the class corresponding to 'type1' is either the same as, or is a superclass or superinterface of the class corresponding to 'type2'.

isInterfaceback to summary
protected boolean isInterface(final Type type)

Returns whether the given type corresponds to the type of an interface. The default implementation of this method loads the class and uses the reflection API to return its result (unless the given type corresponds to the class being verified).

Parameters
type:Type

a type.

Returns:boolean

whether 'type' corresponds to an interface.

isSubTypeOfback to summary
protected boolean isSubTypeOf(final BasicValue value, final BasicValue expected)

Overrides org.objectweb.asm.tree.analysis.BasicVerifier.isSubTypeOf.

Doc from org.objectweb.asm.tree.analysis.BasicVerifier.isSubTypeOf.

Returns whether the type corresponding to the first argument is a subtype of the type corresponding to the second argument.

Parameters
value:BasicValue

a value.

expected:BasicValue

another value.

Returns:boolean

whether the type corresponding to 'value' is a subtype of the type corresponding to 'expected'.

Annotations
@Override
mergeback to summary
public BasicValue merge(final BasicValue value1, final BasicValue value2)

Overrides org.objectweb.asm.tree.analysis.BasicInterpreter.merge.

Doc from org.objectweb.asm.tree.analysis.Interpreter.merge.

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).

Parameters
value1:BasicValue

a value.

value2:BasicValue

another value.

Returns:BasicValue

the merged value. If the merged value is equal to value1, this method must return value1.

Annotations
@Override
newArrayValueback to summary
private BasicValue newArrayValue(final Type type, final int dimensions)
newValueback to summary
public BasicValue newValue(final Type type)

Overrides org.objectweb.asm.tree.analysis.BasicInterpreter.newValue.

Doc from org.objectweb.asm.tree.analysis.Interpreter.newValue.

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.

An interpreter may choose to implement one or more of Interpreter#newReturnTypeValue(Type), Interpreter#newParameterValue(boolean, int, Type), Interpreter#newEmptyValue(int), Interpreter#newExceptionValue(TryCatchBlockNode, Frame, Type) to distinguish different types of new value.

Parameters
type:Type

a primitive or reference type, or null to represent an uninitialized value.

Returns:BasicValue

a value that represents the given type. The size of the returned value must be equal to the size of the given type.

Annotations
@Override
setClassLoaderback to summary
public void setClassLoader(final ClassLoader loader)

Sets the ClassLoader to be used in getClass.

Parameters
loader:ClassLoader

the ClassLoader to use.