On 2018-04-03T12:36:43 -0400 Brian Goetz <brian.go...@oracle.com> wrote: > > Here's one that I suspect we're not expecting to recover terribly well > from: hierarchy inversion. Suppose at compile time A <: B. So the > following is a sensible switch body: > > case String: println("String"); break; > case Object: println("Object"); break; > > Now, imagine that by runtime, String no longer extends Object, but > instead Object absurdly extends String. Do we still expect the above to > print String for all Strings, and Object for everything else? Or is the > latter arm now dead at runtime, even though it wouldn't compile after > the change? Or is this now UB, because it would no longer compile?
I'm still giving thought to everything you've written, but I am wondering: How feasible is it to get the above to fail early with an informative exception/Error? -- Mark Raynsford | http://www.io7m.com