Skip to content
Permalink
Browse files
8250855: Address reliance on default constructors in the Java 2D APIs
Reviewed-by: prr, serb
  • Loading branch information
c-cleary authored and Phil Race committed Sep 24, 2020
1 parent a9d0440 commit 3495c19d1a8e134ef0e28a0fdd38e877da7cdaea
@@ -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 @@
*/
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
@@ -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 @@
*/
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
@@ -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 @@

public abstract class GlyphVector implements Cloneable {

/**
* Constructor for subclasses to call.
*/
protected GlyphVector() {}

//
// methods associated with creation-time state
//
@@ -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 @@
* @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
@@ -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 @@

public abstract class LineMetrics {

/**
* Constructor for subclasses to call.
*/
protected LineMetrics() {}

/**
* Returns the number of characters ({@code char} values) in the text whose
@@ -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 @@
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)}.
@@ -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 @@
*/
public abstract class BufferStrategy {

/**
* Constructor for subclasses to call.
*/
protected BufferStrategy() {}

/**
* Returns the {@code BufferCapabilities} for this
* {@code BufferStrategy}.
@@ -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 @@
* @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
@@ -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 @@
*/
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
@@ -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 @@
public abstract class VolatileImage extends Image implements Transparency
{

/**
* Constructor for subclasses to call.
*/
protected VolatileImage() {}

// Return codes for validate() method

/**
@@ -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 @@
*/
public abstract class PrintServiceLookup {

/**
* Constructor for subclasses to call.
*/
protected PrintServiceLookup() {}

/**
* Contains a lists of services.
*/
@@ -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 @@
*/
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.
@@ -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 @@
*/
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".
@@ -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 @@
*/
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

1 comment on commit 3495c19

@bridgekeeper

This comment has been minimized.

Copy link

@bridgekeeper bridgekeeper bot commented on 3495c19 Sep 24, 2020

Please sign in to comment.