diff --git a/src/jdk.jdi/share/classes/com/sun/jdi/ObjectReference.java b/src/jdk.jdi/share/classes/com/sun/jdi/ObjectReference.java index f53b8acbb8b..33ea1b7ae1f 100644 --- a/src/jdk.jdi/share/classes/com/sun/jdi/ObjectReference.java +++ b/src/jdk.jdi/share/classes/com/sun/jdi/ObjectReference.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,7 +52,20 @@ * takes ObjectReference as parameter may throw * {@link ObjectCollectedException} if the mirrored object has been * garbage collected. - * + *
+ *
+ *

Value Objects

+ * If preview features are enabled, JDI supports value objects and classes. + * However, the support does in some cases deviate from identity object + * support in behavior or expectations as noted below: + *

+ * If an ObjectReference is obtained for a value object under construction, + * it will be for a snapshot of the value object at that point in time. + * Any further changes to the initialization state of the value object will not + * be reflected in this ObjectReference. A new ObjectReference would need to + * be obtained to see the updated state. See {@link StackFrame#thisObject}. + *

+ *
* @author Robert Field * @author Gordon Hirsch * @author James McIlree @@ -87,6 +100,12 @@ public interface ObjectReference extends Value { * The Field must be valid for this ObjectReference; * that is, it must be from * the mirrored object's class or a superclass of that class. + *
+ *
+ * If preview features are enabled, this method does not prevent a + * strictly-initialized field from being read before it has been initialized. + *
+ *
* * @param sig the field containing the requested value * @return the {@link Value} of the instance field. @@ -100,6 +119,12 @@ public interface ObjectReference extends Value { * The Fields must be valid for this ObjectReference; * that is, they must be from * the mirrored object's class or a superclass of that class. + *
+ *
+ * If preview features are enabled, this method does not prevent a + * strictly-initialized field from being read before it has been initialized. + *
+ *
* * @param fields a list of {@link Field} objects containing the * requested values. diff --git a/src/jdk.jdi/share/classes/com/sun/jdi/ReferenceType.java b/src/jdk.jdi/share/classes/com/sun/jdi/ReferenceType.java index 043acc839f7..66664db999d 100644 --- a/src/jdk.jdi/share/classes/com/sun/jdi/ReferenceType.java +++ b/src/jdk.jdi/share/classes/com/sun/jdi/ReferenceType.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -519,7 +519,12 @@ default ModuleReference module() { * The Field must be valid for this type; * that is, it must be declared in this type, a superclass, a * superinterface, or an implemented interface. - * + *
+ *
+ * If preview features are enabled, this method does not prevent a + * strictly-initialized field from being read before it has been initialized. + *
+ *
* @param field the field containing the requested value * @return the {@link Value} of the instance field. * @throws java.lang.IllegalArgumentException if the field is not valid for @@ -533,6 +538,12 @@ default ModuleReference module() { * The Fields must be valid for this type; * that is, they must be declared in this type, a superclass, a * superinterface, or an implemented interface. + *
+ *
+ * If preview features are enabled, this method does not prevent a + * strictly-initialized field from being read before it has been initialized. + *
+ *
* * @param fields a list of {@link Field} objects containing the * requested values. diff --git a/src/jdk.jdi/share/classes/com/sun/jdi/StackFrame.java b/src/jdk.jdi/share/classes/com/sun/jdi/StackFrame.java index 2a0b1718f31..570a167038c 100644 --- a/src/jdk.jdi/share/classes/com/sun/jdi/StackFrame.java +++ b/src/jdk.jdi/share/classes/com/sun/jdi/StackFrame.java @@ -97,10 +97,11 @@ public interface StackFrame extends Mirror, Locatable { * The {@link ObjectReference} for 'this' is only available for * non-native instance methods. *

- * If 'this' is a {@linkplain Class#isValue() value object} under - * construction, the returned {@code ObjectReference} will refer to a - * snapshot of the value object, not a reference to the actual value - * object under construction. Consequently, the returned + * If 'this' is a {@linkplain + * ObjectReference##valueObjects value objectPREVIEW} + * under construction, the returned {@code ObjectReference} will refer to a + * snapshot of the value object, not a reference + * to the actual value object under construction. Consequently, the returned * {@code ObjectReference} will not reflect changes to the value object that * happen later during construction. * diff --git a/src/jdk.jdi/share/classes/com/sun/jdi/Value.java b/src/jdk.jdi/share/classes/com/sun/jdi/Value.java index 42afbc2bfdf..19a0c98d169 100644 --- a/src/jdk.jdi/share/classes/com/sun/jdi/Value.java +++ b/src/jdk.jdi/share/classes/com/sun/jdi/Value.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,6 +31,16 @@ * The mirror for a value in the target VM. * This interface is the root of a * value hierarchy encompassing primitive values and object values. + *

+ *
+ * When preview features are enabled, JDI supports value classes. A "value class" + * as supported in the Java language is not related to the JDI Value interface. + * A "value class" is a class declared with the "value" modifier. The JDI + * Value interface is used by JDI to mirror a value in the debuggee VM. For more + * information on value classes, see Section {@jls value-objects-8.1.1.5 Value Classes} + * of The Java Language Specification. + *
+ *
*

* Some examples of where values may be accessed: *