Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
jtsk_2.1
-
None
Description
The javadoc for com.sun.jini.tool.ClassDep states the following "By default, if a static nested class is included in the dependency graph, all references from that static nested class to its immediate lexically enclosing class are ignored, to avoid inadvertent inclusion of the enclosing class. (The default is chosen this way because the compiled class file of a static nested class always contains a reference to the immediate lexically enclosing class.) This option causes all such references to be considered rather than ignored. Note that this option is needed very infrequently.".
I agree with this default behavior, however I've been surpised a few times by the following use case which always looked like a bug in ClassDep.
class Proxy { static final class ConstrainableProxy extends Proxy { } }
During dependency checking I want to specify Proxy$ConstrainableProxy but in most cases this causes Proxy to be missing from the download JAR file (although often a trust verifier drags it in anyway) and changing the default behavior is not what I want.
Maybe it is possible to add a check to see whether the enclosing class is a parent of the nested class, if so it could be including in the collection of classes to be considered for dependency checking.