On Wed, 2 Jul 2025 18:14:57 GMT, Ioi Lam <[email protected]> wrote:
>> A module has both a Java and a C++ representation
>>
>> - C++: `ModuleEntry`
>> - Java: `java.lang.Module`
>>
>> In C++, we have the following two methods
>>
>> - `ModuleEntry* InstanceKlass::module()`
>> - `oop ModuleEntry::module()`
>>
>> This can lead to confusing code like this:
>>
>>
>> InstanceKlass* ik = ...;
>> oop module = ik->module()->module()
>>
>>
>> Proposal:
>>
>> - Leave `InstanceKlass::module()` as is -- there's another function with the
>> same style: `PackageEntry* InstanceKlass::package()`
>> - Rename `ModuleEntry::module()` to `ModuleEntry::module_oop()`, so the
>> above example can be more readable:
>>
>>
>> InstanceKlass* ik = ...;
>> oop module = ik->module()->module_oop()
>
> Ioi Lam has updated the pull request incrementally with one additional commit
> since the last revision:
>
> @coleenp comments
Looks good.
src/hotspot/share/classfile/moduleEntry.cpp line 52:
> 50: ModuleEntry* ModuleEntryTable::_javabase_module = nullptr;
> 51:
> 52: oop ModuleEntry::module_oop() const { return _module_handle.resolve(); }
(Pre-existing) Just wondering why this one-liner function doesn't reside in the
moduleEntry.hpp?
-------------
Marked as reviewed by ccheung (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/26102#pullrequestreview-2980677723
PR Review Comment: https://git.openjdk.org/jdk/pull/26102#discussion_r2181000093