Integrated: 8361292: Rename ModuleEntry::module() to module_oop()

Ioi Lam iklam at openjdk.org
Thu Jul 3 16:55:46 UTC 2025


On Wed, 2 Jul 2025 17:33:40 GMT, Ioi Lam <iklam at openjdk.org> 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()

This pull request has now been integrated.

Changeset: 66836d40
Author:    Ioi Lam <iklam at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/66836d40b80f9c5482c1322d1d07f078ad9dcc02
Stats:     35 lines in 12 files changed: 0 ins; 0 del; 35 mod

8361292: Rename ModuleEntry::module() to module_oop()

Reviewed-by: coleenp, ccheung, sspitsyn

-------------

PR: https://git.openjdk.org/jdk/pull/26102


More information about the serviceability-dev mailing list