[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.