RFR: 8211028 jdb "eval" should allow to create a new value type instance with specified fields
frederic.parain at oracle.com
Thu Oct 24 18:46:23 UTC 2019
Please review this patch allowing the creation of new values of inline types
from the jdb command line.
The patch includes modifications in JNI implementation: NewObject,
NewObjectV and NewObjectA now return a ‘new’ value if the class
passed in arguments is an inline type. This value is initialized
with the arguments passed to the JNI method. The creation is
performed by calling the static factory instead of doing the
new/<init> sequence of identity classes.
Another modification is in the behavior of the JDI method
VirtualMachine.classesByName(String className). The method
now does sometime a second request to the target VM in case
the className could be the name of an inline type. This is an area
which is likely to require some rework at the spec/API level.
The main issue is that, when an user types this command in jdb:
main eval new Foo(1,2,3)
jdb doesn’t know if Foo is the name of an identity class (and
has a L-type signature) or of an inline type (which has a Q-type
signature). The methodclassesByName() takes in argument a type
name as defined in the Java language: “int”, “boolean”, “Foo”
so it is also lacking a key information to generate the right
signature. This is why the temporary hack is to detect if the
legacy transformation from type name to signature includes a
L-type signature (either directly or as an array element) and
in this case, perform a second request with a Q-signature
replacing the L-signature.
jdk/com/sun/jdi tests + new unit test
More information about the valhalla-dev