< prev index next >

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

Print this page

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

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