On Tue, 21 Apr 2026 18:02:28 GMT, Chen Liang <[email protected]> wrote:
> ReflectionFactory.newConstructorForSerializatoin might bypass strict > initialization. We should make sure the skipped classes in the constructor > chain do not declare strict instance fields. > > This updates the specification of jdk.unsupported's ReflectionFactory to > reflect this behavioral update. > > --------- > - [x] I confirm that I make this contribution in accordance with the [OpenJDK > Interim AI Policy](https://openjdk.org/legal/ai). src/java.base/share/classes/jdk/internal/reflect/MethodHandleAccessorFactory.java line 123: > 121: * @throws UnsupportedOperationException if the constructor is not > from > 122: * a superclass, if the instantiated class is a value class, > or if > 123: * any superclass between the declaring class of the > constructor and The "any superclass" rule should apply to value classes too. (Here's how I described it in the serialization spec: "Then, in superclass-to-subclass order, starting with the first superclass that implements Serializable: if the class is a value class, or if it declares an instance field with the ACC_STRICT_INIT field modifier (see [JVMS 4.5](https://cr.openjdk.org/~dlsmith/jep401/jep401-20260518/specs/strict-fields-jvms.html#jvms-4.5)), an InvalidClassException is thrown.") ------------- PR Review Comment: https://git.openjdk.org/valhalla/pull/2350#discussion_r3276400839
