< prev index next >
src/java.base/share/classes/sun/invoke/util/BytecodeName.java
Print this page
rev 52979 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: TBD
*** 449,459 ****
* 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;
// 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;
}
--- 449,459 ----
* 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.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,484 ****
private static boolean looksMangled(String s) {
return s.charAt(0) == ESCAPE_C;
}
private static String mangle(String s) {
! if (s.length() == 0)
return NULL_ESCAPE;
// build this lazily, when we first need an escape:
StringBuilder sb = null;
--- 474,484 ----
private static boolean looksMangled(String s) {
return s.charAt(0) == ESCAPE_C;
}
private static String mangle(String s) {
! if (s.isEmpty())
return NULL_ESCAPE;
// build this lazily, when we first need an escape:
StringBuilder sb = null;
< prev index next >