|
|||||||||
| Home >> All >> org >> apache >> bcel >> verifier >> [ statics overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.bcel.verifier.statics
Class Pass2Verifier

java.lang.Objectorg.apache.bcel.verifier.PassVerifier
org.apache.bcel.verifier.statics.Pass2Verifier
- All Implemented Interfaces:
- org.apache.bcel.Constants
- public final class Pass2Verifier
- extends org.apache.bcel.verifier.PassVerifier
- implements org.apache.bcel.Constants
- extends org.apache.bcel.verifier.PassVerifier
This PassVerifier verifies a class file according to pass 2 as described in The Java Virtual Machine Specification, 2nd edition. More detailed information is to be found at the do_verify() method's documentation.
- Version:
- $Id: Pass2Verifier.java 386056 2006-03-15 11:31:56Z tcurdt $
| Nested Class Summary | |
private class |
Pass2Verifier.CPESSC_Visitor
A Visitor class that ensures the constant pool satisfies the static constraints. |
private class |
Pass2Verifier.FAMRAV_Visitor
A Visitor class that ensures the ConstantCP-subclassed entries of the constant pool are valid. |
private static class |
Pass2Verifier.InnerClassDetector
This class serves for finding out if a given JavaClass' ConstantPool references an Inner Class. |
| Field Summary | |
private LocalVariablesInfo[] |
localVariablesInfos
The LocalVariableInfo instances used by Pass3bVerifier. |
private org.apache.bcel.verifier.Verifier |
myOwner
The Verifier that created this. |
| Fields inherited from class org.apache.bcel.verifier.PassVerifier |
|
| Constructor Summary | |
Pass2Verifier(org.apache.bcel.verifier.Verifier owner)
Should only be instantiated by a Verifier. |
|
| Method Summary | |
private void |
constant_pool_entries_satisfy_static_constraints()
Ensures that the constant pool entries satisfy the static constraints as described in The Java Virtual Machine Specification, 2nd Edition. |
org.apache.bcel.verifier.VerificationResult |
do_verify()
Pass 2 is the pass where static properties of the class file are checked without looking into "Code" arrays of methods. |
private void |
every_class_has_an_accessible_superclass()
Ensures that every class has a super class and that final classes are not subclassed. |
private void |
field_and_method_refs_are_valid()
Ensures that the ConstantCP-subclassed entries of the constant pool are valid. |
private void |
final_methods_are_not_overridden()
Ensures that final methods are not overridden. |
LocalVariablesInfo |
getLocalVariablesInfo(int method_nr)
Returns a LocalVariablesInfo object containing information about the usage of the local variables in the Code attribute of the said method or null if the class file this Pass2Verifier operates on could not be pass-2-verified correctly. |
private static java.lang.String |
tostring(org.apache.bcel.classfile.Node n)
This method is here to save typing work and improve code readability. |
private static boolean |
validClassMethodName(java.lang.String name)
This method returns true if and only if the supplied String represents a valid method name that may be referenced by ConstantMethodref objects. |
private static boolean |
validClassName(java.lang.String name)
This method returns true if and only if the supplied String represents a valid Java class name. |
private static boolean |
validFieldName(java.lang.String name)
This method returns true if and only if the supplied String represents a valid Java field name. |
private static boolean |
validInterfaceMethodName(java.lang.String name)
This method returns true if and only if the supplied String represents a valid Java interface method name that may be referenced by ConstantInterfaceMethodref objects. |
private static boolean |
validJavaIdentifier(java.lang.String name)
This method returns true if and only if the supplied String represents a valid Java identifier (so-called simple name). |
private static boolean |
validJavaLangMethodName(java.lang.String name)
This method returns true if and only if the supplied String represents a valid Java programming language method name stored as a simple (non-qualified) name. |
private static boolean |
validMethodName(java.lang.String name,
boolean allowStaticInit)
This method returns true if and only if the supplied String represents a valid method name. |
| Methods inherited from class org.apache.bcel.verifier.PassVerifier |
addMessage, getMessages, verify |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
localVariablesInfos
private LocalVariablesInfo[] localVariablesInfos
- The LocalVariableInfo instances used by Pass3bVerifier.
localVariablesInfos[i] denotes the information for the
local variables of method number i in the
JavaClass this verifier operates on.
myOwner
private org.apache.bcel.verifier.Verifier myOwner
- The Verifier that created this.
| Constructor Detail |
Pass2Verifier
public Pass2Verifier(org.apache.bcel.verifier.Verifier owner)
- Should only be instantiated by a Verifier.
| Method Detail |
getLocalVariablesInfo
public LocalVariablesInfo getLocalVariablesInfo(int method_nr)
- Returns a LocalVariablesInfo object containing information
about the usage of the local variables in the Code attribute
of the said method or null if the class file this
Pass2Verifier operates on could not be pass-2-verified correctly.
The method number method_nr is the method you get using
Repository.lookupClass(myOwner.getClassname()).getMethods()[method_nr];.
You should not add own information. Leave that to JustIce.
do_verify
public org.apache.bcel.verifier.VerificationResult do_verify()
- Pass 2 is the pass where static properties of the
class file are checked without looking into "Code"
arrays of methods.
This verification pass is usually invoked when
a class is resolved; and it may be possible that
this verification pass has to load in other classes
such as superclasses or implemented interfaces.
Therefore, Pass 1 is run on them.
Note that most referenced classes are not loaded in for verification or for an existance check by this pass; only the syntactical correctness of their names and descriptors (a.k.a. signatures) is checked.
Very few checks that conceptually belong here are delayed until pass 3a in JustIce. JustIce does not only check for syntactical correctness but also for semantical sanity - therefore it needs access to the "Code" array of methods in a few cases. Please see the pass 3a documentation, too.
every_class_has_an_accessible_superclass
private void every_class_has_an_accessible_superclass()
- Ensures that every class has a super class and that
final classes are not subclassed.
This means, the class this Pass2Verifier operates
on has proper super classes (transitively) up to
java.lang.Object.
The reason for really loading (and Pass1-verifying)
all of those classes here is that we need them in
Pass2 anyway to verify no final methods are overridden
(that could be declared anywhere in the ancestor hierarchy).
final_methods_are_not_overridden
private void final_methods_are_not_overridden()
- Ensures that final methods are not overridden.
Precondition to run this method:
constant_pool_entries_satisfy_static_constraints() and
every_class_has_an_accessible_superclass() have to be invoked before
(in that order).
constant_pool_entries_satisfy_static_constraints
private void constant_pool_entries_satisfy_static_constraints()
- Ensures that the constant pool entries satisfy the static constraints
as described in The Java Virtual Machine Specification, 2nd Edition.
field_and_method_refs_are_valid
private void field_and_method_refs_are_valid()
- Ensures that the ConstantCP-subclassed entries of the constant
pool are valid. According to "Yellin: Low Level Security in Java",
this method does not verify the existence of referenced entities
(such as classes) but only the formal correctness (such as well-formed
signatures).
The visitXXX() methods throw ClassConstraintException instances otherwise.
Precondition: index-style cross referencing in the constant
pool must be valid. Simply invoke constant_pool_entries_satisfy_static_constraints()
before.
validClassName
private static final boolean validClassName(java.lang.String name)
- This method returns true if and only if the supplied String
represents a valid Java class name.
validMethodName
private static boolean validMethodName(java.lang.String name, boolean allowStaticInit)
- This method returns true if and only if the supplied String
represents a valid method name.
This is basically the same as a valid identifier name in the
Java programming language, but the special name for
the instance initialization method is allowed and the special name
for the class/interface initialization method may be allowed.
validClassMethodName
private static boolean validClassMethodName(java.lang.String name)
- This method returns true if and only if the supplied String
represents a valid method name that may be referenced by
ConstantMethodref objects.
validJavaLangMethodName
private static boolean validJavaLangMethodName(java.lang.String name)
- This method returns true if and only if the supplied String
represents a valid Java programming language method name stored as a simple
(non-qualified) name.
Conforming to: The Java Virtual Machine Specification, Second Edition, §2.7, §2.7.1, §2.2.
validInterfaceMethodName
private static boolean validInterfaceMethodName(java.lang.String name)
- This method returns true if and only if the supplied String
represents a valid Java interface method name that may be
referenced by ConstantInterfaceMethodref objects.
validJavaIdentifier
private static boolean validJavaIdentifier(java.lang.String name)
- This method returns true if and only if the supplied String
represents a valid Java identifier (so-called simple name).
validFieldName
private static boolean validFieldName(java.lang.String name)
- This method returns true if and only if the supplied String
represents a valid Java field name.
tostring
private static java.lang.String tostring(org.apache.bcel.classfile.Node n)
- This method is here to save typing work and improve code readability.
|
|||||||||
| Home >> All >> org >> apache >> bcel >> verifier >> [ statics overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC