RFR: JDK-8289730 : Deprecated code in src/java.base/share/classes/java/lang/ClassCastException.java
ScientificWare
duke at openjdk.org
Tue Jul 5 18:12:51 UTC 2022
On Tue, 5 Jul 2022 17:27:03 GMT, Joe Darcy <darcy at openjdk.org> wrote:
>> - Correct a deprecated code.
>> - Update Copyright.
>> - More wide question : How are you dealing with deprecated codes in snippets ?
>> ```
>> @deprecated(since="9")
>> public Integer(int value)
>> ```
>
> Looks fine.
>
> There is as of yet no systemic way of dealing with compiler warnings with formal or informal snippet samples, but JEP 413: "Code Snippets in Java API Documentation" is meant to enable that.
@jddarcy Thanks.
In fact this Issue is related to JEP 413, I had a short informal exchange about this with Jonathan Giles one year ago. It seems that Microsoft already validates snippets in its AzureSDK :
https://twitter.com/JonathanGiles/status/1387550356524081154
How JEP 413 process will react with this kind of code ?
/**
* Thrown to indicate that the code has attempted to cast an object
* to a subclass of which it is not an instance. For example, the
* following code generates a {@code ClassCastException}:
* <blockquote><pre>
* Object x = Integer.valueOf(0);
* System.out.println((String)x);
* </pre></blockquote>
*
* @since 1.0
*/
In another word, is there a way to specifiy witch result the author expected.
-------------
PR: https://git.openjdk.org/jdk/pull/9359
More information about the core-libs-dev
mailing list