Replace use of deprecated AnalysisSession methods (#1500)

The goal of the changes to AnalysisSession is to make it easier to
understand when the result is valid, and when it is not. Previously
sometimes we throw an exception, sometimes return a result that returns
nulls, sometimes return a result that is not valid, so its getters

Since the result was previously assumed to be valid, continue making the
same assumption explicitly by immediately casting the result.
1 file changed