8250856: Address reliance on default constructors in the AWT APIs

Reviewed-by: prr
This commit is contained in:
Sergey Bylokhov 2020-08-11 05:30:52 +01:00
parent 62a67c5d90
commit dce1aee4ef
15 changed files with 96 additions and 15 deletions

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, 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
@ -87,6 +87,11 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
private transient Container cachedRoot;
private transient List<Component> cachedCycle;
/**
* Constructs a {@code ContainerOrderFocusTraversalPolicy}.
*/
public ContainerOrderFocusTraversalPolicy() {}
/*
* We suppose to use getFocusTraversalCycle & getComponentIndex methods in order
* to divide the policy into two parts:

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, 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
@ -75,6 +75,11 @@ public class DefaultFocusTraversalPolicy
*/
private static final long serialVersionUID = 8876966522510157497L;
/**
* Constructs a {@code DefaultFocusTraversalPolicy}.
*/
public DefaultFocusTraversalPolicy() {}
/**
* Determines whether a Component is an acceptable choice as the new
* focus owner. The Component must be visible, displayable, and enabled

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, 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
@ -96,6 +96,11 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
});
}
/**
* Constructs a {@code DefaultKeyboardFocusManager}.
*/
public DefaultKeyboardFocusManager() {}
private static class TypeAheadMarker {
long after;
Component untilFocused;

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2020, 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
@ -69,6 +69,11 @@ package java.awt;
*/
public abstract class FocusTraversalPolicy {
/**
* Constructs a {@code FocusTraversalPolicy}.
*/
protected FocusTraversalPolicy() {}
/**
* Returns the Component that should receive the focus after aComponent.
* aContainer must be a focus cycle root of aComponent or a focus traversal

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2020, 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
@ -136,6 +136,11 @@ import sun.awt.SunToolkit;
*/
public abstract class Toolkit {
/**
* Constructs a {@code Toolkit}.
*/
protected Toolkit() {}
// The following method is called by the private method
// <code>updateSystemColors</code> in <code>SystemColor</code>.

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2020, 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
@ -57,6 +57,11 @@ package java.awt.dnd;
public abstract class DragSourceAdapter
implements DragSourceListener, DragSourceMotionListener {
/**
* Constructs a {@code DragSourceAdapter}.
*/
protected DragSourceAdapter() {}
/**
* Called as the cursor's hotspot enters a platform-dependent drop site.
* This method is invoked when all the following conditions are true:

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2020, 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
@ -72,6 +72,11 @@ package java.awt.dnd;
*/
public abstract class DropTargetAdapter implements DropTargetListener {
/**
* Constructs a {@code DropTargetAdapter}.
*/
protected DropTargetAdapter() {}
/**
* Called while a drag operation is ongoing, when the mouse pointer enters
* the operable part of the drop site for the {@code DropTarget}

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2020, 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
@ -50,6 +50,12 @@ package java.awt.event;
* @since 1.1
*/
public abstract class ComponentAdapter implements ComponentListener {
/**
* Constructs a {@code ComponentAdapter}.
*/
protected ComponentAdapter() {}
/**
* Invoked when the component's size changes.
*/

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2020, 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
@ -50,6 +50,12 @@ package java.awt.event;
* @since 1.1
*/
public abstract class ContainerAdapter implements ContainerListener {
/**
* Constructs a {@code ContainerAdapter}.
*/
protected ContainerAdapter() {}
/**
* Invoked when a component has been added to the container.
*/

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2020, 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
@ -50,6 +50,12 @@ package java.awt.event;
* @since 1.1
*/
public abstract class FocusAdapter implements FocusListener {
/**
* Constructs a {@code FocusAdapter}.
*/
protected FocusAdapter() {}
/**
* Invoked when a component gains the keyboard focus.
*/

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2020, 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
@ -49,6 +49,11 @@ package java.awt.event;
*/
public abstract class HierarchyBoundsAdapter implements HierarchyBoundsListener
{
/**
* Constructs a {@code HierarchyBoundsAdapter}.
*/
protected HierarchyBoundsAdapter() {}
/**
* Called when an ancestor of the source is moved.
*/

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2020, 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
@ -51,6 +51,12 @@ package java.awt.event;
* @since 1.1
*/
public abstract class KeyAdapter implements KeyListener {
/**
* Constructs a {@code KeyAdapter}.
*/
protected KeyAdapter() {}
/**
* Invoked when a key has been typed.
* This event occurs when a key press is followed by a key release.

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2020, 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
@ -68,6 +68,12 @@ package java.awt.event;
* @since 1.1
*/
public abstract class MouseAdapter implements MouseListener, MouseWheelListener, MouseMotionListener {
/**
* Constructs a {@code MouseAdapter}.
*/
protected MouseAdapter() {}
/**
* {@inheritDoc}
*/

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2020, 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
@ -54,6 +54,12 @@ package java.awt.event;
* @since 1.1
*/
public abstract class MouseMotionAdapter implements MouseMotionListener {
/**
* Constructs a {@code MouseMotionAdapter}.
*/
protected MouseMotionAdapter() {}
/**
* Invoked when a mouse button is pressed on a component and then
* dragged. Mouse drag events will continue to be delivered to

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2020, 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
@ -55,6 +55,11 @@ package java.awt.event;
public abstract class WindowAdapter
implements WindowListener, WindowStateListener, WindowFocusListener
{
/**
* Constructs a {@code WindowAdapter}.
*/
protected WindowAdapter() {}
/**
* Invoked when a window has been opened.
*/