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 f5b8848b484..13662aa252b 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, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2022, 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 @@ -114,7 +114,7 @@ public interface ObjectReference extends Value { * Sets the value of a given instance or static field in this object. * The {@link 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 static, the field must not be final. + * The field must not be final. *

* Object values must be assignment compatible with the field type * (This implies that the field type must be loaded through the @@ -129,7 +129,7 @@ public interface ObjectReference extends Value { * @param field the field containing the requested value * @param value the new value to assign * @throws java.lang.IllegalArgumentException if the field is not valid for - * this object's class. + * this object's class or the field is final. * @throws InvalidTypeException if the value's type does not match * the field's type. * @throws ClassNotLoadedException if 'value' is not null, and the field diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/setValue/setvalue004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/setValue/setvalue004.java index 9256f28003e..d14b635c39f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/setValue/setvalue004.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/setValue/setvalue004.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2022, 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 @@ -45,7 +45,7 @@ import nsk.share.jdi.*; * com.sun.jdi.ObjectReference.setValue() * properly throws IllegalArgumentException when a * debugger part of the test attempts to set value of - * debuggee's static field which is declared as final.
+ * debuggee's final field. */ public class setvalue004 { static final String DEBUGGEE_CLASS = @@ -62,8 +62,8 @@ public class setvalue004 { static final String COMMAND_READY = "ready"; static final String COMMAND_QUIT = "quit"; - static final int FLDS_NUM = 9; static final String DEBUGGEE_FLDS[] = { + // static final fields "sByteFld", "sShortFld", "sIntFld", @@ -72,7 +72,17 @@ public class setvalue004 { "sDoubleFld", "sCharFld", "sBooleanFld", - "sStrFld" + "sStrFld", + // instance final fields + "iByteFld", + "iShortFld", + "iIntFld", + "iLongFld", + "iFloatFld", + "iDoubleFld", + "iCharFld", + "iBooleanFld", + "iStrFld" }; private Log log; @@ -141,16 +151,16 @@ public class setvalue004 { rType = objRef.referenceType(); // provoke the IllegalArgumentException - for (int i=0; i