-
Notifications
You must be signed in to change notification settings - Fork 564
Description
Context: dotnet/android-libraries#56
Currently, binding projects only emit binding assemblies. They don't do any "sanity checking" to ensure that the binding assembly is usable.
Enter dotnet/android-libraries#56: the Xamarin.Google.Android.Material 1.1.0-rc1 NuGet package contains a bug, as it binds the com.google.android.material.button.MaterialButton.OnPressedChangeListener interface as Google.Android.Material.Button.MaterialButton/IOnPressedChangeListener. However, MaterialButton.OnPressedChangeListener is not public; it's (presumably?) package-private, and as such it cannot be used from outside of its containing package.
The result is that if an app tries to use the Xamarin.Google.Android.Material NuGet package, it will fail to build:
javac error JAVAC0000: error: OnPressedChangeListener is not public in MaterialButton; cannot be accessed from outside package
This is in part a generator bug: dotnet/java-interop#572
That said, there is also a "defense in depth" argument to be made here: the binding built, but it should never have built in the first place!
To ensure that binding projects are actually usable, the Build target for binding projects should also:
- Generate the Java Callable Wrappers for the binding assembly, and
- Build the Java Callable Wrappers.
This would avoid the need to create a new App project which references the Binding project to ensure that it works, which may result in "false positives" (e.g. if the App test project is built in Release config, the types which emit the "invalid" Java Callable Wrappers may never be emitted, resulting in a "good App" but a "bad binding assembly").