JDK 14 RFR of JDK-8202385: Annotation to mark serial-related fields and methods
Roger Riggs
roger.riggs at oracle.com
Fri Jul 12 20:31:53 UTC 2019
Hi Joe,
As an annotation on a field or method, this is a use site annotation.
From the description, the checks that could be added would only be done
if the annotation was present and the annotation is a tag for existing
fields and methods that are part of the serialization spec.
The signatures of the fields and methods can be known to the compiler
independent
of the annotation and produce the same warnings.
So this looks like a case of trying to have belt and suspenders.
If the checks are not done when the annotation is not present, then it
will still be
the case that incorrect or misused fields and methods will still escape
detection.
Though the details of the compiler check are outside of the scope of
this annotation,
it seems unclear whether the annotation is necessary.
Can the name of the annotation be more descriptive?
Just "Serial" seems a bit too simple and does not have a strong binding
to the Serialization classes and specification.
Alternatives:
SerialMetadata
SerialControl
SerialFunction
39: There should be a reference to the serialization specification for
the definition
of the fields and methods to make it clear where the authoritative
identification is spec'd.
73-75: Please align the <ul> and </ul> tags on separate lines with
matching indentation.
77: Extra leading space.
Regards, Roger
On 7/9/19 7:14 PM, Joe Darcy wrote:
> Hello,
>
> Returning to some old work [1], please review the addition of a
> java.io.Serial annotation type for JDK 14 to mark serial-related
> fields and methods:
>
> webrev: http://cr.openjdk.java.net/~darcy/8202385.3/
> CSR: https://bugs.openjdk.java.net/browse/JDK-8217698
>
> Thanks,
>
> -Joe
>
> [1] Previous review threads:
>
> http://mail.openjdk.java.net/pipermail/core-libs-dev/2018-May/053055.html
>
> http://mail.openjdk.java.net/pipermail/core-libs-dev/2018-August/054801.html
>
>
More information about the core-libs-dev
mailing list