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

single-type-import duplicate declaration of type isn't permitted

XMLWordPrintable

    • sparc
    • solaris_2.5



      Name: vgC55224 Date: 12/02/96


      The section "7.5.1 Single-Type-Import Declaration" of The Java Language
      Specification contains the following:

      "If two single-type-import declarations in the same compilation unit attempt to import types with the same simple name, then a compile-time error occurs, unless the two types are the same type, in which case the duplicate declaration is ignored. "


      Java compiler (JDK1.1) produces error message.

      > jac11 -d . pkgs02102.java
      tests/lang/PKGS/pkgs021/pkgs02102/pkgs02102.java:8: Ambiguous class: java.util.Vector and java.util.Vector
      import java.util.Vector;
      ^
      1 error

      --------------------------pkgs02102.java------------------------------
      package javasoft.sqe.tests.lang.pkgs021.pkgs02102;

      import java.io.PrintStream;
      import java.util.Vector;
      import java.util.Vector;

      public class pkgs02102 {
        public static void main(String argv[]) {
           System.exit(run(argv, System.out) + 95/*STATUS_TEMP*/);
        }
        public static int run(String argv[],PrintStream out) {
           Vector cl;
           return 0;
        }
      }
      -----------------------------------------------------------------

      ======================================================================

            Unassigned Unassigned
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: