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

Import of non-existent package does not give compile-time error.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 1.1.8, 1.2.0
    • tools
    • generic, x86
    • solaris_2.5.1, windows_nt

      A type-import-on-demand declaration that names an inaccessible package should throw a compile-time error (JLS 7.5.2).
      Correct behaviour is shown for JDK 1.1.7. For Win32 1.1.8, the compiler does not throw an error if mixed case letters are substituted in an existent package name. For example:

      import java.AWT.*; //no error
      //import jaVa.util.*; //no error
      //import java.foo.*; //error

      public class NonExistPackage {
          public static void main(String argv[]) {
              //do nothing
          }
      }

      The above compiles successfully but should throw an error (as seen for 1.1.8 on Solaris):
      javac NonExistPackage.java
      NonExistPackage.java:1: Package java.AWT not found in import.

      import java.AWT.*; does not actually import java.awt.*;
      This is demonstrated by

      import java.AWT.*;

      public class NonExistPackage {
          public static void main(String argv[]) {
              Label l;
          }
      }

      which throws an error on compilation.


      stuart.lawrence@eng 1998-10-07

            iris Iris Clark
            slawson Stuart Lawson
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: