On Thu, 27 Aug 2026 18:03:30 GMT, ExE Boss <[email protected]> wrote:
> Personally, I’d rather not do this, as once finalisation is finally removed,
> any `void finalize()` method will become a regular method, which it
> technically already is for value classes.
I agree. I think this should be a warning, not an error (for good measure I'm
also adding this comment to the CSR).
A warning is more consistent with how similar situations have been handled in
the past, for example:
$ cat EmptySerialized.java
import java.io.*;
public interface EmptySerialized extends Serializable {
public static final ObjectStreamField[] serialPersistentFields = new
ObjectStreamField[0];
}
$ javac -Xlint EmptySerialized.java
EmptySerialized.java:3: warning: [serial] serialPersistentFields is not
effective in an interface
public static final ObjectStreamField[] serialPersistentFields = new
ObjectStreamField[0];
^
1 warning
I can't think of any other situations where the compiler emits and error
instead of a warning when it wants to say "Although I'm still going to compile
this, to me it looks fishy and it's probably not going to do what I'm assuming
you are actually wanting it to do".
-------------
PR Comment: https://git.openjdk.org/jdk/pull/32355#issuecomment-5621960693