RFR: 6521141: DebugGraphics NPE @ setFont(); [v5]

Tejesh R tr at openjdk.org
Tue Aug 2 04:44:43 UTC 2022


On Mon, 1 Aug 2022 17:36:52 GMT, Phil Race <prr at openjdk.org> wrote:

>> @prrace Then I will proceed by removing Stackwalker and create a graphics instance only if its `null`.
>
> No, because that won't work, or more precisely will be a waste of work.
> See
> DebugGraphics(Graphics graphics) {
> this(); // << no-args constructor and graphics will still be null
> this.graphics = null;
> }
> 
> graphics will ALWAYS be null when you come via here which is exactly why we needed StackWalker

Ok, then we should set graphics only If the no-args constructor is called by another program and not via by the same class.

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

PR: https://git.openjdk.org/jdk/pull/9673



More information about the client-libs-dev mailing list