RFR: 8247755: Leaner and more versatile GrowableArray classes

Kim Barrett kim.barrett at oracle.com
Tue Jun 23 13:42:04 UTC 2020


> On Jun 23, 2020, at 6:23 AM, Stefan Karlsson <stefan.karlsson at oracle.com> wrote:
> 
> Latest patches:
> https://cr.openjdk.java.net/~stefank/8247755/webrev.02.delta/
> https://cr.openjdk.java.net/~stefank/8247755/webrev.02/
> 
> I haven't changed:
> - GrowableArrayView to something else
> - S to ALLOC or Derived. I'm leaning towards Derived.

Lacking a really better alternative to offer, I’ll drop the objection to GrowableArrayView.

I’m okay with Derived, obviously.

webrev.02 doesn't seem to have fully addressed this comment from my
first review message:

src/hotspot/share/utilities/growableArray.hpp 

-----
Destructors for all but the most-derived classes should be non-public.
Probably also the constructors.  That is, all of GrowableArrayBase,
GrowableArrayView, and GrowableArrayWithAllocator should have
protected constructors and destructors.
-----

The constructors are now protected, but these all have default
(public) destructors, and it's the destructor that generally prevents
inadvertent slicing, especially since we have defaults for copy and
assign; if either of those get used, the lack of an accessible destructor
will generally trigger a compile-time error.



More information about the hotspot-dev mailing list