Closed cosminstirbu closed 4 years ago
It's something we've started discussing over the past few weeks. Currently we are working on bringing C# 8's default interface methods to Xamarin.Android, as it's a large gap compared to Java we've needed for a long time.
Nullable reference types is one of the things we are considering after that. It's good to know that the Android SDK has been annotated in a way we should be able to use. That was one of the questions we had that we hadn't explored yet. Obviously that makes the feature much more valuable instead of just marking everything as nullable because we don't actually know.
Related: in order to reasonably map the @nullable
annotation -- do we know the exact type involved here? Kotlin appears to use org.jetbrains.annotations.NotNull
-- we'll need to add support for parsing annotations -- PR #467 is a start, but it only handles types, not parameters -- but also propagate that info into the XML description.
We'd presumably need RuntimeVisibleParameterAnnotations
and RuntimeInvisibleParameterAnnotations
parsing support.
@jonpryor There is this SO post with a list: https://stackoverflow.com/questions/4963300/which-notnull-java-annotation-should-i-use
Hello,
Are there any plans to update the Xamarin.Android bindings (and the generator it self) to support C# 8 nullability?
Since Kotlin adoption by Google the Java Android SDK and the AndroidX libraries have been enhanced to expose the @Nullable annotation to help Kotlin indicate if it a value can be null or not.
The bindings generator could also leverage the @Nullable annotation to expose C# 8 nullable types.
On Xamarin.iOS there is an issue already opened to capture this https://github.com/xamarin/xamarin-macios/issues/6154 and since I didn't find one for Xamarin.Android I've decided to open one myself.
Thank you, Cosmin