Initial JDK 11 RFR of JDK-8202385: Annotation to mark serial-related fields and methods

joe darcy joe.darcy at oracle.com
Fri May 11 00:52:20 UTC 2018


Hi David,

On 5/10/2018 1:39 PM, David Lloyd wrote:
> Would it be allowed to enable the serial lint without using the
> @Serial annotation?
>
>

Certainly.

A limited serial lint checker already exists in javac and we enable that 
check it in the JDK build. Basically it checks that a serializable class 
defines a static final serialVersionUID field.

The expanded checks I have planned for JDK-8202056: "Expand serial 
warning to check for bad overloads of serial-related methods" for do 
various additional checks even without @Serial annotation being used. 
Without the annotation, the lint checks could verify that if a field or 
method with one of the designated names is present in a serializable 
class, it is declared properly, catching bad method overloads, etc. In 
addition, it could catch ineffective serial-related fields and methods 
in an enum, etc.

HTH,

-Joe


More information about the core-libs-dev mailing list