< prev index next >

src/jdk.jextract/share/classes/com/sun/tools/jextract/Utils.java

Print this page




 191         if (ar[0] == '[') {
 192             int depth = 1;
 193             while (ar[depth] == '[') depth++;
 194             sb.append(DescriptorToBinaryName(descriptor.substring(depth)));
 195             for (int i = 0; i < depth; i++) {
 196                 sb.append("[]");
 197             }
 198             return sb.toString();
 199         }
 200 
 201         throw new IllegalArgumentException("Malformed descriptor");
 202     }
 203 
 204     public static Layout getLayout(Type type) {
 205         return LayoutUtils.getLayout(type);
 206     }
 207 
 208     public static Function getFunction(Type type) {
 209         return LayoutUtils.getFunction(type);
 210     }
























 211 }


 191         if (ar[0] == '[') {
 192             int depth = 1;
 193             while (ar[depth] == '[') depth++;
 194             sb.append(DescriptorToBinaryName(descriptor.substring(depth)));
 195             for (int i = 0; i < depth; i++) {
 196                 sb.append("[]");
 197             }
 198             return sb.toString();
 199         }
 200 
 201         throw new IllegalArgumentException("Malformed descriptor");
 202     }
 203 
 204     public static Layout getLayout(Type type) {
 205         return LayoutUtils.getLayout(type);
 206     }
 207 
 208     public static Function getFunction(Type type) {
 209         return LayoutUtils.getFunction(type);
 210     }
 211 
 212     public static Class<?> unboxIfNeeded(Class<?> clazz) {
 213         if (clazz == Boolean.class) {
 214             return boolean.class;
 215         } else if (clazz == Void.class) {
 216             return void.class;
 217         } else if (clazz == Byte.class) {
 218             return byte.class;
 219         } else if (clazz == Character.class) {
 220             return char.class;
 221         } else if (clazz == Short.class) {
 222             return short.class;
 223         } else if (clazz == Integer.class) {
 224             return int.class;
 225         } else if (clazz == Long.class) {
 226             return long.class;
 227         } else if (clazz == Float.class) {
 228             return float.class;
 229         } else if (clazz == Double.class) {
 230             return double.class;
 231         } else {
 232             return clazz;
 233         }
 234     }
 235 }
< prev index next >