Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JDK-8289730 : Deprecated code sample in java.lang.ClassCastException #9359

Closed
wants to merge 7 commits into from

Conversation

scientificware
Copy link
Contributor

@scientificware scientificware commented Jul 4, 2022

This is referenced in Java Bug Database as

This is tracked in JBS as

Description :

  • 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)
    

Designed from : ScientificWare JDK-8289730 : Deprecated code in src/java.base/share/classes/java/lang/ClassCastException.java


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8289730: Deprecated code sample in java.lang.ClassCastException

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/9359/head:pull/9359
$ git checkout pull/9359

Update a local copy of the PR:
$ git checkout pull/9359
$ git pull https://git.openjdk.org/jdk pull/9359/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 9359

View PR using the GUI difftool:
$ git pr show -t 9359

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/9359.diff

How are you dealing with deprecated codes in snippets ?
```
@deprecated(since="9")
public Integer​(int value)
```
Update Copyright date to 2022.
@bridgekeeper
Copy link

bridgekeeper bot commented Jul 4, 2022

👋 Welcome back scientificware! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Jul 4, 2022

@scientificware The following label will be automatically applied to this pull request:

  • core-libs

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the core-libs core-libs-dev@openjdk.org label Jul 4, 2022
@scientificware scientificware changed the title Remove deprecated code. Copyright update. JDK-8289730 : Remove deprecated code. Copyright update. Jul 5, 2022
@openjdk openjdk bot added the rfr Pull request is ready for review label Jul 5, 2022
@scientificware scientificware changed the title JDK-8289730 : Remove deprecated code. Copyright update. JDK-8289730 : Deprecated code in src/java.base/share/classes/java/lang/ClassCastException.java Jul 5, 2022
@mlbridge
Copy link

mlbridge bot commented Jul 5, 2022

Webrevs

Copy link
Member

@jddarcy jddarcy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@scientificware
Copy link
Contributor Author

scientificware commented Jul 5, 2022

@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.

JDK-8289775: Update java.lang.invoke.MethodHandle[s] to use snippets

@scientificware scientificware changed the title JDK-8289730 : Deprecated code in src/java.base/share/classes/java/lang/ClassCastException.java JDK-8289730 : Deprecated code sample in java.lang.ClassCastException Jul 5, 2022
@openjdk
Copy link

openjdk bot commented Jul 5, 2022

@scientificware This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8289730: Deprecated code sample in java.lang.ClassCastException

Reviewed-by: darcy

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 8 new commits pushed to the master branch:

  • c45d613: 8289687: [JVMCI] bug in HotSpotResolvedJavaMethodImpl.equals
  • 77c3bbf: 8289617: Remove test/jdk/java/net/ServerSocket/ThreadStop.java
  • a5934cd: 8289698: AArch64: Need to relativize extended_sp in frame
  • fd1bb07: 8287603: Avoid redundant HashMap.containsKey calls in NimbusDefaults.getDerivedColor
  • 4c997ba: 8289520: G1: Remove duplicate checks in G1BarrierSetC1::post_barrier
  • 1b997db: 8289427: compiler/compilercontrol/jcmd/ClearDirectivesFileStackTest.java failed with null setting
  • 688712f: 8289633: Forbid raw C-heap allocation functions in hotspot and fix findings
  • df063f7: 8289484: Cleanup unnecessary null comparison before instanceof check in java.rmi

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@jddarcy) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jul 5, 2022
@scientificware
Copy link
Contributor Author

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Jul 5, 2022
@openjdk
Copy link

openjdk bot commented Jul 5, 2022

@scientificware
Your change (at version 262d533) is now ready to be sponsored by a Committer.

@scientificware
Copy link
Contributor Author

scientificware commented Jul 5, 2022

@jddarcy, please could you sponsor this PR ?

@turbanoff
Copy link
Member

/sponsor

@openjdk
Copy link

openjdk bot commented Jul 6, 2022

Going to push as commit 4ad18cf.
Since your change was applied there have been 13 commits pushed to the master branch:

  • d8f4e97: 8289146: containers/docker/TestMemoryWithCgroupV1.java fails on linux ppc64le machine with missing Memory and Swap Limit output
  • f783244: 8289706: (cs) Avoid redundant TreeMap.containsKey call in AbstractCharsetProvider
  • fafe8b3: 8289604: compiler/vectorapi/VectorLogicalOpIdentityTest.java failed on x86 AVX1 system
  • 3515604: 8280481: Duplicated stubs to interpreter for static calls
  • d48694d: 8283335: Add exists and readAttributesIfExists methods to FileSystemProvider
  • c45d613: 8289687: [JVMCI] bug in HotSpotResolvedJavaMethodImpl.equals
  • 77c3bbf: 8289617: Remove test/jdk/java/net/ServerSocket/ThreadStop.java
  • a5934cd: 8289698: AArch64: Need to relativize extended_sp in frame
  • fd1bb07: 8287603: Avoid redundant HashMap.containsKey calls in NimbusDefaults.getDerivedColor
  • 4c997ba: 8289520: G1: Remove duplicate checks in G1BarrierSetC1::post_barrier
  • ... and 3 more: https://git.openjdk.org/jdk/compare/9ccae7078e22c27a8f84152f005c628534c9af53...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jul 6, 2022
@openjdk openjdk bot closed this Jul 6, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Jul 6, 2022
@openjdk openjdk bot removed the sponsor Pull request is ready to be sponsored label Jul 6, 2022
@openjdk
Copy link

openjdk bot commented Jul 6, 2022

@turbanoff @scientificware Pushed as commit 4ad18cf.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@scientificware
Copy link
Contributor Author

@turbanoff Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

3 participants