RFR: 8349145: Make Class.getProtectionDomain() non-native [v3]

Chen Liang liach at openjdk.org
Mon Feb 3 14:55:49 UTC 2025


On Mon, 3 Feb 2025 14:31:28 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> This change removes the native call and injected field for ProtectionDomain in the java.lang.Class instance, and moves the field to be declared in Java.
>> Tested with tier1-4.
>
> Coleen Phillimore has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:
> 
>  - Hide Class.protectionDomain for reflection and add a test case.
>  - Merge branch 'master' into protection-domain
>  - Fix two tests.
>  - Fix the test.
>  - 8349145: Make Class.getProtectionDomain() non-native

src/java.base/share/classes/jdk/internal/reflect/Reflection.java line 59:

> 57:             Reflection.class, ALL_MEMBERS,
> 58:             AccessibleObject.class, ALL_MEMBERS,
> 59:             Class.class, Set.of("classLoader", "classData", "protectionDomain"),

Can you run a hello world with `-Xlog:class+init` to see if Reflection is initialized after `System$2` or something that implements JavaLangAccess?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23396#discussion_r1939515576


More information about the core-libs-dev mailing list