On 3/29/19 8:49 AM, Lindenmaier, Goetz wrote:
So I want to withdraw my claim that NPEs are thrown frequently.
Probably I was biased by my compiler construction background,
remembering NPE checks are all over the place in the code.

But I think I can still keep the claim that the message is
printed rarely.

I'll adapt the JEP saying something like this:
"While exceptions are supposed to be thrown rarely, i.e., only
In exceptional situations, most are swallowed without ever
looking at the message. Thus, overhead in getMessage() will
not fall into account."

Is this really a realistic assumption? That NPE exceptions are mostly swallowed in most programs despite the fact that swallowing exceptions (and throwing them to control the flow) is an anti-pattern? Is majority of code really so badly written? I would expect that most programs contain an exception handler of some kind that at least logs all unexpected exceptions.

I think JDK should assume that NPEs are not frequent in most well written programs. Because in well written programs all unexpected exceptions are at least logged somewhere and this alone guarantees that programs are eventually "fixed" to not throw them frequently...

Regards, Peter


Best regards,
   Goetz.

Reply via email to