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.
For the JDK, classes intended to be used outside of the JDK, public classes in exported packages, should not rely on default constructors.
- relates to
-
JDK-8250639 ☂ Address reliance on default constructors in the java.desktop module
- Open
-
JDK-8250638 Address reliance on default constructors in java.xml
- Resolved
-
JDK-8253753 Enable default constructor warning in client modules
- Resolved
-
JDK-8250558 ☂ Many JavaFX classes have implicit no-arg constructors
- Resolved
-
JDK-8071961 Add javac lint warning when a default constructor is created
- Resolved