JDK-8215281 : Use String.isEmpty() when applicable in java.base
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 8,11,12
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2018-12-12
  • Updated: 2021-03-01
  • Resolved: 2018-12-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 12 JDK 13 JDK 8
11.0.10-oracleFixed 12 b24Fixed 13Fixed 8u291Fixed
Related Reports
Relates :  
Description
Patterns like string.length() == 0, string.length() != 0, string.length() > 0 and "".equals(string) are common, especially in older code. Replace with isEmpty when applicable (always for string.length() ==/!=/> 0, when string can't be null for "".equals(string)
Comments
We looked at this one for an 8u backport. It doesn't apply cleanly and it makes little sense to attempt to backport it. For that reason I've marked it "jdk8u-fix-no", to mark the fact that we investigated and it shouldn't be backported.
10-02-2021

Fix Request: Requesting backport of this change to JDK11 updates. The main reason to bring this down to JDK11u is that it'll ease backporting of later changes which otherwise run into conflicts and won't resolve. Furthermore, the original change is a nice cleanup and improves performance. As the patch does not apply cleanly, a review thread was started: https://mail.openjdk.java.net/pipermail/jdk-updates-dev/2019-June/001282.html Patch will be tested in SAP's testing environment. JDK-8215380 needs to / will be be brought along.
18-06-2019