commit | e261712f619225e40dc5d165e14d4c7a780c67d8 | [log] [tgz] |
---|---|---|
author | Holger Voormann <eclipse@voormann.de> | Mon May 10 20:13:01 2021 +0200 |
committer | Fabrice Tiercelin <fabrice.tiercelin@yahoo.fr> | Tue May 11 00:34:59 2021 -0400 |
tree | 70e93aaaf7d79443ab9f529f67c573b2859cf667 | |
parent | 468b48fa7d363de5d6498701eaf65e9d941d4ef1 [diff] |
Bug 573289 - [cleanup] String.strip().isEmpty() => String.isBlank() String.isBlank() rather than String.strip().isEmpty() String.isBlank() is shorter than checking the stripped string or checking the length of the stripped string and it avoids the creation of an intermediate trimmed string. To apply the cleanup also to String.trim().isEmpty() (which is probably more common than String.strip().isEmpty(), since strip() exists only since Java 11), trim() must first be replaced by strip() which may change the runtime behavior. Given: if (input.strip().isEmpty()) { System.err.println("Input must not be blank"); } boolean hasComment = comment.strip().length() > 0; When: Clean up the code enabling "String.isBlank() rather than String.strip().isEmpty()" and using Java 11 or higher Then: if (input.isBlank()) { System.err.println("Input must not be blank"); } boolean hasComment = !comment.isBlank(); Also use Java 12 Runtime jar for the Java 11 tests instead of Java 10 Runtime jar Change-Id: I072b6e18fa951ab9901e3363b55be2c18654888f Signed-off-by: Holger Voormann <eclipse@voormann.de> Reviewed-on: https://git.eclipse.org/r/c/jdt/eclipse.jdt.ui/+/180067 Tested-by: JDT Bot <jdt-bot@eclipse.org> Reviewed-by: Fabrice Tiercelin <fabrice.tiercelin@yahoo.fr>
Thanks for your interest in this project.
The JDT UI implements the user interface for the Java IDE. This includes views like Package Explorer and JUnit, the Java and properties files editors, Java search, and refactorings. Website: http://www.eclipse.org/jdt/ui/
Contributions to JDT UI are most welcome. There are many ways to contribute, from entering high quality bug reports, to contributing code or documentation changes. For a complete guide, see the [How to Contribute] 1 page on the team wiki.
Information regarding source code management, builds, coding standards, and more.
Before your contribution can be accepted by the project, you need to create and electronically sign the Eclipse Foundation Contributor License Agreement (CLA).
Public forum for Eclipse JDT users.
This project uses Bugzilla to track ongoing development and issues.
Be sure to search for existing bugs before you create another one. Remember that contributions are always welcome!
Contact the project developers via the project's “dev” list.