RFR (S): 8238460: Provide warnings about the use of JNI RegisterNatives to rebind native methods for boot/platform classes in other classloaders
David Holmes
david.holmes at oracle.com
Thu Feb 6 23:13:17 UTC 2020
Hi Lois,
On 7/02/2020 7:02 am, Lois Foltan wrote:
> On 2/4/2020 7:41 PM, David Holmes wrote:
>> bug: https://bugs.openjdk.java.net/browse/JDK-8238460
>> webrev: http://cr.openjdk.java.net/~dholmes/8238460/webrev/
>>
>> This small enhancement adds some usage warnings to the JNI
>> specification - see details in bug report - and a runtime warning in
>> the JNI RegisterNatives code, covering the case where platform native
>> methods get rebound by code that is not part of the platform. This is
>> needed by native agents, but may be unexpected in other contexts,
>> hence a warning is issued.
>>
>> A test is added to exercise the warning.
>>
>> Other testing: tiers 1-3
>>
>> The actual spec edit is not part of this RFR as the specs themselves
>> are not open-source.
>>
>> Thanks,
>> David
>
> Looks good, some minor comments:
Thanks for the review.
> prims/jni.cpp
> - line #2931 - Consider calling
> SystemDictionary::is_platform_class_loader(cl) instead of manually
> comparing cl to SystemDictionary::java_platform_loader().
Fixed.
> - line #2598 - Can you change to ResourceMark rm(THREAD)? And while in
> this method, maybe the ResourceMark on line #2950 as well.
Fixed.
Thanks,
David
> Thanks,
> Lois
More information about the hotspot-runtime-dev
mailing list