< 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                 return c.descriptorString();
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
< prev index next >