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

Compiler allows a top-level class and a package of the same name to co-exist

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_2.5.1

      Description

      Inner classes whitepaper says,

      "Nested classes of all sorts (top-level or inner) can
      be imported by either kind of import statement. Class
      names in import statements must be fully package qualified,
      and be resolvable without reference to inheritance relations.
      As in Java 1.0 it is illegal for a class and a package of the
      same name to co-exist".

      Since the context of the statement compraises any kind of nested
      classes (inner and top-level), we conclude the piece of Java code
      below ought to make compiler report an error. However, jdk12beta2
      (build JDK12U) compiler does not report any error messages, during
      compiling the following program:

      package P;
      class A {
      static class P {}
      }

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              tturnidgsunw Todd Turnidge (Inactive)
              Reporter:
              oulyankisunw Oleg Ulyankin (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: