< prev index next >

src/java.base/share/classes/java/lang/reflect/ProxyGenerator.java

Print this page

        

*** 28,39 **** import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; import java.io.File; import java.io.IOException; import java.io.OutputStream; - import java.lang.reflect.Array; - import java.lang.reflect.Method; import java.nio.file.Files; import java.nio.file.Path; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedList; --- 28,37 ----
*** 1410,1432 **** } } /** * Generate code to invoke the Class.forName with the name of the given ! * class to get its Class object at runtime. The code is written to ! * the supplied stream. Note that the code generated by this method ! * may cause the checked ClassNotFoundException to be thrown. */ private void codeClassForName(Class<?> cl, DataOutputStream out) throws IOException { code_ldc(cp.getString(cl.getName()), out); out.writeByte(opc_invokestatic); out.writeShort(cp.getMethodRef( "java/lang/Class", "forName", "(Ljava/lang/String;)Ljava/lang/Class;")); } /* * ==================== General Utility Methods ==================== --- 1408,1439 ---- } } /** * Generate code to invoke the Class.forName with the name of the given ! * class to get its Class object at runtime. And also generate code ! * to invoke Class.asValueBox if the class is regular value type. ! * ! * The code is written to the supplied stream. Note that the code generated ! * by this method may caused the checked ClassNotFoundException to be thrown. */ private void codeClassForName(Class<?> cl, DataOutputStream out) throws IOException { code_ldc(cp.getString(cl.getName()), out); out.writeByte(opc_invokestatic); out.writeShort(cp.getMethodRef( "java/lang/Class", "forName", "(Ljava/lang/String;)Ljava/lang/Class;")); + + if (cl.isInlineClass() && cl == cl.asPrimaryType()) { + out.writeByte(opc_invokevirtual); + out.writeShort(cp.getMethodRef( + "java/lang/Class", + "asPrimaryType", "()Ljava/lang/Class;")); + } } /* * ==================== General Utility Methods ====================
*** 1486,1496 **** * * return "[" + getTypeDescriptor(type.getComponentType()); */ return type.getName().replace('.', '/'); } else { ! return "L" + dotToSlash(type.getName()) + ";"; } } /** * Returns a human-readable string representing the signature of a --- 1493,1508 ---- * * return "[" + getTypeDescriptor(type.getComponentType()); */ return type.getName().replace('.', '/'); } else { ! if (type.isInlineClass()) { ! Class<?> primary = type.asPrimaryType(); ! return (type == primary ? 'Q' : 'L' ) + dotToSlash(primary.getName()) + ";"; ! } else { ! return 'L' + dotToSlash(type.getName()) + ";"; ! } } } /** * Returns a human-readable string representing the signature of a
< prev index next >