<Swing Dev> Integrated: 8252722: More Swing plaf APIs that rely on default constructors

Prasanta Sadhukhan psadhukhan at openjdk.java.net
Thu Sep 24 16:21:37 UTC 2020


On Fri, 18 Sep 2020 12:46:46 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

> Please review a fix for issue where it was seen that several classes in plaf package rely on default constructors as
> part of their public API.
> It's to be noted that "A no-arg public constructor is generated by the compiler for a class if it does not declare an
> explicit constructor. While convenient, this is inappropriate for many kinds of formal classes, both because the
> constructor will have no javadoc and because the constructor may be unintended."
> 
> For the JDK, classes intended to be used outside of the JDK, public classes in exported packages, should not rely on
> default constructors.
> 
> Proposed fix is to add explicit public no-arg constructors for public classes and protected no-arg constructor for
> protected classes for javax.swing module

This pull request has now been integrated.

Changeset: 527a3093
Author:    Prasanta Sadhukhan <psadhukhan at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/527a3093
Stats:     468 lines in 36 files changed: 464 ins; 0 del; 4 mod

8252722: More Swing plaf APIs that rely on default constructors

Reviewed-by: prr

-------------

PR: https://git.openjdk.java.net/jdk/pull/251


More information about the swing-dev mailing list