Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4047116

javac doesn't properly evaluate class dependencies with -depend flag

XMLWordPrintable

    • 1.2
    • generic
    • solaris_2.4
    • Not verified


      #
      # This is a simple test the behavior of javac -depend.
      # I have performed this test on both versions 1.02 and 1.1 and
      # with variations of packaging.
      #
      # We have three files which reference in a chain:
      # AAA.java -> BBB.java -> CCC.java
      #

      $ ls -l
      total 6
      -rw-rw-r-- 1 apl9757 isapldev 25 Mar 19 09:40 AAA.java
      -rw-rw-r-- 1 apl9757 isapldev 25 Mar 19 09:40 BBB.java
      -rw-rw-r-- 1 apl9757 isapldev 16 Mar 19 09:40 CCC.java

      $ cat AAA.java BBB.java CCC.java
      class AAA {
              BBB bbb;
      }

      class BBB {
              CCC ccc;
      }

      class CCC {

      }

      $ javac -depend -classpath /export/products/java.tools/JDK/lib/classes.zip:. AAA.java

      $ ls -l
      total 12
      -rw-rw-r-- 1 apl9757 isapldev 236 Mar 19 09:41 AAA.class
      -rw-rw-r-- 1 apl9757 isapldev 25 Mar 19 09:40 AAA.java
      -rw-rw-r-- 1 apl9757 isapldev 236 Mar 19 09:41 BBB.class
      -rw-rw-r-- 1 apl9757 isapldev 25 Mar 19 09:40 BBB.java
      -rw-rw-r-- 1 apl9757 isapldev 214 Mar 19 09:41 CCC.class
      -rw-rw-r-- 1 apl9757 isapldev 16 Mar 19 09:40 CCC.java

      #
      # All classes are up to date.
      # Now modify CCC.java
      #

      $ touch CCC.java

      $ ls -l
      total 12
      -rw-rw-r-- 1 apl9757 isapldev 236 Mar 19 09:41 AAA.class
      -rw-rw-r-- 1 apl9757 isapldev 25 Mar 19 09:40 AAA.java
      -rw-rw-r-- 1 apl9757 isapldev 236 Mar 19 09:41 BBB.class
      -rw-rw-r-- 1 apl9757 isapldev 25 Mar 19 09:40 BBB.java
      -rw-rw-r-- 1 apl9757 isapldev 214 Mar 19 09:41 CCC.class
      -rw-rw-r-- 1 apl9757 isapldev 16 Mar 19 09:42 CCC.java

      #
      # CCC.java is now out of date with its class file
      # Try recompiling from AAA.java with -depend
      #

      $ javac -depend -classpath /export/products/java.tools/JDK/lib/classes.zip:. AAA.java

      $ ls -l
      total 12
      -rw-rw-r-- 1 apl9757 isapldev 236 Mar 19 09:42 AAA.class
      -rw-rw-r-- 1 apl9757 isapldev 25 Mar 19 09:40 AAA.java
      -rw-rw-r-- 1 apl9757 isapldev 236 Mar 19 09:41 BBB.class
      -rw-rw-r-- 1 apl9757 isapldev 25 Mar 19 09:40 BBB.java
      -rw-rw-r-- 1 apl9757 isapldev 214 Mar 19 09:41 CCC.class
      -rw-rw-r-- 1 apl9757 isapldev 16 Mar 19 09:42 CCC.java

      #
      # javac -depend does not recompile CCC.java
      #

            dstoutamsunw David Stoutamire (Inactive)
            drcarlso Darin Carlson
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: