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

javac *.java behaves differently than compiling each .java file at a time.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Won't Fix
    • Affects Version/s: 1.2.2
    • Fix Version/s: None
    • Component/s: tools
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description



      Name: skT88420 Date: 08/18/99


      When I have another (2nd) class (scope=default) (dbRule) in a .java file (containing another public class), which gets used by other classes where all reside in the default package, compilation goes fine when I compile one java file at a time. If I use javac *.java, then I get the following warning:

      servl.java:3: class dbRule is defined in DataBase.java. Because it is used outside of its source file, it should be defined in a file called "dbRule.java".
              public dbRule getRule() { dbRule rule = new dbRule(); return rule; }
                            ^
      1 warning

      It seems that the compiler is inconsistant, and the warning is meaningless as far as the visibility rules are concerned.
      If you need source code, please send me an E-Mail, I have created a sample code to recreate this.

      Thanks,
      Husni Salka

      Test Case:

      DataBase.java:
      --------------------

      public class DataBase
      {
              private String name;
              public DataBase() {;}
              public void Open() {;}
              public void Close() {;}
      }

      class dbRule
      {
              private String description;

              public String getDesc() { return description; }
              public void setDescription(String desc) { description = desc; }
      }

      servl.java:
      --------------

      public class servl
      {
              public dbRule getRule() { dbRule rule = new dbRule(); return rule; }


              public static void main(String args[])
              {
                      DataBase db = new DataBase();
                      dbRule rule = new dbRule();
                      servl s = new servl();
                      rule = s.getRule();
                      db.Open();
                      db.Close();
              }
      }

      (Review ID: 94065)
      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            iris Iris Clark
            Reporter:
            skonchad Sandeep Konchady
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: