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: I6db90845ea19ade65dfaeff43330adf77d72813f
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>
Depends-On: I072b6e18fa951ab9901e3363b55be2c18654888f
4 files changed