scala/scala — pull request #2432 by retronym (2013-04-23 07:20:09+00:00)
Title: Warn on selection of vals from DelayedInit subclasses.

Which are likely to yield null, if the program didn't start
via the `App`-s main method, or, more generally, if the
`DelayedInit` is still pending initialization.

This is a common source of confusion for people new to
the language, as was seen during the Coursera course.

The test case shows that the usage pattern within Specs2
won't generate these warnings.

Review by @lrytz, who once [noted](http://comments.gmane.org/gmane.comp.lang.scala.internals/13194) that

> I understand what's going on here, but from a beginner's perspective this is not ideal.
> Especially since "App" is made for beginners.

I'm also open to the idea of moving this out of the shadow of `-Xlint`. Perhaps it would be a touch more conservative to do that for `App`, rather than unknown `DelayedInit`-s.