From 4e42987aff8b599ba4e4c8a5f6812435e0073791 Mon Sep 17 00:00:00 2001 From: Jonathan Pryor Date: Wed, 15 Nov 2017 08:18:41 -0500 Subject: [PATCH] [Java.Interop] JniType.RegisterNativeMethods() is public MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Context: https://github.com/xamarin/xamarin-android/pull/1027 Context: https://jenkins.mono-project.com/job/xamarin-android-pr-builder/2048/ Commit 7d511631 changed the visibility of `JniType.RegisterNativeMethods()` from `public` to `internal`, in an effort to reduce the likelihood of "user error" from calling `JNIEnv::RegisterNatives()` multiple times, as `JNIEnv::RegisterNatives()` invocations are *replacements*, not "additive"; calling it more than once is *generally* Wrong™. *Unfortunately*, `JniType.RegisterNativeMethods()` is part of the public and shipping API, so we can't remove it, as seen in the [xamarin-android PR build][pr2048] output: [pr2048]: https://jenkins.mono-project.com/job/xamarin-android-pr-builder/2048/consoleText ABI BREAK IN: Java.Interop.dll

Namespace Java.Interop

Type Changed: Java.Interop.JniType

Removed method:

	        public void RegisterNativeMethods (JniNativeMethodRegistration[]);
	
Revert the visibility of `JniType.RegisterNativeMethods()` to `public`, so that we don't break API compatibility. --- src/Java.Interop/Java.Interop/JniType.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Java.Interop/Java.Interop/JniType.cs b/src/Java.Interop/Java.Interop/JniType.cs index ed36151e4..35aa384fe 100644 --- a/src/Java.Interop/Java.Interop/JniType.cs +++ b/src/Java.Interop/Java.Interop/JniType.cs @@ -135,7 +135,7 @@ public bool IsInstanceOfType (JniObjectReference value) JniNativeMethodRegistration[] methods; #pragma warning restore 0414 - internal void RegisterNativeMethods (params JniNativeMethodRegistration[] methods) + public void RegisterNativeMethods (params JniNativeMethodRegistration[] methods) { AssertValid ();