8259439: Apply java.io.Serial annotations in java.datatransfer

Reviewed-by: aivanov, pbansal, trebari, darcy
This commit is contained in:
Sergey Bylokhov 2021-01-11 23:14:56 +00:00
parent 712ea25057
commit ff54b77b76
5 changed files with 31 additions and 12 deletions

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -35,6 +35,7 @@ import java.io.ObjectInput;
import java.io.ObjectOutput; import java.io.ObjectOutput;
import java.io.OptionalDataException; import java.io.OptionalDataException;
import java.io.Reader; import java.io.Reader;
import java.io.Serial;
import java.io.StringReader; import java.io.StringReader;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
@ -111,6 +112,10 @@ import sun.reflect.misc.ReflectUtil;
*/ */
public class DataFlavor implements Externalizable, Cloneable { public class DataFlavor implements Externalizable, Cloneable {
/**
* Use serialVersionUID from JDK 1.2 for interoperability.
*/
@Serial
private static final long serialVersionUID = 8367026044764648243L; private static final long serialVersionUID = 8367026044764648243L;
private static final Class<InputStream> ioInputStreamClass = InputStream.class; private static final Class<InputStream> ioInputStreamClass = InputStream.class;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -25,6 +25,7 @@
package java.awt.datatransfer; package java.awt.datatransfer;
import java.io.Serial;
import java.util.EventObject; import java.util.EventObject;
/** /**
@ -37,6 +38,10 @@ import java.util.EventObject;
*/ */
public class FlavorEvent extends EventObject { public class FlavorEvent extends EventObject {
/**
* Use serialVersionUID from JDK 1.5 for interoperability.
*/
@Serial
private static final long serialVersionUID = -5842664112252414548L; private static final long serialVersionUID = -5842664112252414548L;
/** /**

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -29,6 +29,7 @@ import java.io.Externalizable;
import java.io.IOException; import java.io.IOException;
import java.io.ObjectInput; import java.io.ObjectInput;
import java.io.ObjectOutput; import java.io.ObjectOutput;
import java.io.Serial;
import java.util.Locale; import java.util.Locale;
/** /**
@ -41,11 +42,11 @@ import java.util.Locale;
*/ */
class MimeType implements Externalizable, Cloneable { class MimeType implements Externalizable, Cloneable {
/* /**
* serialization support * Use serialVersionUID from JDK 1.2 for interoperability.
*/ */
@Serial
static final long serialVersionUID = -6568722458793895906L; private static final long serialVersionUID = -6568722458793895906L;
/** /**
* Constructor for externalization; this constructor should not be called * Constructor for externalization; this constructor should not be called

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -25,6 +25,8 @@
package java.awt.datatransfer; package java.awt.datatransfer;
import java.io.Serial;
/** /**
* A class to encapsulate MimeType parsing related exceptions. * A class to encapsulate MimeType parsing related exceptions.
* *
@ -33,7 +35,10 @@ package java.awt.datatransfer;
*/ */
public class MimeTypeParseException extends Exception { public class MimeTypeParseException extends Exception {
// use serialVersionUID from JDK 1.2.2 for interoperability /**
* Use serialVersionUID from JDK 1.2.2 for interoperability.
*/
@Serial
private static final long serialVersionUID = -5604407764691570741L; private static final long serialVersionUID = -5604407764691570741L;
/** /**

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -25,6 +25,8 @@
package java.awt.datatransfer; package java.awt.datatransfer;
import java.io.Serial;
/** /**
* Signals that the requested data is not supported in this flavor. * Signals that the requested data is not supported in this flavor.
* *
@ -34,9 +36,10 @@ package java.awt.datatransfer;
*/ */
public class UnsupportedFlavorException extends Exception { public class UnsupportedFlavorException extends Exception {
/* /**
* JDK 1.1 serialVersionUID * Use serialVersionUID from JDK 1.1 for interoperability.
*/ */
@Serial
private static final long serialVersionUID = 5383814944251665601L; private static final long serialVersionUID = 5383814944251665601L;
/** /**