-
CSR
-
Resolution: Approved
-
P4
-
behavioral
-
low
-
Instead of generating NPEs when calling various instance methods, they will just return.
-
Java API
-
SE
Summary
Update the public no-args constructor of Swing's DebugGaphics class to document that it is not intended to be called by applications.
Problem
It is a mistake that the no-args constructor is public since it can't then be connected to a real Graphics instance to debug, and trying to use it just results in unexpected NPEs due to the uninitialised internal variable.
Solution
Update the javadoc of the DebugGraphics() constructor is updated to indicate that it is not intended to be called by applications and that it will result in a non-useful instance. The undocumented NPEs are resolved by creating a dummy Graphics which is what makes it non-useful, but no longer harmful.
Specification
public class javax.swing.DebugGraphics
/**
* Constructs a new debug graphics context that supports slowed
* down drawing.
* <p>
+ * NOTE: This constructor should not be called by
+ * applications, it is for internal use only. When called directly
+ * it will create an un-usable instance.
*/
public DebugGraphics() {
- csr of
-
JDK-6521141 DebugGraphics NPE @ setFont();
- Resolved