JDK 14 RFR of JDK-8230337: Clarify intention of Elements.{getPackageOf, getModuleOf}

Jonathan Gibbons jonathan.gibbons at oracle.com
Thu Aug 29 21:05:35 UTC 2019


Joe,

The if-otherwise doesn't work here as you might have intended.

If the package doesn't have a module for its enclosing element you
fall into infinitely recursive "otherwise".

-- Jon

On 8/29/19 11:30 AM, Joe Darcy wrote:
>
> +     * If a package has a module as its {@linkplain
> +     * PackageElement#getEnclosingElement enclosing element}, that
> +     * module is the module of the package. Otherwise, the module of
> +     * an element is equal to the module {@linkplain
> +     * #getPackageOf(Element) of the package} of the element.
> +     * 


More information about the compiler-dev mailing list