Skip to content

Fixes #5558 : Skip JdkObsolete Charset API suggestions when source level lacks them#5648

Open
mirkoalicastro wants to merge 1 commit intogoogle:masterfrom
mirkoalicastro:mirkoalicastro/fix-jdkobsolete-source-version-check
Open

Fixes #5558 : Skip JdkObsolete Charset API suggestions when source level lacks them#5648
mirkoalicastro wants to merge 1 commit intogoogle:masterfrom
mirkoalicastro:mirkoalicastro/fix-jdkobsolete-source-version-check

Conversation

@mirkoalicastro
Copy link

The JdkObsolete checker recommends Charset-accepting API alternatives (for example URLEncoder.encode(String, Charset)) that were only added in JDK 10. Users compiling with --release 9 or lower cannot use the suggested alternatives.

Changes:

  • Adds a jdkVersion field to ObsoleteApi (analogous to the existing androidMinSdkVersion) and checks the compilation source level before reporting these APIs as obsolete.
  • Sets jdkVersion=10 for all entries whose Charset alternatives were introduced in JDK 10.
  • Entries whose Charset alternatives have existed since JDK 1.6 (String, InputStreamReader, ..) are unaffected.

Fixes #5558

@google-cla
Copy link

google-cla bot commented Mar 24, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

URLEncoder.encode(String, String) false positive

2 participants