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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Won't Fix
    • Affects Version/s: 1.1.8, 1.2.0
    • Fix Version/s: None
    • Component/s: tools
    • Subcomponent:
    • CPU:
      generic, x86
    • OS:
      solaris_2.5.1, windows_nt

      Description

      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

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: