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

javac allows not fully qualified imports

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      merlin
    • CPU:
      sparc
    • OS:
      solaris_2.6
    • Verification:
      Verified

      Description



      Name: sdR10048 Date: 05/03/2000


      The jdk13 compiler allows not fully qualified package names in
      import section.
      In details the Type-Import-on-Demand import of inner classes of the
      already imported class but not fully qualified is allowed.

      the test demonstrating the bug:
      --------------------------------------------------
      import java.awt.*;
      import JobAttributes.*;

      public class Test {
          public static void main(String[] args) {
              System.out.println(JobAttributes.DefaultSelectionType.RANGE.hashCode());
          }
      }

      the output:
      --------------------------------------------------
      [dsv@sword ~/tmp] java -version
      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-B)
      Java HotSpot(TM) Client VM (build 1.3.0-B, interpreted mode)
      [dsv@sword ~/tmp] javac Test.java
      [dsv@sword ~/tmp] java Test
      1
      [dsv@sword ~/tmp]
      --------------------------------------------------
      The JLS says:

      7.5.2 Type-Import-on-Demand Declaration

      A type-import-on-demand declaration allows all public types declared
      in the package named by a fully qualified name to be imported as
                                ^^^^^^^^^^^^^^^
      needed.


             TypeImportOnDemandDeclaration:

                     import PackageName . * ;

      --------------------------------------------------
      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            busersunw Btplusnull User (Inactive)
            Reporter:
            dsvsunw Dsv Dsv (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: