< 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 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;"));
}
/*
* ==================== 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.isValue() && cl == cl.asValueType()) {
+ out.writeByte(opc_invokevirtual);
+ out.writeShort(cp.getMethodRef(
+ "java/lang/Class",
+ "asValueType", "()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,1504 ----
*
* return "[" + getTypeDescriptor(type.getComponentType());
*/
return type.getName().replace('.', '/');
} else {
! char prefix = type.isValue() && type == type.asValueType() ? 'Q' : 'L';
! return prefix + dotToSlash(type.getName()) + ";";
}
}
/**
* Returns a human-readable string representing the signature of a
< prev index next >