RFR: 8231622: SuppressWarning("serial") ignored on field serialVersionUID [v2]

Guoxiong Li github.com+13688759+lgxbslgx at openjdk.java.net
Fri Dec 4 18:26:36 UTC 2020


> Hi all,
> 
> Currently, a warning is generated when compiling the following code by using the option `-Xlint`.
> 
> import java.io.Serializable;
> class B implements Serializable {
>     @SuppressWarnings("serial")
>     private static final byte serialVersionUID = 5;
> }
> 
> output:
> B.java:4: warning: [serial] serialVersionUID must be of type long in class B
>     private static final byte serialVersionUID = 5;
>                               ^
> 1 warning
> 
> The annotation `@SuppressWarnings("serial")` on  field serialVersionUID is ignored by the compiler.
> This patch fixes it and adds some tests.
> Thank you for taking the time to review.
> 
> Best Regards.

Guoxiong Li has updated the pull request incrementally with one additional commit since the last revision:

  Revise test cases. Remove legal header and add /nodynamiccopyright/

-------------

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/1626/files
  - new: https://git.openjdk.java.net/jdk/pull/1626/files/877e4b82..16eeaa56

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=1626&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=1626&range=00-01

  Stats: 73 lines in 4 files changed: 0 ins; 69 del; 4 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1626.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1626/head:pull/1626

PR: https://git.openjdk.java.net/jdk/pull/1626


More information about the compiler-dev mailing list