RFR: 8349145: Make Class.getProtectionDomain() non-native [v4]
David Holmes
dholmes at openjdk.org
Mon Feb 10 10:12:11 UTC 2025
On Thu, 6 Feb 2025 12:12:59 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
>> I am still missing what can actually set a PD here, sorry. ??
>
> Because the field is final, it has to be initialized in the constructor in Java code. My initial patch for modifiers chose to initialize to zero but that's not quite correct. The constructor cannot be called nor can it be made accessible with setAccessible(). So the constructor for java.lang.Class is essentially the Hotspot code JavaClasses::create_mirror(). This is where the PD is assigned.
Okay so this pattern of assigning the final fields in the constructor that is never called is just for appeasing the javac compiler.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23396#discussion_r1948769808
More information about the hotspot-dev
mailing list