You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AnyJavaObject provides an as method that performs a dynamic cast to another AnyJavaObject-conforming type, then returns an optional with either the casted type or nil to indicate failure.
When casting to the superclass type or the type of one of the interfaces that a type extends, the result will never be nil. Developers performing these upcasts will have to force-unwrap these results. For example:
The text was updated successfully, but these errors were encountered:
DougGregor
changed the title
Create non-optional-returning as functions for superclasses/
Create non-optional-returning as functions for superclasses/extended interfaces
Sep 30, 2024
AnyJavaObject
provides anas
method that performs a dynamic cast to anotherAnyJavaObject-
conforming type, then returns an optional with either the casted type ornil
to indicate failure.When casting to the superclass type or the type of one of the interfaces that a type extends, the result will never be
nil
. Developers performing these upcasts will have to force-unwrap these results. For example:As part of generating the
Throwable
Swift type, we could provide non-optional-returning overloads ofas
, e.g.,The text was updated successfully, but these errors were encountered: