public class CheckSignatureAdapter extends SignatureVisitor
SignatureVisitor
that checks that its methods are properly used.Modifier and Type | Class and Description |
---|---|
private static class |
CheckSignatureAdapter.State
The possible states of the automaton used to check the order of method calls.
|
Modifier and Type | Field and Description |
---|---|
private boolean |
canBeVoid
Whether the visited signature can be 'V'.
|
static int |
CLASS_SIGNATURE
Type to be used to check class signatures.
|
private static java.lang.String |
INVALID |
static int |
METHOD_SIGNATURE
Type to be used to check method signatures.
|
private SignatureVisitor |
signatureVisitor
The visitor to which this adapter must delegate calls.
|
private CheckSignatureAdapter.State |
state
The current state of the automaton used to check the order of method calls.
|
private int |
type
The type of the visited signature.
|
static int |
TYPE_SIGNATURE
Type to be used to check type signatures.See
CheckSignatureAdapter(int,
SignatureVisitor) . |
private static java.util.EnumSet<CheckSignatureAdapter.State> |
VISIT_CLASS_BOUND_STATES
The valid automaton states for a
visitClassBound() method call. |
private static java.util.EnumSet<CheckSignatureAdapter.State> |
VISIT_EXCEPTION_TYPE_STATES
The valid automaton states for a
visitExceptionType() method call. |
private static java.util.EnumSet<CheckSignatureAdapter.State> |
VISIT_FORMAL_TYPE_PARAMETER_STATES
The valid automaton states for a
visitFormalTypeParameter(java.lang.String) method call. |
private static java.util.EnumSet<CheckSignatureAdapter.State> |
VISIT_INTERFACE_BOUND_STATES
The valid automaton states for a
visitInterfaceBound() method call. |
private static java.util.EnumSet<CheckSignatureAdapter.State> |
VISIT_INTERFACE_STATES
The valid automaton states for a
visitInterface() method call. |
private static java.util.EnumSet<CheckSignatureAdapter.State> |
VISIT_PARAMETER_TYPE_STATES
The valid automaton states for a
visitParameterType() method call. |
private static java.util.EnumSet<CheckSignatureAdapter.State> |
VISIT_RETURN_TYPE_STATES
The valid automaton states for a
visitReturnType() method call. |
private static java.util.EnumSet<CheckSignatureAdapter.State> |
VISIT_SUPER_CLASS_STATES
The valid automaton states for a
visitSuperclass() method call. |
api, EXTENDS, INSTANCEOF, SUPER
Modifier | Constructor and Description |
---|---|
protected |
CheckSignatureAdapter(int api,
int type,
SignatureVisitor signatureVisitor)
Constructs a new
CheckSignatureAdapter . |
|
CheckSignatureAdapter(int type,
SignatureVisitor signatureVisitor)
Constructs a new
CheckSignatureAdapter . |
Modifier and Type | Method and Description |
---|---|
private void |
checkClassName(java.lang.String name,
java.lang.String message) |
private void |
checkIdentifier(java.lang.String name,
java.lang.String message) |
SignatureVisitor |
visitArrayType()
Visits a signature corresponding to an array type.
|
void |
visitBaseType(char descriptor)
Visits a signature corresponding to a primitive type.
|
SignatureVisitor |
visitClassBound()
Visits the class bound of the last visited formal type parameter.
|
void |
visitClassType(java.lang.String name)
Starts the visit of a signature corresponding to a class or interface type.
|
void |
visitEnd()
Ends the visit of a signature corresponding to a class or interface type.
|
SignatureVisitor |
visitExceptionType()
Visits the type of a method exception.
|
void |
visitFormalTypeParameter(java.lang.String name)
Visits a formal type parameter.
|
void |
visitInnerClassType(java.lang.String name)
Visits an inner class.
|
SignatureVisitor |
visitInterface()
Visits the type of an interface implemented by the class.
|
SignatureVisitor |
visitInterfaceBound()
Visits an interface bound of the last visited formal type parameter.
|
SignatureVisitor |
visitParameterType()
Visits the type of a method parameter.
|
SignatureVisitor |
visitReturnType()
Visits the return type of the method.
|
SignatureVisitor |
visitSuperclass()
Visits the type of the super class.
|
void |
visitTypeArgument()
Visits an unbounded type argument of the last visited class or inner class type.
|
SignatureVisitor |
visitTypeArgument(char wildcard)
Visits a type argument of the last visited class or inner class type.
|
void |
visitTypeVariable(java.lang.String name)
Visits a signature corresponding to a type variable.
|
public static final int CLASS_SIGNATURE
CheckSignatureAdapter(int,
SignatureVisitor)
.public static final int METHOD_SIGNATURE
CheckSignatureAdapter(int,
SignatureVisitor)
.public static final int TYPE_SIGNATURE
CheckSignatureAdapter(int,
SignatureVisitor)
.private static final java.util.EnumSet<CheckSignatureAdapter.State> VISIT_FORMAL_TYPE_PARAMETER_STATES
visitFormalTypeParameter(java.lang.String)
method call.private static final java.util.EnumSet<CheckSignatureAdapter.State> VISIT_CLASS_BOUND_STATES
visitClassBound()
method call.private static final java.util.EnumSet<CheckSignatureAdapter.State> VISIT_INTERFACE_BOUND_STATES
visitInterfaceBound()
method call.private static final java.util.EnumSet<CheckSignatureAdapter.State> VISIT_SUPER_CLASS_STATES
visitSuperclass()
method call.private static final java.util.EnumSet<CheckSignatureAdapter.State> VISIT_INTERFACE_STATES
visitInterface()
method call.private static final java.util.EnumSet<CheckSignatureAdapter.State> VISIT_PARAMETER_TYPE_STATES
visitParameterType()
method call.private static final java.util.EnumSet<CheckSignatureAdapter.State> VISIT_RETURN_TYPE_STATES
visitReturnType()
method call.private static final java.util.EnumSet<CheckSignatureAdapter.State> VISIT_EXCEPTION_TYPE_STATES
visitExceptionType()
method call.private static final java.lang.String INVALID
private final int type
private CheckSignatureAdapter.State state
private boolean canBeVoid
private final SignatureVisitor signatureVisitor
public CheckSignatureAdapter(int type, SignatureVisitor signatureVisitor)
CheckSignatureAdapter
. Subclasses must not use this
constructor. Instead, they must use the CheckSignatureAdapter(int, int,
SignatureVisitor)
version.type
- the type of signature to be checked. See CLASS_SIGNATURE
, METHOD_SIGNATURE
and TYPE_SIGNATURE
.signatureVisitor
- the visitor to which this adapter must delegate calls. May be null.protected CheckSignatureAdapter(int api, int type, SignatureVisitor signatureVisitor)
CheckSignatureAdapter
.api
- the ASM API version implemented by this visitor. Must be one of Opcodes.ASM4
, Opcodes.ASM5
, Opcodes.ASM6
or Opcodes.ASM7
.type
- the type of signature to be checked. See CLASS_SIGNATURE
, METHOD_SIGNATURE
and TYPE_SIGNATURE
.signatureVisitor
- the visitor to which this adapter must delegate calls. May be null.public void visitFormalTypeParameter(java.lang.String name)
SignatureVisitor
visitFormalTypeParameter
in class SignatureVisitor
name
- the name of the formal parameter.public SignatureVisitor visitClassBound()
SignatureVisitor
visitClassBound
in class SignatureVisitor
public SignatureVisitor visitInterfaceBound()
SignatureVisitor
visitInterfaceBound
in class SignatureVisitor
public SignatureVisitor visitSuperclass()
SignatureVisitor
visitSuperclass
in class SignatureVisitor
public SignatureVisitor visitInterface()
SignatureVisitor
visitInterface
in class SignatureVisitor
public SignatureVisitor visitParameterType()
SignatureVisitor
visitParameterType
in class SignatureVisitor
public SignatureVisitor visitReturnType()
SignatureVisitor
visitReturnType
in class SignatureVisitor
public SignatureVisitor visitExceptionType()
SignatureVisitor
visitExceptionType
in class SignatureVisitor
public void visitBaseType(char descriptor)
SignatureVisitor
visitBaseType
in class SignatureVisitor
descriptor
- the descriptor of the primitive type, or 'V' for void
.public void visitTypeVariable(java.lang.String name)
SignatureVisitor
visitTypeVariable
in class SignatureVisitor
name
- the name of the type variable.public SignatureVisitor visitArrayType()
SignatureVisitor
visitArrayType
in class SignatureVisitor
public void visitClassType(java.lang.String name)
SignatureVisitor
visitClassType
in class SignatureVisitor
name
- the internal name of the class or interface.public void visitInnerClassType(java.lang.String name)
SignatureVisitor
visitInnerClassType
in class SignatureVisitor
name
- the local name of the inner class in its enclosing class.public void visitTypeArgument()
SignatureVisitor
visitTypeArgument
in class SignatureVisitor
public SignatureVisitor visitTypeArgument(char wildcard)
SignatureVisitor
visitTypeArgument
in class SignatureVisitor
wildcard
- '+', '-' or '='.public void visitEnd()
SignatureVisitor
visitEnd
in class SignatureVisitor
private void checkClassName(java.lang.String name, java.lang.String message)
private void checkIdentifier(java.lang.String name, java.lang.String message)