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

Ioi Lam iklam at openjdk.org
Wed Jul 2 17:39:18 UTC 2025


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()

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

Commit messages:
 - 8361292: Rename ModuleEntry::module() to module_oop()

Changes: https://git.openjdk.org/jdk/pull/26102/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26102&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8361292
  Stats: 35 lines in 12 files changed: 0 ins; 0 del; 35 mod
  Patch: https://git.openjdk.org/jdk/pull/26102.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/26102/head:pull/26102

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


More information about the serviceability-dev mailing list