[jdk16] RFR: 8257596: Clarify trusted final fields for record classes [v3]
Mandy Chung
mchung at openjdk.java.net
Fri Dec 11 19:45:13 UTC 2020
> This is a follow-up on JDK-8255342 that removes non-specified JVM checks on classes with RecordComponents attributes.
>
> See the discussion at https://mail.openjdk.java.net/pipermail/amber-spec-experts/2020-December/002670.html
>
> That fixes trusting final fields of records to align with the JLS definition of a record class. `InstanceKlass::is_record` is fixed to check a record class must be final and a direct subclass of `java.lang.Record` with the presence of the `Record` attribute. There is no change to JVM class file validation. I also propose clearly define:
> - `JVM_IsRecord` returns true if the given class is a record i.e. final and direct subclass of `java.lang.Record` with `Record` attribute
> - `JVM_GetRecordComponents `returns an `RecordComponents` array if `Record` attribute is present; otherwise, returns NULL. This does not check if it's a record class or not. So it may return non-null on a non-record class if it has `Record` attribute. So `JVM_GetRecordComponents` returns the content of the classfile.
>
> tier1-tier3 and jck-runtime:vm and jck-runtime:lang tests all passed.
Mandy Chung has updated the pull request incrementally with one additional commit since the last revision:
Update comments in Class::getRecordComponents0
-------------
Changes:
- all: https://git.openjdk.java.net/jdk16/pull/14/files
- new: https://git.openjdk.java.net/jdk16/pull/14/files/4ebee9b1..f0df17a6
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk16&pr=14&range=02
- incr: https://webrevs.openjdk.java.net/?repo=jdk16&pr=14&range=01-02
Stats: 4 lines in 1 file changed: 1 ins; 0 del; 3 mod
Patch: https://git.openjdk.java.net/jdk16/pull/14.diff
Fetch: git fetch https://git.openjdk.java.net/jdk16 pull/14/head:pull/14
PR: https://git.openjdk.java.net/jdk16/pull/14
More information about the core-libs-dev
mailing list