Hi!

The javadoc of java.io.Serial [1] says that serialVersionUID is private.
But the javadoc of Serializable [2] says it can have any access modifier.
Who is right here? When I write the following code, should there be a
warning or not?

import java.io.Serial;import java.io.Serializable;
public class SerExample implements Serializable {
    @Serial // warning or not?
    public static final long serialVersionUID = 2L;}


This question originated in this [3] discussion in the IDEA bugtracker.

With best regards, Zheka.

[1]
https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/io/Serial.html
[2]
https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/io/Serializable.html
[3] https://youtrack.jetbrains.com/issue/IDEA-230392

Reply via email to