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

import of class declared in compilation unit: allowed or no?

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 1.4.0
    • Fix Version/s: 5.0
    • Component/s: specification
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      5.0
    • CPU:
      generic
    • OS:
      solaris_8
    • Verification:
      Verified

      Description

      The following test, narrowed down from from jacks 7.5.1-canonical-1,
      distinguishes javac 1.3 from javac 1.4. The spec is not clear whether
      this program is allowed or not. Whichever is intended, the spec should
      be clarified and the compiler brought in line with the spec.

      (If there is a choice, I suggest we consider deeming the old behavior
      as correct, as there are other test suites and compilers that imitate
      that behavior.)

      frog:~/workspaces/test/jikes $ cat -n T.java
           1 package p1;
           2 import p1.T;
           3
           4 class T {
           5 public static void main(String[] args) {
           6 }
           7 }
      frog:~/workspaces/test/jikes $ /java/re/jdk/1.2.2/archive/solaris/bin/javac T.java
      frog:~/workspaces/test/jikes $ /java/re/jdk/1.3.0/archive/solaris/fcs/binaries/solaris/bin/javac T.java
      frog:~/workspaces/test/jikes $ /java/re/jdk/1.4/archive/fcs/binaries/solsparc/bin/javac T.java
      T.java:2: p1.T is already defined in this compilation unit
      import p1.T;
      ^
      1 error
      frog:~/workspaces/test/jikes $

        Attachments

          Activity

            People

            • Assignee:
              abuckley Alex Buckley
              Reporter:
              gafter Neal Gafter
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: