JDK-8284188 : Add sealed modifier to java.awt.MultipleGradientPaint
  • Type: CSR
  • Component: client-libs
  • Sub-Component: 2d
  • Priority: P4
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 19
  • Submitted: 2022-04-01
  • Updated: 2022-04-15
  • Resolved: 2022-04-15
Related Reports
CSR :  
Description
Summary
-------

Make java.awt.MultipleGradientPaint a sealed class

Problem
-------
java.awt.MultipleGradientPaint has only two current sub-classes, and no others can be created by applications since there are no public or protected constructors, but this is not as clear as it could be.

Solution
--------

Use the new JDK 17 sealed modifier on the MultipleGradientPaint class and enumerate the allowed extant sub-classes.

Specification
-------------
 java.awt.MultipleGradientPaint

<pre>
-public abstract class MultipleGradientPaint implements Paint 
+public abstract sealed class MultipleGradientPaint implements Paint
+    permits LinearGradientPaint,
+            RadialGradientPaint 
</pre>

Comments
Moving to Approved.
15-04-2022