Skip to content

Conversation

@jonpryor
Copy link
Contributor

jonpryor added a commit to jonpryor/java.interop that referenced this pull request Aug 10, 2017
Context: dotnet/android#732

Commit d7dfa0b [broke][1] the
`xamarin-android/tests/CodeGen-Binding/Xamarin.Android.McwGen-Tests`
build, as it started treating `Android.Graphics.Color` as a normal
type, instead of the special-cased behavior it should have:

[1]: https://jenkins.mono-project.com/job/xamarin-android-pr-builder/1324/

	error CS0452: The type 'Color' must be a reference type in order to use it as parameter 'T' in the generic type or method 'Object.GetObject<T>(IntPtr, JniHandleOwnership)'
	error CS1503: Argument 1: cannot convert from 'Android.Graphics.Color' to 'Android.Runtime.IJavaObject'

The problem is that this code pattern:

	static int n_UseColors_I (IntPtr jnienv, IntPtr native__this, int native_p0)
	{
		global::Com.Xamarin.Android.Bxc4288 __this = global::Java.Lang.Object.GetObject<global::Com.Xamarin.Android.Bxc4288> (jnienv, native__this, JniHandleOwnership.DoNotTransfer);
		global::Android.Graphics.Color p0 = new global::Android.Graphics.Color (native_p0);
		return __this.UseColors (p0).ToArgb ();
	}

became:

	static IntPtr n_UseColors_LAndroid_Graphics_Color_ (IntPtr jnienv, IntPtr native__this, IntPtr native_p0)
	{
		global::Com.Xamarin.Android.Bxc4288 __this = global::Java.Lang.Object.GetObject<global::Com.Xamarin.Android.Bxc4288> (jnienv, native__this, JniHandleOwnership.DoNotTransfer);
		global::Android.Graphics.Color p0 = global::Java.Lang.Object.GetObject<global::Android.Graphics.Color> (native_p0, JniHandleOwnership.DoNotTransfer);
		IntPtr __ret = JNIEnv.ToLocalJniHandle (__this.UseColors (p0));
		return __ret;
	}

The cause reason for this is that d7dfa0b updated
`SymbolTable.AddType()` so that it no longer called
`SymbolTable.ShouldAddType()`, which is what would prevent
type registration of `Android.Graphics.Color`.

Reintroduce the call to `ShouldAddType()` so that
`Android.Graphics.Color` isn't registered.
atsushieno pushed a commit to dotnet/java-interop that referenced this pull request Aug 10, 2017
Context: dotnet/android#732

Commit d7dfa0b [broke][1] the
`xamarin-android/tests/CodeGen-Binding/Xamarin.Android.McwGen-Tests`
build, as it started treating `Android.Graphics.Color` as a normal
type, instead of the special-cased behavior it should have:

[1]: https://jenkins.mono-project.com/job/xamarin-android-pr-builder/1324/

	error CS0452: The type 'Color' must be a reference type in order to use it as parameter 'T' in the generic type or method 'Object.GetObject<T>(IntPtr, JniHandleOwnership)'
	error CS1503: Argument 1: cannot convert from 'Android.Graphics.Color' to 'Android.Runtime.IJavaObject'

The problem is that this code pattern:

	static int n_UseColors_I (IntPtr jnienv, IntPtr native__this, int native_p0)
	{
		global::Com.Xamarin.Android.Bxc4288 __this = global::Java.Lang.Object.GetObject<global::Com.Xamarin.Android.Bxc4288> (jnienv, native__this, JniHandleOwnership.DoNotTransfer);
		global::Android.Graphics.Color p0 = new global::Android.Graphics.Color (native_p0);
		return __this.UseColors (p0).ToArgb ();
	}

became:

	static IntPtr n_UseColors_LAndroid_Graphics_Color_ (IntPtr jnienv, IntPtr native__this, IntPtr native_p0)
	{
		global::Com.Xamarin.Android.Bxc4288 __this = global::Java.Lang.Object.GetObject<global::Com.Xamarin.Android.Bxc4288> (jnienv, native__this, JniHandleOwnership.DoNotTransfer);
		global::Android.Graphics.Color p0 = global::Java.Lang.Object.GetObject<global::Android.Graphics.Color> (native_p0, JniHandleOwnership.DoNotTransfer);
		IntPtr __ret = JNIEnv.ToLocalJniHandle (__this.UseColors (p0));
		return __ret;
	}

The cause reason for this is that d7dfa0b updated
`SymbolTable.AddType()` so that it no longer called
`SymbolTable.ShouldAddType()`, which is what would prevent
type registration of `Android.Graphics.Color`.

Reintroduce the call to `ShouldAddType()` so that
`Android.Graphics.Color` isn't registered.
@jonpryor jonpryor force-pushed the jonp-bump-ji-30e01510 branch from 1a945fd to 835e348 Compare August 10, 2017 16:14
@jonpryor jonpryor changed the title Bump to Java.Interop/master/30e01510 Bump to Java.Interop/master/1cd03611 Aug 10, 2017
@jonpryor jonpryor mentioned this pull request Aug 10, 2017
@jonpryor jonpryor merged commit 028c51d into dotnet:master Aug 10, 2017
jonpryor added a commit to dotnet/java-interop that referenced this pull request Aug 10, 2017
Context: dotnet/android#732

Commit d7dfa0b [broke][1] the
`xamarin-android/tests/CodeGen-Binding/Xamarin.Android.McwGen-Tests`
build, as it started treating `Android.Graphics.Color` as a normal
type, instead of the special-cased behavior it should have:

[1]: https://jenkins.mono-project.com/job/xamarin-android-pr-builder/1324/

	error CS0452: The type 'Color' must be a reference type in order to use it as parameter 'T' in the generic type or method 'Object.GetObject<T>(IntPtr, JniHandleOwnership)'
	error CS1503: Argument 1: cannot convert from 'Android.Graphics.Color' to 'Android.Runtime.IJavaObject'

The problem is that this code pattern:

	static int n_UseColors_I (IntPtr jnienv, IntPtr native__this, int native_p0)
	{
		global::Com.Xamarin.Android.Bxc4288 __this = global::Java.Lang.Object.GetObject<global::Com.Xamarin.Android.Bxc4288> (jnienv, native__this, JniHandleOwnership.DoNotTransfer);
		global::Android.Graphics.Color p0 = new global::Android.Graphics.Color (native_p0);
		return __this.UseColors (p0).ToArgb ();
	}

became:

	static IntPtr n_UseColors_LAndroid_Graphics_Color_ (IntPtr jnienv, IntPtr native__this, IntPtr native_p0)
	{
		global::Com.Xamarin.Android.Bxc4288 __this = global::Java.Lang.Object.GetObject<global::Com.Xamarin.Android.Bxc4288> (jnienv, native__this, JniHandleOwnership.DoNotTransfer);
		global::Android.Graphics.Color p0 = global::Java.Lang.Object.GetObject<global::Android.Graphics.Color> (native_p0, JniHandleOwnership.DoNotTransfer);
		IntPtr __ret = JNIEnv.ToLocalJniHandle (__this.UseColors (p0));
		return __ret;
	}

The cause reason for this is that d7dfa0b updated
`SymbolTable.AddType()` so that it no longer called
`SymbolTable.ShouldAddType()`, which is what would prevent
type registration of `Android.Graphics.Color`.

Reintroduce the call to `ShouldAddType()` so that
`Android.Graphics.Color` isn't registered.
@github-actions github-actions bot locked and limited conversation to collaborators Feb 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants