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

two import declarations with the same simple name do not cause a compile time er

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P4 P4
    • None
    • 1.3.0_03
    • tools
    • x86
    • windows_2000



      Name: mt13159 Date: 09/06/2001


      The JLS, 2ed, section 7.5.1 states:

      "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. If another top level type with the same simple name is otherwise declared in the current compilation unit except by a type-import-on-demand declaration (ยง7.5.2), then a compile-time error occurs."

      However, the following code (assuming org.w3c.dom.Element and oracle.ide.model.Element are both in the classpath) does not produce a compile time error unless code is added to explicitly reference Element:

      import org.w3c.dom.Element;
      import oracle.ide.model.Element;

      public class TestClass
      {}
      (Review ID: 130887)
      ======================================================================

            gafter Neal Gafter (Inactive)
            mthakore Mayank Thakore (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: