RFR: 8368966: Remove spurious VMStructs friends

Francesco Andreuzzi fandreuzzi at openjdk.org
Wed Oct 1 14:45:57 UTC 2025


On Wed, 1 Oct 2025 07:34:00 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:

> Was this done because you removed the one in the parent class?

Yeah that's the reasoning.

> I guess either way is fine but there's a risk that there will be some churn about where to put the friend declaration if someone wants add one of the classes between (and including) GrowableArrayView and GrowableArray.

Given that `friend` _should not be_ inherited, I'd expect the `friend` declaration on the exact class which we use in `vmStructs*.cpp`. However, I'm curious about why what you suggest compiles. Moving `friend class VMStructs` from `GrowableArray` to `GrowableArrayView` should not allow us to access `_data` via `GrowableArray<int>`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27583#discussion_r2394868333


More information about the hotspot-dev mailing list