> On Sep 9, 2020, at 11:29 AM, Brian Goetz <[email protected]> wrote:
> 
> Gavin points out another corner case here: when the LHS is the `null` literal:
> 
>     if (null instanceof String s) { ... }
> 
> Since this is also in the "stupid question" category, it is reasonable to 
> outlaw it, at least when there's a pattern on the RHS.  

One thing to be careful of with "stupid question" errors is that sometimes 
stupid questions can be useful for experimentation. For example, it's nice that 
I can go to jshell and see what 'null instance String' does without getting my 
hand slapped.

(I don't think there's a bright line between stupid questions that should be 
disallowed and those that should are useful. It's a judgement call.)

Reply via email to