JDK 9 RFR of 8175335: Improve handling of module types in javax.lang.model.util.Types
Alex Buckley
alex.buckley at oracle.com
Wed Feb 22 02:35:34 UTC 2017
On 2/21/2017 5:37 PM, joe darcy wrote:
> Please review the small spec and implementation changes for
>
> 8175335: Improve handling of module types in
> javax.lang.model.util.Types
> http://cr.openjdk.java.net/~darcy/8175335.0/
>
> which treats pseudo-types for modules similarly to the pseudo-types for
> packages.
Three specific comments:
- Types::erasure(TypeMirror) is one of the family. It should throw IAE
on a module type as well as a package type.
- Types::getNoType(TypeKind) could say "To obtain a pseudo-type for
packages or modules, call asType() on the result of
Elements.getPackageElement(CharSequence) or
Elements.getModuleElement(CharSequence)."
- TypeMirror's spec fails to mention module types in "pseudo-types
corresponding to packages and to the keyword void."
A general comment:
The methods in Types that throw IAE could be clarified. Where they now
say "if given a type for an executable, package, or module", they really
mean "if given a mirror that does not represent a suitable type for the
operation". The Types spec could say "Utility methods for operating on
types. Most methods operate on primitive types, reference types
(including array types and the null type), intersection types, and the
pseudo-type 'void'. Executable types and the pseudo-types for packages
and modules are generally out of scope for these methods."
Alex
More information about the compiler-dev
mailing list