[lworld] RFR: 8377009: [lworld] StrictInstanceFieldsTest.java and StrictStaticFieldsTest.java fail with jasm failed

Chen Liang liach at openjdk.org
Tue Feb 17 05:14:40 UTC 2026


On Fri, 13 Feb 2026 23:19:24 GMT, Matias Saavedra Silva <matsaave at openjdk.org> wrote:

> With the addition of JTREG 8.2.1 we have asmtools support for strict instance and strict static fields. The jasm tests have been updated to work with the new asmtools version and the main tests were adjusted to work with the StrictProcessor.

src/java.base/share/classes/java/lang/reflect/Field.java line 290:

> 288:      * @since Valhalla
> 289:      */
> 290:     public boolean isStrictInit() {

Thanks very much for this missing API; indeed we need this given we have `isSynthetic` and `isEnumConstant`. That said, I recommend the following changes to fulfill the API standards: (Also note strict fields does not exist in the JLS)


Suggestion:

    /**
     * Returns {@code true} if this field is a strictly
     * initialized field; returns {@code false} otherwise.
     *
     * @return true if and only if this field is a strictly
     * initialized field as defined by the Java Virtual Machine Specification
     * @jvms strict-fields-4.5 Field access and property flags
     * @since Valhalla
     */
    @PreviewFeature(feature = PreviewFeature.Feature.STRICT_FIELDS, reflective = true)
    public boolean isStrictInit() {


Also need to import

import jdk.internal.javac.PreviewFeature;

in the import section.

-------------

PR Review Comment: https://git.openjdk.org/valhalla/pull/2110#discussion_r2815011241


More information about the valhalla-dev mailing list