RFR: JDK-8310267: Javadoc for Class#isPrimitive() is incorrect regarding Class objects for primitives

Pavel Rappo prappo at openjdk.org
Fri Jun 23 11:37:04 UTC 2023


On Wed, 21 Jun 2023 00:35:09 GMT, Joe Darcy <darcy at openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/Class.java line 818:
>> 
>>> 816:      * they represent, namely {@code boolean}, {@code byte},
>>> 817:      * {@code char}, {@code short}, {@code int},
>>> 818:      * {@code long}, {@code float}, and {@code double}.
>> 
>> Should we add `{@code void}` to the list here, as this is one of the primitive type names?
>
> Hmm. I'll consider that. The javadoc in java.lang.Class is inconsistent in the formatting of "void" as a type name, some instances are in code markup while others are not.

> @jddarcy and @pavelrappo, as I understood it, @liach is not suggesting that the term "void" in "primitive types and void" should be replaced by `{@code void}`.
> 
> Rather, `{@code void}` should be included in the enumeration of primitive types -- for example, by replacing `and {@code double}` with `{@code double}, and {@code void}`.

AFAIK, that sentence enumerates primitive types, which according to the Java Language Specification [^1][^2], do not include `void`.

[^1]: https://docs.oracle.com/javase/specs/jls/se20/html/jls-4.html#jls-4.2
[^2]: https://docs.oracle.com/javase/specs/jls/se20/html/jls-8.html#jls-8.4.5

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/14574#discussion_r1239711787


More information about the core-libs-dev mailing list