src/java.base/share/classes/sun/invoke/util/BytecodeName.java
changeset 53018 8bf9268df0e2
parent 47216 71c04702a3d5
equal deleted inserted replaced
53017:e10a1f7aaa13 53018:8bf9268df0e2
   449      * characters are legal in some (or all) names in class files.
   449      * characters are legal in some (or all) names in class files.
   450      * @param s the proposed bytecode name
   450      * @param s the proposed bytecode name
   451      * @return true if the name is non-empty and all of its characters are safe
   451      * @return true if the name is non-empty and all of its characters are safe
   452      */
   452      */
   453     public static boolean isSafeBytecodeName(String s) {
   453     public static boolean isSafeBytecodeName(String s) {
   454         if (s.length() == 0)  return false;
   454         if (s.isEmpty())  return false;
   455         // check occurrences of each DANGEROUS char
   455         // check occurrences of each DANGEROUS char
   456         for (char xc : DANGEROUS_CHARS_A) {
   456         for (char xc : DANGEROUS_CHARS_A) {
   457             if (xc == ESCAPE_C)  continue;  // not really that dangerous
   457             if (xc == ESCAPE_C)  continue;  // not really that dangerous
   458             if (s.indexOf(xc) >= 0)  return false;
   458             if (s.indexOf(xc) >= 0)  return false;
   459         }
   459         }
   474     private static boolean looksMangled(String s) {
   474     private static boolean looksMangled(String s) {
   475         return s.charAt(0) == ESCAPE_C;
   475         return s.charAt(0) == ESCAPE_C;
   476     }
   476     }
   477 
   477 
   478     private static String mangle(String s) {
   478     private static String mangle(String s) {
   479         if (s.length() == 0)
   479         if (s.isEmpty())
   480             return NULL_ESCAPE;
   480             return NULL_ESCAPE;
   481 
   481 
   482         // build this lazily, when we first need an escape:
   482         // build this lazily, when we first need an escape:
   483         StringBuilder sb = null;
   483         StringBuilder sb = null;
   484 
   484