< prev index next >
src/java.base/share/classes/sun/invoke/util/BytecodeName.java
Print this page
rev 51919 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: dfuchs, alanb
@@ -449,11 +449,11 @@
* characters are legal in some (or all) names in class files.
* @param s the proposed bytecode name
* @return true if the name is non-empty and all of its characters are safe
*/
public static boolean isSafeBytecodeName(String s) {
- if (s.length() == 0) return false;
+ if (s.isEmpty()) return false;
// check occurrences of each DANGEROUS char
for (char xc : DANGEROUS_CHARS_A) {
if (xc == ESCAPE_C) continue; // not really that dangerous
if (s.indexOf(xc) >= 0) return false;
}
@@ -474,11 +474,11 @@
private static boolean looksMangled(String s) {
return s.charAt(0) == ESCAPE_C;
}
private static String mangle(String s) {
- if (s.length() == 0)
+ if (s.isEmpty())
return NULL_ESCAPE;
// build this lazily, when we first need an escape:
StringBuilder sb = null;
< prev index next >