< prev index next >

src/java.base/share/classes/sun/invoke/util/BytecodeDescriptor.java

Print this page
rev 58715 : imported patch constable
rev 58716 : imported patch type-descriptor-name


 137         return sb.toString();
 138     }
 139 
 140     public static String unparseMethod(Class<?> rtype, Class<?>[] ptypes) {
 141         StringBuilder sb = new StringBuilder();
 142         sb.append('(');
 143         for (Class<?> pt : ptypes)
 144             unparseSig(pt, sb);
 145         sb.append(')');
 146         unparseSig(rtype, sb);
 147         return sb.toString();
 148     }
 149 
 150     private static void unparseSig(Class<?> t, StringBuilder sb) {
 151         char c = Wrapper.forBasicType(t).basicTypeChar();
 152         if (c != 'L') {
 153             sb.append(c);
 154         } else if (t == Object.class) {
 155             sb.append("Ljava/lang/Object;");
 156         } else {
 157             boolean lsemi = (!t.isArray());
 158             if (lsemi)  sb.append('L');
 159             sb.append(t.getName().replace('.', '/'));
 160             if (lsemi)  sb.append(';');
 161         }
 162     }
 163 
 164 }


 137         return sb.toString();
 138     }
 139 
 140     public static String unparseMethod(Class<?> rtype, Class<?>[] ptypes) {
 141         StringBuilder sb = new StringBuilder();
 142         sb.append('(');
 143         for (Class<?> pt : ptypes)
 144             unparseSig(pt, sb);
 145         sb.append(')');
 146         unparseSig(rtype, sb);
 147         return sb.toString();
 148     }
 149 
 150     private static void unparseSig(Class<?> t, StringBuilder sb) {
 151         char c = Wrapper.forBasicType(t).basicTypeChar();
 152         if (c != 'L') {
 153             sb.append(c);
 154         } else if (t == Object.class) {
 155             sb.append("Ljava/lang/Object;");
 156         } else {
 157             sb.append(t.descriptorString());



 158         }
 159     }

 160 }
< prev index next >