ClassVisitor inner class and outer class documentation confusing
Expected Behavior
The documentation on ClassVisitor.visitInnerClass
should mention it is a few inner class relations observed by this class. For instance, classes that use invokedynamic
instructions compiled by javac
usually have the MethodHandles.Lookup
described as a nested class (static inner class) of MethodHandles
upon inspection by javap
.
It should also mention that the member classes and the enclosing class of this class, if any, must be described in this attribute per JVMS 18 - 4.7.6.
The documentation for ClassVisitor.visitOuterClass
should state it is only called for anonymous or local classes, which are defined in method bodies or initializers. In addition, if the class is defined in an initializer, then the name
and descriptor
will be null
. It is not called for instance inner or nested classes, i.e. classes that are direct members of other classes. Refer to JVMS 18 - 4.7.7.
Current Behavior
The documentation for ClassVisitor.visitInnerClass
fails to ask users to supply all the member classes and the enclosing class relations of this class.
The documentation for ClassVisitor.visitOuterClass
fails to mention that it should only be called for anonymous or local classes (i.e. classes defined in method bodies or initializers in source code), and null
method name and descriptors mean the class is defined in an initializer as opposed to a regular method.
Notes
In addition, the documentations for the tree API, such as ClassNode
, should be updated simultaneously.