Deprecated method used in the "Example 4.3.1-1. Object Creation" of paragraph "4.3.1 Objects". Small "Java Language Specification" improvement.

Alex Buckley alex.buckley at oracle.com
Fri Jun 10 17:14:47 UTC 2022


Yes, a known issue: https://bugs.openjdk.org/browse/JDK-8280602

On 6/9/2022 1:29 AM, Dmitri Cerkas wrote:
>   Hello JLS Team,
> in the "Example 4.3.1-1. Object Creation" of paragraph "4.3.1 Objects" (page 64 of "The Java Language Specification Java SE 18 Edition") you can see:
> ".............try {     p = (Point)Class.forName("Point").newInstance(); } catch (Exception e) {     System.out.println(e); } ............"
> 
> but if you view the JavaDoc comment to "newInstance()" method of "java.lang.Class" you can read:
> "........... at deprecated..........The call{@code
> clazz.newInstance()}
> can be replaced by
> 
> {@code
> clazz.getDeclaredConstructor().newInstance()}.........."
> So the "Example 4.3.1-1. Object Creation" of paragraph "4.3.1 Objects" (page 64 of "The Java Language Specification Java SE 18 Edition") should become:
> ".............try {     p = (Point)Class.forName("Point").getDeclaredConstructor().newInstance(); } catch (Exception e) {     System.out.println(e); } ............"
> 
> Thank you,Dmitri.
> 
> 
> 
> 
> 
>      On Friday, May 20, 2022, 09:36:39 AM GMT+2, Dmitri Cerkas <dmitricerkas at yahoo.com> wrote:
>   
>    Hello JLS Team,
> in the introduction block of Chapter 4 "Types, Values, and Variables" (page 53 of "The Java Language Specification Java SE 18 Edition") you can read:
> "The reference types (§4.3) are class types, interface types, and array types.
> "
> so it seems that there are ONLY three kinds of reference types in Java, but in the paragraph "4.3 Reference Types and Values" you can read:
> "There are FOUR kinds of reference types: class types (§8.1), interface types (§9.1), type variables (§4.4), and array types (§10.1)."
> So the phrase in the introduction block of Chapter 4 "Types, Values, and Variables" (page 53 of "The Java Language Specification Java SE 18 Edition") should be:
> "The reference types (§4.3) are class types, interface types, type variables, and array types.
> "
> Thank you,Dmitri.
> 
> 
>      On Thursday, January 20, 2022, 04:27:47 PM GMT+1, Dmitri Cerkas <dmitricerkas at yahoo.com> wrote:
>   
>    Hello JLS Team,
> at the begining of the "3.10.2" paragraph of Java Language Specification (starting from the version 6 and up) you can read:"A floating-point literal has the following parts: a whole-number part, a decimal or hexadecimal point (represented by an ASCII period character), a fraction part, an exponent, and a type suffix"
> So this implies that decimal floating-point literal has the following parts:1) a whole-number part,2) a decimal point,3) a fraction part,4) an exponent,5) and a type suffix.
> and below in the same "3.10.2" paragraph you can read:"For decimal floating-point literals, at least one digit (in either the whole number orthe fraction part) and either a decimal point, an exponent, or a float type suffix arerequired. All other parts are optional. The exponent, if present, is indicated by theASCII letter e or E followed by an optionally signed integer."
> So parts that are required for decimal floating-point literals are:a) at least one digit (in either the whole number or the fraction part)     (this corresponds to "1) a whole-number part" and "3) a fraction part" above)
> b) and either a decimal point    (this corresponds to "2) a decimal point" above) c) an exponent    (this corresponds to "4) an exponent" above) d) a float type suffix    (this corresponds to "5) and a type suffix" above)
> So the phrase "All other parts are optional." is wrong because all parts are already listed.
> I thing that the phrase "All other parts are optional." should be removed and description of what is required for decimal floating-point literals becomes:"For decimal floating-point literals, at least one digit (in either the whole number or the fraction part) and either a decimal point, an exponent, or a float type suffix are required. The exponent, if present, is indicated by the ASCII letter e or E followed by an optionally signed integer."
> Thank you,Dmitri.
> 
>      On Tuesday, January 11, 2022, 11:56:52 AM GMT+1, Dmitri Cerkas <dmitricerkas at yahoo.com> wrote:
>   
>    Hello JLS Team,
> if you look at "Table of Contents" of the "Java Language Specification" and, in particular, at the structure of Chapter 4 "Types, Values, and Variables", you can see the following substructure:
> "4.2 Primitive Types and Values 54 4.2.1 Integral Types and Values 55 4.2.2 Integer Operations 55 4.2.3 Floating-Point Types and Values 57 4.2.4 Floating-Point Operations 59 4.2.5 The boolean Type and boolean Values 61"
> , where:
>   1) "4.2.1 Integral Types and Values" contains info about possible values of 5 integral types,2) "4.2.2 Integer Operations" tells about possible operations on integral values,3) "4.2.3 Floating-Point Types and Values"  contains info about possible values of 2 floating-point types,
> 4) "4.2.4 Floating-Point Operations" tells about possible operations on floating-point values.
> If you look, however, at the content of "4.2.5 The boolean Type and boolean Values" you can note that this paragraph speak both: 1) about possible values of boolean type and 2) about possible operations on boolean type.
> I know this might sound too picky, but logically, the paragraph "4.2.5" should be: "4.2.5 The boolean Type, boolean Values and boolean operations."
> 
> Thank you,Dmitri.
> 
> 
>      On Tuesday, December 21, 2021, 07:05:19 PM GMT+1, Alex Buckley <alex.buckley at oracle.com> wrote:
>   
>    From your mention of pull requests, I presume you're thinking about the
> OpenJDK source code hosted at https://github.com/openjdk/jdk/
> 
> You can make pull requests against that repo to improve the Java API
> specs -- "the javadoc" -- which might be what you mean by "Java
> documentation". Here's a recent example of someone doing that:
> 
>    https://github.com/openjdk/jdk/pull/6076
> 
> To learn more about contributing to OpenJDK, please see:
> 
>    https://openjdk.java.net/guide/
> 
> You may wish to mail the `discuss` list at OpenJDK to ask for help
> getting started with changes to the API specs:
> 
>    https://mail.openjdk.java.net/mailman/listinfo/discuss
> 
> The Java Language Specification and the JVM Specification are not part
> of OpenJDK. They are not hosted on Github.com and Oracle does not
> support making pull requests against them. Please use the list mentioned
> in the "Feedback" section to report technical errors in the JLS.
> 
> Alex
> 
> On 12/21/2021 7:51 AM, Dmitri Cerkas wrote:
>> Alex, thank you very much for quick response!
>>
>> I see on "https://jcp.org/en/participation/membership
>> <https://jcp.org/en/participation/membership>" page that there is the
>> opportunity to become a member of JCP program (the same I'm member of
>> "Jakarta EE" Community).
>>
>> May be this solution is best - I found various imperfections carefully
>> reading "The Java Language Specification" and opening direct Pull
>> Requests as JCP member is more practical I think. In addition (as a
>> member) I could improve Java documentation in general, as I did and do
>> for "Jakarta EE".
>>
>> Thank you again!
>>
>> Have a nice day,
>> Dmitri.
>>
>>
>>
>>
>> On Monday, December 20, 2021, 06:10:24 PM GMT+1, Alex Buckley
>> <alex.buckley at oracle.com> wrote:
>>
>>
>> Dmitri,
>>
>> Please see JLS section 1.6 "Feedback":
>>
>> https://docs.oracle.com/javase/specs/jls/se17/html/jls-1.html#jls-1.6
>> <https://docs.oracle.com/javase/specs/jls/se17/html/jls-1.html#jls-1.6>
>>
>> Alex
>>
>> On 12/20/2021 5:42 AM, Bernard Traversat wrote:
>>    > FYI,
>>    >
>>    > Cheers,
>>    >
>>    > B.
>>    >
>>    > On 12/20/21, 2:58 AM, "Dmitri Cerkas" <dmitricerkas at yahoo.com
>> <mailto:dmitricerkas at yahoo.com>
>>    > <mailto:dmitricerkas at yahoo.com <mailto:dmitricerkas at yahoo.com>>> wrote:
>>    >
>>    > Hello Community,
>>    >
>>    > I have some small suggestions on "Java Language Specification" content
>>    > improvements. How can I communicate them to you? Do you have a
>>    > repository (GitHub, for example) where I could post an Issue or a Pull
>>    > Request?
>>    >
>>    > Thank you very much!
>>    >
>>    > Have a nice day,
>>    >
>>    > Dmitri.
>>    >
>          


More information about the jls-jvms-spec-comments mailing list