8259522: Apply java.io.Serial annotations in java.desktop

Reviewed-by: aivanov, psadhukhan
This commit is contained in:
Sergey Bylokhov 2021-01-15 00:28:08 +00:00
parent bf28f92555
commit 978bed6c7f
343 changed files with 3135 additions and 1158 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, 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.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,6 +26,7 @@
package java.awt.event;
import java.awt.AWTEvent;
import java.io.Serial;
import java.lang.annotation.Native;
/**
@ -130,9 +131,10 @@ public class ActionEvent extends AWTEvent {
*/
int modifiers;
/*
* JDK 1.1 serialVersionUID
/**
* Use serialVersionUID from JDK 1.1 for interoperability.
*/
@Serial
private static final long serialVersionUID = -7671078796273832149L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, 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.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,11 +25,11 @@
package java.awt.event;
import java.awt.Adjustable;
import java.awt.AWTEvent;
import java.awt.Adjustable;
import java.io.Serial;
import java.lang.annotation.Native;
/**
* The adjustment event emitted by Adjustable objects like
* {@link java.awt.Scrollbar} and {@link java.awt.ScrollPane}.
@ -141,9 +141,10 @@ public class AdjustmentEvent extends AWTEvent {
boolean isAdjusting;
/*
* JDK 1.1 serialVersionUID
/**
* Use serialVersionUID from JDK 1.1 for interoperability.
*/
@Serial
private static final long serialVersionUID = 5700290645205279921L;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, 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.
*
* This code is free software; you can redistribute it and/or modify it
@ -28,6 +28,7 @@ package java.awt.event;
import java.awt.AWTEvent;
import java.awt.Component;
import java.awt.Rectangle;
import java.io.Serial;
import java.lang.annotation.Native;
/**
@ -97,9 +98,10 @@ public class ComponentEvent extends AWTEvent {
*/
@Native public static final int COMPONENT_HIDDEN = 3 + COMPONENT_FIRST;
/*
* JDK 1.1 serialVersionUID
/**
* Use serialVersionUID from JDK 1.1 for interoperability.
*/
@Serial
private static final long serialVersionUID = 8101406823902992965L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, 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.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,8 +25,9 @@
package java.awt.event;
import java.awt.Container;
import java.awt.Component;
import java.awt.Container;
import java.io.Serial;
/**
* A low-level event which indicates that a container's contents
@ -89,9 +90,10 @@ public class ContainerEvent extends ComponentEvent {
*/
Component child;
/*
* JDK 1.1 serialVersionUID
/**
* Use serialVersionUID from JDK 1.1 for interoperability.
*/
@Serial
private static final long serialVersionUID = -4114942250539772041L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2020, 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.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,6 +27,7 @@ package java.awt.event;
import java.awt.Component;
import java.io.ObjectStreamException;
import java.io.Serial;
import sun.awt.AWTAccessor;
import sun.awt.AppContext;
@ -180,9 +181,10 @@ public class FocusEvent extends ComponentEvent {
*/
transient Component opposite;
/*
* JDK 1.1 serialVersionUID
/**
* Use serialVersionUID from JDK 1.1 for interoperability.
*/
@Serial
private static final long serialVersionUID = 523753786457416396L;
/**
@ -388,6 +390,7 @@ public class FocusEvent extends ComponentEvent {
* @see #cause
* @since 9
*/
@Serial
@SuppressWarnings("serial")
Object readResolve() throws ObjectStreamException {
if (cause != null) {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -28,6 +28,7 @@ package java.awt.event;
import java.awt.AWTEvent;
import java.awt.Component;
import java.awt.Container;
import java.io.Serial;
/**
* An event which indicates a change to the {@code Component}
@ -90,9 +91,11 @@ import java.awt.Container;
* @since 1.3
*/
public class HierarchyEvent extends AWTEvent {
/*
* serialVersionUID
/**
* Use serialVersionUID from JDK 1.6 for interoperability.
*/
@Serial
private static final long serialVersionUID = -5337576970038043990L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2016, 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.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,10 +25,11 @@
package java.awt.event;
import java.awt.Event;
import java.awt.Component;
import java.awt.Event;
import java.awt.GraphicsEnvironment;
import java.awt.Toolkit;
import java.io.Serial;
import java.util.Arrays;
import sun.awt.AWTAccessor;
@ -522,8 +523,11 @@ public abstract class InputEvent extends ComponentEvent {
return consumed;
}
// state serialization compatibility with JDK 1.1
static final long serialVersionUID = -2482525981698309786L;
/**
* Use serialVersionUID from JDK 1.1 for interoperability.
*/
@Serial
private static final long serialVersionUID = -2482525981698309786L;
/**
* Returns a String describing the extended modifier keys and

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2020, 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.
*
* This code is free software; you can redistribute it and/or modify it
@ -31,6 +31,7 @@ import java.awt.EventQueue;
import java.awt.font.TextHitInfo;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serial;
import java.lang.annotation.Native;
import java.text.AttributedCharacterIterator;
import java.text.CharacterIterator;
@ -63,8 +64,9 @@ import sun.awt.SunToolkit;
public class InputMethodEvent extends AWTEvent {
/**
* Serial Version ID.
* Use serialVersionUID from JDK 1.4 for interoperability.
*/
@Serial
private static final long serialVersionUID = 4727190874778922661L;
/**
@ -420,6 +422,7 @@ public class InputMethodEvent extends AWTEvent {
* not be found
* @throws IOException if an I/O error occurs
*/
@Serial
private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException {
s.defaultReadObject();
if (when == 0) {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -25,10 +25,11 @@
package java.awt.event;
import sun.awt.AWTAccessor;
import java.awt.ActiveEvent;
import java.awt.AWTEvent;
import java.awt.ActiveEvent;
import java.io.Serial;
import sun.awt.AWTAccessor;
/**
* An event which executes the {@code run()} method on a {@code Runnable
@ -146,9 +147,10 @@ public class InvocationEvent extends AWTEvent implements ActiveEvent {
*/
private long when;
/*
* JDK 1.1 serialVersionUID.
/**
* Use serialVersionUID from JDK 1.1 for interoperability.
*/
@Serial
private static final long serialVersionUID = 436056344909459450L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, 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.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,6 +27,7 @@ package java.awt.event;
import java.awt.AWTEvent;
import java.awt.ItemSelectable;
import java.io.Serial;
/**
* A semantic event which indicates that an item was selected or deselected.
@ -107,9 +108,10 @@ public class ItemEvent extends AWTEvent {
*/
int stateChange;
/*
* JDK 1.1 serialVersionUID
/**
* Use serialVersionUID from JDK 1.1 for interoperability.
*/
@Serial
private static final long serialVersionUID = -608708132447206933L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2020, 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.
*
* This code is free software; you can redistribute it and/or modify it
@ -30,6 +30,7 @@ import java.awt.GraphicsEnvironment;
import java.awt.Toolkit;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serial;
import sun.awt.AWTAccessor;
@ -1061,9 +1062,10 @@ public class KeyEvent extends InputEvent {
private transient long scancode = 0; // for MS Windows only
private transient long extendedKeyCode = 0;
/*
* JDK 1.1 serialVersionUID
/**
* Use serialVersionUID from JDK 1.1 for interoperability.
*/
@Serial
private static final long serialVersionUID = -2352130953028126954L;
static {
@ -1886,6 +1888,7 @@ public class KeyEvent extends InputEvent {
* @throws IOException if an I/O error occurs
* @serial
*/
@Serial
@SuppressWarnings("deprecation")
private void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2020, 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.
*
* This code is free software; you can redistribute it and/or modify it
@ -32,6 +32,7 @@ import java.awt.Point;
import java.awt.Toolkit;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serial;
import sun.awt.AWTAccessor;
import sun.awt.SunToolkit;
@ -381,9 +382,10 @@ public class MouseEvent extends InputEvent {
*/
boolean popupTrigger = false;
/*
* JDK 1.1 serialVersionUID
/**
* Use serialVersionUID from JDK 1.1 for interoperability.
*/
@Serial
private static final long serialVersionUID = -991214153494842848L;
/**
@ -1194,6 +1196,7 @@ public class MouseEvent extends InputEvent {
* @throws IOException if an I/O error occurs
* @serial
*/
@Serial
@SuppressWarnings("deprecation")
private void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException {

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,7 @@
package java.awt.event;
import java.awt.Component;
import java.io.Serial;
import java.lang.annotation.Native;
/**
@ -153,10 +153,10 @@ public class MouseWheelEvent extends MouseEvent {
*/
double preciseWheelRotation;
/*
* serialVersionUID
/**
* Use serialVersionUID from JDK 1.6 for interoperability.
*/
@Serial
private static final long serialVersionUID = 6459879390515399677L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, 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.
*
* This code is free software; you can redistribute it and/or modify it
@ -27,6 +27,7 @@ package java.awt.event;
import java.awt.Component;
import java.awt.Rectangle;
import java.io.Serial;
/**
* The component-level paint event.
@ -78,9 +79,10 @@ public class PaintEvent extends ComponentEvent {
*/
Rectangle updateRect;
/*
* JDK 1.1 serialVersionUID
/**
* Use serialVersionUID from JDK 1.1 for interoperability.
*/
@Serial
private static final long serialVersionUID = 1267492026433337593L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2008, 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.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,6 +26,7 @@
package java.awt.event;
import java.awt.AWTEvent;
import java.io.Serial;
/**
* A semantic event which indicates that an object's text changed.
@ -68,9 +69,10 @@ public class TextEvent extends AWTEvent {
*/
public static final int TEXT_VALUE_CHANGED = TEXT_FIRST;
/*
* JDK 1.1 serialVersionUID
/**
* Use serialVersionUID from JDK 1.1 for interoperability.
*/
@Serial
private static final long serialVersionUID = 6269902291250941179L;
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2020, 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.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,6 +26,7 @@
package java.awt.event;
import java.awt.Window;
import java.io.Serial;
import java.lang.annotation.Native;
import sun.awt.AppContext;
@ -173,9 +174,10 @@ public class WindowEvent extends ComponentEvent {
*/
int newState;
/*
* JDK 1.1 serialVersionUID
/**
* Use serialVersionUID from JDK 1.1 for interoperability.
*/
@Serial
private static final long serialVersionUID = -1567959133147912127L;