RFR: 8366584: Add an InstanceKlass::super() method that returns InstanceKlass*
Coleen Phillimore
coleenp at openjdk.org
Tue Sep 2 11:49:45 UTC 2025
On Tue, 2 Sep 2025 11:43:01 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:
>> src/hotspot/share/oops/instanceKlass.hpp line 924:
>>
>>> 922: // always an InstanceKlass (or nullptr)
>>> 923: InstanceKlass* super() const {
>>> 924: return (Klass::super() == nullptr) ? nullptr : InstanceKlass::cast(Klass::super());
>>
>> Is it better/simpler/cleaner to just do:
>>
>> return static_cast<InstanceKlass*>(Klass::super());
>>
>> ?
>
> I think the term is "hides" not "shadows". InstanceKlass::cast() is better - one additional check that super is always another InstanceKlass.
Do we still need java_super ?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27037#discussion_r2315827420
More information about the hotspot-dev
mailing list