8250855: Address reliance on default constructors in the Java 2D APIs

Reviewed-by: prr, serb
This commit is contained in:
Conor Cleary 2020-09-24 16:07:24 +00:00 committed by Phil Race
parent a9d04408b3
commit 3495c19d1a
14 changed files with 85 additions and 14 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2013, 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
@ -45,6 +45,11 @@ import sun.awt.image.SurfaceManager;
*/
public abstract class Image {
/**
* Constructor for subclasses to call.
*/
protected Image() {}
/**
* convenience object; we can use this single static object for
* all images that do not create their own image caps; it holds the

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2017, 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
@ -36,6 +36,11 @@ package java.awt;
*/
public abstract class PrintJob {
/**
* Constructor for subclasses to call.
*/
protected PrintJob() {}
/**
* Gets a Graphics object that will draw to the next page.
* The page is sent to the printer when the graphics

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
@ -108,6 +108,11 @@ import java.awt.font.GlyphJustificationInfo;
public abstract class GlyphVector implements Cloneable {
/**
* Constructor for subclasses to call.
*/
protected GlyphVector() {}
//
// methods associated with creation-time state
//

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 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
@ -41,6 +41,12 @@ import java.awt.geom.Point2D;
* @since 1.6
*/
public abstract class LayoutPath {
/**
* Constructor for subclasses to call.
*/
protected LayoutPath() {}
/**
* Convert a point in user space to a location relative to the
* path. The location is chosen so as to minimize the distance

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 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
@ -43,6 +43,10 @@ package java.awt.font;
public abstract class LineMetrics {
/**
* Constructor for subclasses to call.
*/
protected LineMetrics() {}
/**
* Returns the number of characters ({@code char} values) in the text whose

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 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
@ -65,6 +65,11 @@ import java.awt.Image;
public abstract class AbstractMultiResolutionImage extends java.awt.Image
implements MultiResolutionImage {
/**
* Constructor for subclasses to call.
*/
protected AbstractMultiResolutionImage() {}
/**
* This method simply delegates to the same method on the base image and
* it is equivalent to: {@code getBaseImage().getWidth(observer)}.

View File

@ -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
@ -134,6 +134,11 @@ import java.awt.Image;
*/
public abstract class BufferStrategy {
/**
* Constructor for subclasses to call.
*/
protected BufferStrategy() {}
/**
* Returns the {@code BufferCapabilities} for this
* {@code BufferStrategy}.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2018, 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
@ -43,6 +43,12 @@ import java.util.Hashtable;
* @author Jim Graham
*/
public class ImageFilter implements ImageConsumer, Cloneable {
/**
* Constructs an {@code ImageFilter}.
*/
public ImageFilter() {}
/**
* The consumer of the particular image data stream for which this
* instance of the ImageFilter is filtering data. It is not

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2018, 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
@ -66,6 +66,11 @@ import java.awt.image.ColorModel;
*/
public abstract class RGBImageFilter extends ImageFilter {
/**
* Constructor for subclasses to call.
*/
protected RGBImageFilter() {}
/**
* The {@code ColorModel} to be replaced by
* {@code newmodel} when the user calls

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2006, 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
@ -133,6 +133,11 @@ import java.awt.Transparency;
public abstract class VolatileImage extends Image implements Transparency
{
/**
* Constructor for subclasses to call.
*/
protected VolatileImage() {}
// Return codes for validate() method
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2017, 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
@ -65,6 +65,11 @@ import sun.awt.AppContext;
*/
public abstract class PrintServiceLookup {
/**
* Constructor for subclasses to call.
*/
protected PrintServiceLookup() {}
/**
* Contains a lists of services.
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2017, 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
@ -65,6 +65,11 @@ import sun.print.SunAlternateMedia;
*/
public class ServiceUI {
/**
* Constructs a {@code ServiceUI}.
*/
public ServiceUI() {}
/**
* Presents a dialog to the user for selecting a print service (printer). It
* is displayed at the location specified by the application and is modal.

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2017, 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
@ -56,6 +56,11 @@ package javax.print;
*/
public abstract class ServiceUIFactory {
/**
* Constructor for subclasses to call.
*/
protected ServiceUIFactory() {}
/**
* Denotes a UI implemented as a Swing component. The value of the string is
* the fully qualified classname : "javax.swing.JComponent".

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2017, 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
@ -36,6 +36,11 @@ package javax.print.event;
*/
public abstract class PrintJobAdapter implements PrintJobListener {
/**
* Constructor for subclasses to call.
*/
protected PrintJobAdapter() {}
/**
* Called to notify the client that data has been successfully transferred
* to the print service, and the client may free local resources allocated