On Fri, 26 Jun 2026 22:03:26 GMT, ExE Boss <[email protected]> wrote: >> Fred pointed out my proposed change actually changes the meaning as my >> proposal checks the current class, not the class that defines the finalize >> method. This is different for a finalize method from an abstract value class > > A finalizer in an abstract value class should probably still be registered > for identity subclasses; as otherwise, changing an abstract identity class > with a finalizer to an abstract value class with a finalizer would be a > breaking change as long as finalizers continue to exist.
An abstract class with final fields may be good candidate to migrate to an abstract value class. If the abstract class relies on finalization then it is probably not a good candidate. If someone were to migrate without removing the dependency on finalization then it's not going to work as they might think as presumably the motivation for migrating the abstract class is to allow for subclasses to be value classes. Right now, compiling an abstract value class with a finalize method emits a warning at compile-time to say that class should not have a finalize method as it will not be invoked (this is in addition to the removal warning that finalization is deprecated for removal). This will hopefully make developers aware that it doesn't work as they might think. ------------- PR Review Comment: https://git.openjdk.org/valhalla/pull/2589#discussion_r3496647559
