RFR 8169435 : ClassLoader.isParallelCapable is final and conflicting method may get VerifyError

David Holmes david.holmes at oracle.com
Thu Nov 10 22:56:48 UTC 2016



On 11/11/2016 8:46 AM, Mandy Chung wrote:
>
>> On Nov 10, 2016, at 2:28 PM, Peter Levart <peter.levart at gmail.com> wrote:
>>
>> On 11/10/2016 05:59 PM, Alan Bateman wrote:
>>>
>>>
>>> On 10/11/2016 17:42, David M. Lloyd wrote:
>>>> My original suggestion for the method was to make it static, and possibly even caller-sensitive, for just this reason.
>>> Changing it to be non-final looks reasonable here, the main reason being that it's a no-arg isXXXX method and so unlikely that there are custom class loaders that have a method with this name that returns something other than boolean. However the modifier might be a concern and so time will tell if there are custom class loaders that defining a non-public no-arg method with this name.
>>>
>>> -Alan
>>
>> It would be nice for this method to be final.
>
> That’d be the ideal case.
>
>> This way it could be relied on to return the "correct" answer regardless of the implementation subclass. Who knows, maybe some internal logic might need this method in the future and at that time another package-protected method would have to be added and exposed via SharedSecrets or similar. If "isParallelCapable" is already taken, then what about choosing another name?
>
> This is alternative but it’s hard to predict the probability of a name clash with existing subclass implementation.
>
>> Since there is already a @CallerSensitive protected static method called "registerAsParallelCapable" for subclasses to call from their <clinit> blocks, the query could be called:
>>
>> isRegisteredAsParallelCapable() ?
>>
>> I doubt this name is already taken by any subclass out there…
>
> isRegisteredAsParallelCapable may be okay.

I'd vote for that and keeping it final.

Thanks,
David

> Mandy
>


More information about the core-libs-dev mailing list