Uploaded image for project: 'River (Retired)'
  1. River (Retired)
  2. RIVER-7

com.sun.jini.tool.ClassDep should be smarter with outer classes

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • jtsk_2.1
    • River_2.1.2
    • com_sun_jini_tool
    • 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.

      Attachments

        1. RIVER-7-8-78-151.patch
          23 kB
          Mark Brouwer

        Activity

          People

            marbro Mark Brouwer
            marbro Mark Brouwer
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: