Skip to content

Commit 3495c19

Browse files
c-clearyprrace
authored andcommitted
8250855: Address reliance on default constructors in the Java 2D APIs
Reviewed-by: prr, serb
1 parent a9d0440 commit 3495c19

File tree

14 files changed

+85
-14
lines changed

14 files changed

+85
-14
lines changed

src/java.desktop/share/classes/java/awt/Image.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1995, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -45,6 +45,11 @@
4545
*/
4646
public abstract class Image {
4747

48+
/**
49+
* Constructor for subclasses to call.
50+
*/
51+
protected Image() {}
52+
4853
/**
4954
* convenience object; we can use this single static object for
5055
* all images that do not create their own image caps; it holds the

src/java.desktop/share/classes/java/awt/PrintJob.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -36,6 +36,11 @@
3636
*/
3737
public abstract class PrintJob {
3838

39+
/**
40+
* Constructor for subclasses to call.
41+
*/
42+
protected PrintJob() {}
43+
3944
/**
4045
* Gets a Graphics object that will draw to the next page.
4146
* The page is sent to the printer when the graphics

src/java.desktop/share/classes/java/awt/font/GlyphVector.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -108,6 +108,11 @@
108108

109109
public abstract class GlyphVector implements Cloneable {
110110

111+
/**
112+
* Constructor for subclasses to call.
113+
*/
114+
protected GlyphVector() {}
115+
111116
//
112117
// methods associated with creation-time state
113118
//

src/java.desktop/share/classes/java/awt/font/LayoutPath.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -41,6 +41,12 @@
4141
* @since 1.6
4242
*/
4343
public abstract class LayoutPath {
44+
45+
/**
46+
* Constructor for subclasses to call.
47+
*/
48+
protected LayoutPath() {}
49+
4450
/**
4551
* Convert a point in user space to a location relative to the
4652
* path. The location is chosen so as to minimize the distance

src/java.desktop/share/classes/java/awt/font/LineMetrics.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1998, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -43,6 +43,10 @@
4343

4444
public abstract class LineMetrics {
4545

46+
/**
47+
* Constructor for subclasses to call.
48+
*/
49+
protected LineMetrics() {}
4650

4751
/**
4852
* Returns the number of characters ({@code char} values) in the text whose

src/java.desktop/share/classes/java/awt/image/AbstractMultiResolutionImage.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2015, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -65,6 +65,11 @@
6565
public abstract class AbstractMultiResolutionImage extends java.awt.Image
6666
implements MultiResolutionImage {
6767

68+
/**
69+
* Constructor for subclasses to call.
70+
*/
71+
protected AbstractMultiResolutionImage() {}
72+
6873
/**
6974
* This method simply delegates to the same method on the base image and
7075
* it is equivalent to: {@code getBaseImage().getWidth(observer)}.

src/java.desktop/share/classes/java/awt/image/BufferStrategy.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -134,6 +134,11 @@
134134
*/
135135
public abstract class BufferStrategy {
136136

137+
/**
138+
* Constructor for subclasses to call.
139+
*/
140+
protected BufferStrategy() {}
141+
137142
/**
138143
* Returns the {@code BufferCapabilities} for this
139144
* {@code BufferStrategy}.

src/java.desktop/share/classes/java/awt/image/ImageFilter.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1995, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1995, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -43,6 +43,12 @@
4343
* @author Jim Graham
4444
*/
4545
public class ImageFilter implements ImageConsumer, Cloneable {
46+
47+
/**
48+
* Constructs an {@code ImageFilter}.
49+
*/
50+
public ImageFilter() {}
51+
4652
/**
4753
* The consumer of the particular image data stream for which this
4854
* instance of the ImageFilter is filtering data. It is not

src/java.desktop/share/classes/java/awt/image/RGBImageFilter.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1995, 2018, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1995, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -66,6 +66,11 @@
6666
*/
6767
public abstract class RGBImageFilter extends ImageFilter {
6868

69+
/**
70+
* Constructor for subclasses to call.
71+
*/
72+
protected RGBImageFilter() {}
73+
6974
/**
7075
* The {@code ColorModel} to be replaced by
7176
* {@code newmodel} when the user calls

src/java.desktop/share/classes/java/awt/image/VolatileImage.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -133,6 +133,11 @@
133133
public abstract class VolatileImage extends Image implements Transparency
134134
{
135135

136+
/**
137+
* Constructor for subclasses to call.
138+
*/
139+
protected VolatileImage() {}
140+
136141
// Return codes for validate() method
137142

138143
/**

0 commit comments

Comments
 (0)