< prev index next >

src/java.base/share/classes/jdk/internal/reflect/AccessorGenerator.java

Print this page




 403             } else if (c == Character.TYPE) {
 404                 return "C";
 405             } else if (c == Double.TYPE) {
 406                 return "D";
 407             } else if (c == Float.TYPE) {
 408                 return "F";
 409             } else if (c == Integer.TYPE) {
 410                 return "I";
 411             } else if (c == Long.TYPE) {
 412                 return "J";
 413             } else if (c == Short.TYPE) {
 414                 return "S";
 415             } else if (c == Void.TYPE) {
 416                 return "V";
 417             }
 418             throw new InternalError("Should have found primitive type");
 419         } else if (c.isArray()) {
 420             return "[" + getClassName(c.getComponentType(), true);
 421         } else {
 422             if (addPrefixAndSuffixForNonPrimitiveTypes) {
 423                 return internalize("L" + c.getName() + ";");

 424             } else {
 425                 return internalize(c.getName());
 426             }
 427         }
 428     }
 429 
 430     private static String internalize(String className) {
 431         return className.replace('.', '/');
 432     }
 433 
 434     protected void emitConstructor() {
 435         // Generate code into fresh code buffer
 436         ClassFileAssembler cb = new ClassFileAssembler();
 437         // 0 incoming arguments
 438         cb.setMaxLocals(1);
 439         cb.opc_aload_0();
 440         cb.opc_invokespecial(superCtorIdx, 0, 0);
 441         cb.opc_return();
 442 
 443         // Emit method




 403             } else if (c == Character.TYPE) {
 404                 return "C";
 405             } else if (c == Double.TYPE) {
 406                 return "D";
 407             } else if (c == Float.TYPE) {
 408                 return "F";
 409             } else if (c == Integer.TYPE) {
 410                 return "I";
 411             } else if (c == Long.TYPE) {
 412                 return "J";
 413             } else if (c == Short.TYPE) {
 414                 return "S";
 415             } else if (c == Void.TYPE) {
 416                 return "V";
 417             }
 418             throw new InternalError("Should have found primitive type");
 419         } else if (c.isArray()) {
 420             return "[" + getClassName(c.getComponentType(), true);
 421         } else {
 422             if (addPrefixAndSuffixForNonPrimitiveTypes) {
 423                 final String desc = (c.isIndirectType() ? 'L' : 'Q') + c.getName() + ";";
 424                 return internalize(desc);
 425             } else {
 426                 return internalize(c.getName());
 427             }
 428         }
 429     }
 430 
 431     private static String internalize(String className) {
 432         return className.replace('.', '/');
 433     }
 434 
 435     protected void emitConstructor() {
 436         // Generate code into fresh code buffer
 437         ClassFileAssembler cb = new ClassFileAssembler();
 438         // 0 incoming arguments
 439         cb.setMaxLocals(1);
 440         cb.opc_aload_0();
 441         cb.opc_invokespecial(superCtorIdx, 0, 0);
 442         cb.opc_return();
 443 
 444         // Emit method


< prev index next >