[backport] SI-6969, mishandling of SoftReferences in method cache.

More interesting to test than it was to fix. The soft
reference is now dereferenced once, the locally stored
underlying value ascertained to be non-null, and the
remainder of the references to the value use the local var.

The enclosed test reliably NPEs without this patch.
Merge pull request #1972 from soc/SI-6969-2.9.x

[backport] SI-6969, mishandling of SoftReferences in method cache.