JDK 12 RFR of JDK-8209024: Use SuppressWarnings on serialVersionUID fields in interfaces
Roger Riggs
Roger.Riggs at Oracle.com
Mon Aug 6 19:44:44 UTC 2018
Hi Joe,
Looks fine. I would probably have used "ineffective" instead of
"ineffectual".
(Googling "define ineffective" and "define ineffectual" shows an
interesting graph of
the use of the term with ineffective growing and ineffectual dropping in
use.
Look under the more tag)
Regards, Roger
On 8/6/2018 3:11 PM, joe darcy wrote:
> Hello,
>
> Various interfaces in the JDK extend Serializable and declare
> serialVersionUID fields. Such fields are ineffectual and
> @SuppressWarnings("serial") should be applied to such fields to
> suppress future planned serial lint checks (JDK-8202056).
>
> Most of the affected files are in the security-libs area with a
> handful in RMI and JNDI:
>
> http://cr.openjdk.java.net/~darcy/8209024.0/
>
> Patch below. I'll fix-up the copyright years before any push.
>
> Thanks,
>
> -Joe
>
> --- old/src/java.base/share/classes/java/security/Key.java 2018-08-06
> 12:04:46.666000999 -0700
> +++ new/src/java.base/share/classes/java/security/Key.java 2018-08-06
> 12:04:46.510000999 -0700
> @@ -109,6 +109,7 @@
> * serialization compatibility with a previous
> * version of the class.
> */
> + @SuppressWarnings("serial") // serialVersionUID in an interface
> is ineffectual
> static final long serialVersionUID = 6603384152749567654L;
>
> /**
> --- old/src/java.base/share/classes/java/security/PrivateKey.java
> 2018-08-06 12:04:47.062000999 -0700
> +++ new/src/java.base/share/classes/java/security/PrivateKey.java
> 2018-08-06 12:04:46.914000999 -0700
> @@ -64,5 +64,6 @@
> * The class fingerprint that is set to indicate serialization
> * compatibility with a previous version of the class.
> */
> + @SuppressWarnings("serial") // serialVersionUID in an interface
> is ineffectual
> static final long serialVersionUID = 6034044314589513430L;
> }
> --- old/src/java.base/share/classes/java/security/PublicKey.java
> 2018-08-06 12:04:47.454000999 -0700
> +++ new/src/java.base/share/classes/java/security/PublicKey.java
> 2018-08-06 12:04:47.306000999 -0700
> @@ -50,5 +50,6 @@
> * The class fingerprint that is set to indicate serialization
> * compatibility with a previous version of the class.
> */
> + @SuppressWarnings("serial") // serialVersionUID in an interface
> is ineffectual
> static final long serialVersionUID = 7187392471159151072L;
> }
> ---
> old/src/java.base/share/classes/java/security/interfaces/DSAPrivateKey.java
> 2018-08-06 12:04:47.858000999 -0700
> +++
> new/src/java.base/share/classes/java/security/interfaces/DSAPrivateKey.java
> 2018-08-06 12:04:47.706000999 -0700
> @@ -48,6 +48,7 @@
> * serialization compatibility with a previous
> * version of the class.
> */
> + @SuppressWarnings("serial") // serialVersionUID in an interface
> is ineffectual
> static final long serialVersionUID = 7776497482533790279L;
>
> /**
> ---
> old/src/java.base/share/classes/java/security/interfaces/DSAPublicKey.java
> 2018-08-06 12:04:48.270000999 -0700
> +++
> new/src/java.base/share/classes/java/security/interfaces/DSAPublicKey.java
> 2018-08-06 12:04:48.114000999 -0700
> @@ -48,6 +48,7 @@
> * serialization compatibility with a previous
> * version of the class.
> */
> + @SuppressWarnings("serial") // serialVersionUID in an interface
> is ineffectual
> static final long serialVersionUID = 1234526332779022332L;
>
> /**
> ---
> old/src/java.base/share/classes/java/security/interfaces/ECPrivateKey.java
> 2018-08-06 12:04:48.674000999 -0700
> +++
> new/src/java.base/share/classes/java/security/interfaces/ECPrivateKey.java
> 2018-08-06 12:04:48.522000999 -0700
> @@ -43,6 +43,7 @@
> * The class fingerprint that is set to indicate
> * serialization compatibility.
> */
> + @SuppressWarnings("serial") // serialVersionUID in an interface
> is ineffectual
> static final long serialVersionUID = -7896394956925609184L;
>
> /**
> ---
> old/src/java.base/share/classes/java/security/interfaces/ECPublicKey.java
> 2018-08-06 12:04:49.078000999 -0700
> +++
> new/src/java.base/share/classes/java/security/interfaces/ECPublicKey.java
> 2018-08-06 12:04:48.926000999 -0700
> @@ -45,6 +45,7 @@
> * The class fingerprint that is set to indicate
> * serialization compatibility.
> */
> + @SuppressWarnings("serial") // serialVersionUID in an interface
> is ineffectual
> static final long serialVersionUID = -3314988629879632826L;
>
> /**
> ---
> old/src/java.base/share/classes/java/security/interfaces/RSAMultiPrimePrivateCrtKey.java
> 2018-08-06 12:04:49.470000999 -0700
> +++
> new/src/java.base/share/classes/java/security/interfaces/RSAMultiPrimePrivateCrtKey.java
> 2018-08-06 12:04:49.318000999 -0700
> @@ -51,6 +51,7 @@
> * serialization compatibility with a previous
> * version of the type.
> */
> + @SuppressWarnings("serial") // serialVersionUID in an interface
> is ineffectual
> static final long serialVersionUID = 618058533534628008L;
>
> /**
> ---
> old/src/java.base/share/classes/java/security/interfaces/RSAPrivateCrtKey.java
> 2018-08-06 12:04:49.890000999 -0700
> +++
> new/src/java.base/share/classes/java/security/interfaces/RSAPrivateCrtKey.java
> 2018-08-06 12:04:49.726000999 -0700
> @@ -46,6 +46,7 @@
> * serialization compatibility with a previous
> * version of the type.
> */
> + @SuppressWarnings("serial") // serialVersionUID in an interface
> is ineffectual
> static final long serialVersionUID = -5682214253527700368L;
>
> /**
> ---
> old/src/java.base/share/classes/java/security/interfaces/RSAPrivateKey.java
> 2018-08-06 12:04:50.290000999 -0700
> +++
> new/src/java.base/share/classes/java/security/interfaces/RSAPrivateKey.java
> 2018-08-06 12:04:50.146000999 -0700
> @@ -45,6 +45,7 @@
> * serialization compatibility with a previous
> * version of the type.
> */
> + @SuppressWarnings("serial") // serialVersionUID in an interface
> is ineffectual
> static final long serialVersionUID = 5187144804936595022L;
>
> /**
> ---
> old/src/java.base/share/classes/java/security/interfaces/RSAPublicKey.java
> 2018-08-06 12:04:50.706000999 -0700
> +++
> new/src/java.base/share/classes/java/security/interfaces/RSAPublicKey.java
> 2018-08-06 12:04:50.554000999 -0700
> @@ -42,6 +42,7 @@
> * serialization compatibility with a previous
> * version of the type.
> */
> + @SuppressWarnings("serial") // serialVersionUID in an interface
> is ineffectual
> static final long serialVersionUID = -8727434096241101194L;
>
> /**
> --- old/src/java.base/share/classes/javax/crypto/SecretKey.java
> 2018-08-06 12:04:51.142000999 -0700
> +++ new/src/java.base/share/classes/javax/crypto/SecretKey.java
> 2018-08-06 12:04:50.986000999 -0700
> @@ -64,5 +64,6 @@
> * The class fingerprint that is set to indicate serialization
> * compatibility since J2SE 1.4.
> */
> + @SuppressWarnings("serial") // serialVersionUID in an interface
> is ineffectual
> static final long serialVersionUID = -4795878709595146952L;
> }
> ---
> old/src/java.base/share/classes/javax/crypto/interfaces/DHPrivateKey.java
> 2018-08-06 12:04:51.550000999 -0700
> +++
> new/src/java.base/share/classes/javax/crypto/interfaces/DHPrivateKey.java
> 2018-08-06 12:04:51.398000999 -0700
> @@ -42,6 +42,7 @@
> * The class fingerprint that is set to indicate serialization
> * compatibility since J2SE 1.4.
> */
> + @SuppressWarnings("serial") // serialVersionUID in an interface
> is ineffectual
> static final long serialVersionUID = 2211791113380396553L;
>
> /**
> ---
> old/src/java.base/share/classes/javax/crypto/interfaces/DHPublicKey.java
> 2018-08-06 12:04:51.966000999 -0700
> +++
> new/src/java.base/share/classes/javax/crypto/interfaces/DHPublicKey.java
> 2018-08-06 12:04:51.810000999 -0700
> @@ -42,6 +42,7 @@
> * The class fingerprint that is set to indicate serialization
> * compatibility since J2SE 1.4.
> */
> + @SuppressWarnings("serial") // serialVersionUID in an interface
> is ineffectual
> static final long serialVersionUID = -6628103563352519193L;
>
> /**
> ---
> old/src/java.base/share/classes/javax/crypto/interfaces/PBEKey.java
> 2018-08-06 12:04:52.390000999 -0700
> +++
> new/src/java.base/share/classes/javax/crypto/interfaces/PBEKey.java
> 2018-08-06 12:04:52.238000999 -0700
> @@ -42,6 +42,7 @@
> * The class fingerprint that is set to indicate serialization
> * compatibility since J2SE 1.4.
> */
> + @SuppressWarnings("serial") // serialVersionUID in an interface
> is ineffectual
> static final long serialVersionUID = -1430015993304333921L;
>
> /**
> ---
> old/src/java.base/share/classes/sun/security/internal/interfaces/TlsMasterSecret.java
> 2018-08-06 12:04:52.814000999 -0700
> +++
> new/src/java.base/share/classes/sun/security/internal/interfaces/TlsMasterSecret.java
> 2018-08-06 12:04:52.658000999 -0700
> @@ -44,6 +44,7 @@
> @Deprecated
> public interface TlsMasterSecret extends SecretKey {
>
> + @SuppressWarnings("serial") // serialVersionUID in an interface
> is ineffectual
> public static final long serialVersionUID = -461748105810469773L;
>
> /**
> --- old/src/java.naming/share/classes/javax/naming/Name.java
> 2018-08-06 12:04:53.294000999 -0700
> +++ new/src/java.naming/share/classes/javax/naming/Name.java
> 2018-08-06 12:04:53.126000999 -0700
> @@ -64,6 +64,7 @@
> * serialization compatibility with a previous
> * version of the class.
> */
> + @SuppressWarnings("serial") // serialVersionUID in an interface
> is ineffectual
> static final long serialVersionUID = -3617482732056931635L;
>
> /**
> ---
> old/src/java.naming/share/classes/javax/naming/directory/Attribute.java
> 2018-08-06 12:04:53.702000999 -0700
> +++
> new/src/java.naming/share/classes/javax/naming/directory/Attribute.java
> 2018-08-06 12:04:53.550000999 -0700
> @@ -336,5 +336,6 @@
> /**
> * Use serialVersionUID from JNDI 1.1.1 for interoperability.
> */
> + @SuppressWarnings("serial") // serialVersionUID in an interface
> is ineffectual
> static final long serialVersionUID = 8707690322213556804L;
> }
> --- old/src/java.rmi/share/classes/java/rmi/server/RemoteRef.java
> 2018-08-06 12:04:54.098000999 -0700
> +++ new/src/java.rmi/share/classes/java/rmi/server/RemoteRef.java
> 2018-08-06 12:04:53.942000999 -0700
> @@ -39,6 +39,7 @@
> public interface RemoteRef extends java.io.Externalizable {
>
> /** indicate compatibility with JDK 1.1.x version of class. */
> + @SuppressWarnings("serial") // serialVersionUID in an interface
> is ineffectual
> static final long serialVersionUID = 3632638527362204081L;
>
> /**
> --- old/src/java.rmi/share/classes/java/rmi/server/ServerRef.java
> 2018-08-06 12:04:54.494000999 -0700
> +++ new/src/java.rmi/share/classes/java/rmi/server/ServerRef.java
> 2018-08-06 12:04:54.338000999 -0700
> @@ -39,6 +39,7 @@
> public interface ServerRef extends RemoteRef {
>
> /** indicate compatibility with JDK 1.1.x version of class. */
> + @SuppressWarnings("serial") // serialVersionUID in an interface
> is ineffectual
> static final long serialVersionUID = -4557750989390278438L;
>
> /**
>
>
>
More information about the security-dev
mailing list