Skip to content

8361401: Warnings for use of Sun APIs should not be mandatory #26129

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mcimadamore
Copy link
Contributor

@mcimadamore mcimadamore commented Jul 4, 2025

During Java 8, we changed the code that reported use of Sun API warnings (e.g. com.sun.misc.Unsafe) to use Log::mandatoryWarning instead of Log::strictWarning. This change had two effects:

  • warnings for use of Sun API would not be emitted if more than 100 warnings were displayed
  • warnings for use of Sun API would become mandatory warnings

The latter is particularly bad, because the definition of a mandatory warning is that of a warning mandated by the specification. Currently we only use the mandatory status for unchecked, deprecation and preview warnings.

This PR reverts the behavior to what it was before Java 8. That is, the warning for Sun API use is now marked with the STRICT flag -- and Log will not attempt to filter out warnings with such flag. As a result, the (unused) method Log::strictWarning can be removed.

I've tweaked an existing test to check the kind of the Sun API warnings.


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
  • Change requires CSR request JDK-8361402 to be approved

Issues

  • JDK-8361401: Warnings for use of Sun APIs should not be mandatory (Bug - P4)
  • JDK-8361402: Warnings for use of Sun APIs should not be mandatory (CSR)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 26129

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

Using diff file

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

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jul 4, 2025

👋 Welcome back mcimadamore! 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, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk
Copy link

openjdk bot commented Jul 4, 2025

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

  • compiler

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.

@mcimadamore
Copy link
Contributor Author

/csr

@mcimadamore mcimadamore changed the title Warnings for use of Sun APIs should not be mandatory 8361402: Warnings for use of Sun APIs should not be mandatory Jul 4, 2025
@openjdk openjdk bot added the csr Pull request needs approved CSR before integration label Jul 4, 2025
@openjdk
Copy link

openjdk bot commented Jul 4, 2025

@mcimadamore has indicated that a compatibility and specification (CSR) request is needed for this pull request.

@mcimadamore please create a CSR request for issue JDK-8361402 with the correct fix version. This pull request cannot be integrated until the CSR request is approved.

@mcimadamore mcimadamore changed the title 8361402: Warnings for use of Sun APIs should not be mandatory 8361401: Warnings for use of Sun APIs should not be mandatory Jul 4, 2025
@mcimadamore mcimadamore marked this pull request as ready for review July 4, 2025 15:19
@openjdk openjdk bot added the rfr Pull request is ready for review label Jul 4, 2025
@mlbridge
Copy link

mlbridge bot commented Jul 4, 2025

Webrevs

Copy link
Contributor

@lahodaj lahodaj left a comment

Choose a reason for hiding this comment

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

Looks good to me.

Copy link
Contributor

@vicente-romero-oracle vicente-romero-oracle left a comment

Choose a reason for hiding this comment

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

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler [email protected] csr Pull request needs approved CSR before integration rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

3 participants