I'm calling the LocationResult.extractResult method that seems to be implemented as follows (according to IntelliJ's "go to declaration"):
@RecentlyNonNull
public static LocationResult extractResult(@RecentlyNonNull Intent var0) {
return !hasResult(var0) ? null : (LocationResult)var0.getParcelableExtra("com.google.android.gms.location.EXTRA_LOCATION_RESULT");
}
It's hard to believe this code will never return null. Should I trust the annotation, or the common sense that the "then" branch of the conditional operator may sometimes be selected? The consequence of an NPE from this would probably be an application crash.
Since I'm using this from Kotlin, it of course complains that I'm making a redundant null check.