Re: Way too much time spent with Eclipse
Daniel Dyer wrote:
The confusion probably stems from the fact that this statement was not
in the previous version of the JLS and (prior to JDK 1.4) Sun's compiler
did allow classes from the unnamed/default package to be used from named
packages.
Somewhere in the last five years they must have lost the excuse to be confused
by that. "Prior to JDK 1.4" is already obsolete, and long since.
The JLS second edition did have some restrictions on the unnamed type, but
they were implicit. For example,
<http://java.sun.com/docs/books/jls/second_edition/html/packages.doc.html#70209>
A type-import-on-demand declaration (?7.5.2) imports all the accessible types
of a named type or package as needed.
Note that it explicitly refers to a named type or package. That leaves
single-type-import declarations as the only way to pull in classes from the
unnamed (not "default") package, equivalent to having no import in such a case.
It remains that the changes to that part of the JLS are three years old now,
and after all this time one should no more be stuck in the old way about the
unnamed package than about the memory model.
--
Lew