Package org.apache.bcel.verifier.statics
Class Pass2Verifier.InnerClassDetector
java.lang.Object
org.apache.bcel.classfile.EmptyVisitor
org.apache.bcel.verifier.statics.Pass2Verifier.InnerClassDetector
- All Implemented Interfaces:
Visitor
- Enclosing class:
Pass2Verifier
This class serves for finding out if a given JavaClass' ConstantPool references an Inner Class. The Java Virtual
Machine Specification, Second Edition is not very precise about when an "InnerClasses" attribute has to appear.
However, it states that there has to be exactly one InnerClasses attribute in the ClassFile structure if the constant
pool of a class or interface refers to any class or interface "that is not a member of a package". Sun does not mean
"member of the default package". In "Inner Classes Specification" they point out how a "bytecode name" is derived so
one has to deduce what a class name of a class "that is not a member of a package" looks like: there is at least one
character in the byte- code name that cannot be part of a legal Java Language Class name (and not equal to '/'). This
assumption is wrong as the delimiter is '$' for which Character.isJavaIdentifierPart() == true. Hence, you really run
into trouble if you have a toplevel class called "A$XXX" and another toplevel class called "A" with in inner class
called "XXX". JustIce cannot repair this; please note that existing verifiers at this time even fail to detect
missing InnerClasses attributes in pass 2.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ConstantPool
private boolean
private final JavaClass
-
Constructor Summary
ConstructorsConstructorDescriptionInnerClassDetector
(JavaClass javaClass) Constructs an InnerClassDetector working on the JavaClass _jc. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns if the JavaClass this InnerClassDetector is working on has an Inner Class reference in its constant pool.void
This method casually visits ConstantClass references.Methods inherited from class org.apache.bcel.classfile.EmptyVisitor
visitAnnotation, visitAnnotationDefault, visitAnnotationEntry, visitBootstrapMethods, visitCode, visitCodeException, visitConstantDouble, visitConstantDynamic, visitConstantFieldref, visitConstantFloat, visitConstantInteger, visitConstantInterfaceMethodref, visitConstantInvokeDynamic, visitConstantLong, visitConstantMethodHandle, visitConstantMethodref, visitConstantMethodType, visitConstantModule, visitConstantNameAndType, visitConstantPackage, visitConstantPool, visitConstantString, visitConstantUtf8, visitConstantValue, visitDeprecated, visitEnclosingMethod, visitExceptionTable, visitField, visitInnerClass, visitInnerClasses, visitJavaClass, visitLineNumber, visitLineNumberTable, visitLocalVariable, visitLocalVariableTable, visitLocalVariableTypeTable, visitMethod, visitMethodParameter, visitMethodParameters, visitModule, visitModuleExports, visitModuleMainClass, visitModuleOpens, visitModulePackages, visitModuleProvides, visitModuleRequires, visitNestHost, visitNestMembers, visitParameterAnnotation, visitParameterAnnotationEntry, visitSignature, visitSourceFile, visitStackMap, visitStackMapEntry, visitStackMapType, visitSynthetic, visitUnknown
-
Field Details
-
hasInnerClass
private boolean hasInnerClass -
jc
-
cp
-
-
Constructor Details
-
InnerClassDetector
Constructs an InnerClassDetector working on the JavaClass _jc.
-
-
Method Details
-
innerClassReferenced
public boolean innerClassReferenced()Returns if the JavaClass this InnerClassDetector is working on has an Inner Class reference in its constant pool.- Returns:
- Whether this InnerClassDetector is working on has an Inner Class reference in its constant pool.
-
visitConstantClass
This method casually visits ConstantClass references.- Specified by:
visitConstantClass
in interfaceVisitor
- Overrides:
visitConstantClass
in classEmptyVisitor
-