< prev index next >
src/java.base/share/classes/jdk/internal/org/objectweb/asm/util/CheckMethodAdapter.java
Print this page
rev 52979 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: TBD
@@ -1312,11 +1312,11 @@
* @param version the class version.
* @param name the string to be checked.
* @param message the message to use in case of error.
*/
static void checkMethodIdentifier(final int version, final String name, final String message) {
- if (name == null || name.length() == 0) {
+ if (name == null || name.isEmpty()) {
throw new IllegalArgumentException(INVALID + message + MUST_NOT_BE_NULL_OR_EMPTY);
}
if ((version & 0xFFFF) >= Opcodes.V1_5) {
for (int i = 0; i < name.length(); i = name.offsetByCodePoints(i, 1)) {
if (".;[/<>".indexOf(name.codePointAt(i)) != -1) {
@@ -1345,11 +1345,11 @@
* @param version the class version.
* @param name the string to be checked.
* @param message the message to use in case of error.
*/
static void checkInternalName(final int version, final String name, final String message) {
- if (name == null || name.length() == 0) {
+ if (name == null || name.isEmpty()) {
throw new IllegalArgumentException(INVALID + message + MUST_NOT_BE_NULL_OR_EMPTY);
}
if (name.charAt(0) == '[') {
checkDescriptor(version, name, false);
} else {
@@ -1455,11 +1455,11 @@
*
* @param version the class version.
* @param descriptor the string to be checked.
*/
static void checkMethodDescriptor(final int version, final String descriptor) {
- if (descriptor == null || descriptor.length() == 0) {
+ if (descriptor == null || descriptor.isEmpty()) {
throw new IllegalArgumentException("Invalid method descriptor (must not be null or empty)");
}
if (descriptor.charAt(0) != '(' || descriptor.length() < 3) {
throw new IllegalArgumentException(INVALID_DESCRIPTOR + descriptor);
}
< prev index next >