Skip to content

Conversation

@jonpryor
Copy link
Contributor

@jonpryor jonpryor commented Apr 19, 2022

@jonpryor jonpryor force-pushed the jonp-bump-ji-05eddd9a branch from 6df99c7 to 298d056 Compare April 19, 2022 12:19
jonpryor added a commit to jonpryor/java.interop that referenced this pull request Apr 19, 2022
Context: a65d6fb
Context: dotnet/android#6939

dotnet/android#6939 attempted to bump to 05eddd9, which
promptly broke the build of src/Mono.Android, e.g.
`src/Mono.Android/obj/Debug/net6.0/android-32/mcw/Android.Widget.GridLayout.cs`:

	/*       */ partial class GridLayout {
	/*       */     partial class partial class LayoutParams {
	/*       */         [Register ("rowSpec")]
	/*       */         public Android.Widget.GridLayout.Spec? RowSpec {
	/*       */             get {
	/*       */                 const string __id = "rowSpec.Landroid/widget/GridLayout$Spec;";
	/*       */                 var __v = _members.InstanceFields.GetObjectValue (__id, this);
	/*       */                 return global::Java.Lang.Object.GetObject<Android.Widget.GridLayout.Spec> (__v.Handle, JniHandleOwnership.TransferLocalRef);
	/*       */             }
	/*       */             set {
	/*       */                 const string __id = "rowSpec.Landroid/widget/GridLayout$Spec;";
	/*       */                 IntPtr native_value = global::Android.Runtime.JNIEnv.ToLocalJniHandle (value);
	/*       */                 try {
	/* L 239 */                     _members.InstanceFields.SetValue (__id, this, new JniObjectReference (value));
	/*       */                 } finally {
	/* L 242 */                     global::Android.Runtime.JNIEnv.DeleteLocalRef (value);
	/*       */                 }
	/*       */             }
	/*       */         }
	/*       */     }
	/*       */ }

due to compilation errors:

	src/Mono.Android/obj/Debug/net6.0/android-32/mcw/Android.Widget.GridLayout.cs(239,77):
	  error CS1503: Argument 1: cannot convert from 'Android.Widget.GridLayout.Spec' to 'System.IntPtr'
	src/Mono.Android/obj/Debug/net6.0/android-32/mcw/Android.Widget.GridLayout.cs(242,54):
	  error CS1503: Argument 1: cannot convert from 'Android.Widget.GridLayout.Spec' to 'System.IntPtr'

This was caused by `BoundFieldAsProperty.cs` not appropriately
setting `arg` to `native_arg`, so that the correct variable would be
cleaned up in the `finally` block.

There was another set of errors:

	src/Mono.Android/obj/Release/net6.0/android-32/mcw/Android.Widget.ArrayAdapter.cs(525,53):
	  error CS1503: Argument 1: cannot convert from 'Java.Lang.ICharSequence[]' to 'string[]?'

which was also caused by a65d6fb mis-refactoring
`SourceWriterExtensions.cs`, and overlooking the entire existence of
the `CharSequence.ArrayToStringArray()` method (oops).

Update `generator` so that xamarin-android once again builds.
@jonpryor jonpryor marked this pull request as draft April 19, 2022 19:11
jonpryor added a commit to jonpryor/java.interop that referenced this pull request Apr 20, 2022
Context: a65d6fb
Context: dotnet/android#6939

dotnet/android#6939 attempted to bump to 05eddd9, which
promptly broke the build of src/Mono.Android, e.g.
`src/Mono.Android/obj/Debug/net6.0/android-32/mcw/Android.Widget.GridLayout.cs`:

	/*       */ partial class GridLayout {
	/*       */     partial class partial class LayoutParams {
	/*       */         [Register ("rowSpec")]
	/*       */         public Android.Widget.GridLayout.Spec? RowSpec {
	/*       */             get {
	/*       */                 const string __id = "rowSpec.Landroid/widget/GridLayout$Spec;";
	/*       */                 var __v = _members.InstanceFields.GetObjectValue (__id, this);
	/*       */                 return global::Java.Lang.Object.GetObject<Android.Widget.GridLayout.Spec> (__v.Handle, JniHandleOwnership.TransferLocalRef);
	/*       */             }
	/*       */             set {
	/*       */                 const string __id = "rowSpec.Landroid/widget/GridLayout$Spec;";
	/*       */                 IntPtr native_value = global::Android.Runtime.JNIEnv.ToLocalJniHandle (value);
	/*       */                 try {
	/* L 239 */                     _members.InstanceFields.SetValue (__id, this, new JniObjectReference (value));
	/*       */                 } finally {
	/* L 242 */                     global::Android.Runtime.JNIEnv.DeleteLocalRef (value);
	/*       */                 }
	/*       */             }
	/*       */         }
	/*       */     }
	/*       */ }

due to compilation errors:

	src/Mono.Android/obj/Debug/net6.0/android-32/mcw/Android.Widget.GridLayout.cs(239,77):
	  error CS1503: Argument 1: cannot convert from 'Android.Widget.GridLayout.Spec' to 'System.IntPtr'
	src/Mono.Android/obj/Debug/net6.0/android-32/mcw/Android.Widget.GridLayout.cs(242,54):
	  error CS1503: Argument 1: cannot convert from 'Android.Widget.GridLayout.Spec' to 'System.IntPtr'

This was caused by `BoundFieldAsProperty.cs` not appropriately
setting `arg` to `native_arg`, so that the correct variable would be
cleaned up in the `finally` block.

There was another set of errors:

	src/Mono.Android/obj/Release/net6.0/android-32/mcw/Android.Widget.ArrayAdapter.cs(525,53):
	  error CS1503: Argument 1: cannot convert from 'Java.Lang.ICharSequence[]' to 'string[]?'

which was also caused by a65d6fb mis-refactoring
`SourceWriterExtensions.cs`, and overlooking the entire existence of
the `CharSequence.ArrayToStringArray()` method (oops).

Update `generator` so that xamarin-android once again builds, and add
unit tests to hit these particular code paths.
@jonpryor jonpryor force-pushed the jonp-bump-ji-05eddd9a branch from 184fe23 to 76d0968 Compare April 20, 2022 18:06
jonpryor added a commit to jonpryor/java.interop that referenced this pull request Apr 21, 2022
Context: a65d6fb
Context: dotnet/android#6939

dotnet/android#6939 attempted to bump to 05eddd9, which
promptly broke the build of src/Mono.Android, e.g.
`src/Mono.Android/obj/Debug/net6.0/android-32/mcw/Android.Widget.GridLayout.cs`:

	/*       */ partial class GridLayout {
	/*       */     partial class partial class LayoutParams {
	/*       */         [Register ("rowSpec")]
	/*       */         public Android.Widget.GridLayout.Spec? RowSpec {
	/*       */             get {
	/*       */                 const string __id = "rowSpec.Landroid/widget/GridLayout$Spec;";
	/*       */                 var __v = _members.InstanceFields.GetObjectValue (__id, this);
	/*       */                 return global::Java.Lang.Object.GetObject<Android.Widget.GridLayout.Spec> (__v.Handle, JniHandleOwnership.TransferLocalRef);
	/*       */             }
	/*       */             set {
	/*       */                 const string __id = "rowSpec.Landroid/widget/GridLayout$Spec;";
	/*       */                 IntPtr native_value = global::Android.Runtime.JNIEnv.ToLocalJniHandle (value);
	/*       */                 try {
	/* L 239 */                     _members.InstanceFields.SetValue (__id, this, new JniObjectReference (value));
	/*       */                 } finally {
	/* L 242 */                     global::Android.Runtime.JNIEnv.DeleteLocalRef (value);
	/*       */                 }
	/*       */             }
	/*       */         }
	/*       */     }
	/*       */ }

due to compilation errors:

	src/Mono.Android/obj/Debug/net6.0/android-32/mcw/Android.Widget.GridLayout.cs(239,77):
	  error CS1503: Argument 1: cannot convert from 'Android.Widget.GridLayout.Spec' to 'System.IntPtr'
	src/Mono.Android/obj/Debug/net6.0/android-32/mcw/Android.Widget.GridLayout.cs(242,54):
	  error CS1503: Argument 1: cannot convert from 'Android.Widget.GridLayout.Spec' to 'System.IntPtr'

This was caused by `BoundFieldAsProperty.cs` not appropriately
setting `arg` to `native_arg`, so that the correct variable would be
cleaned up in the `finally` block.

There was another set of errors:

	src/Mono.Android/obj/Release/net6.0/android-32/mcw/Android.Widget.ArrayAdapter.cs(525,53):
	  error CS1503: Argument 1: cannot convert from 'Java.Lang.ICharSequence[]' to 'string[]?'

which was also caused by a65d6fb mis-refactoring
`SourceWriterExtensions.cs`, and overlooking the entire existence of
the `CharSequence.ArrayToStringArray()` method (oops).

Update `generator` so that xamarin-android once again builds, and add
unit tests to hit these particular code paths.
jonpryor added a commit to dotnet/java-interop that referenced this pull request Apr 21, 2022
Context: a65d6fb
Context: dotnet/android#6939

dotnet/android#6939 attempted to bump to 05eddd9, which
promptly broke the build of src/Mono.Android, e.g.
`src/Mono.Android/obj/Debug/net6.0/android-32/mcw/Android.Widget.GridLayout.cs`:

	/*       */ partial class GridLayout {
	/*       */     partial class partial class LayoutParams {
	/*       */         [Register ("rowSpec")]
	/*       */         public Android.Widget.GridLayout.Spec? RowSpec {
	/*       */             get {
	/*       */                 const string __id = "rowSpec.Landroid/widget/GridLayout$Spec;";
	/*       */                 var __v = _members.InstanceFields.GetObjectValue (__id, this);
	/*       */                 return global::Java.Lang.Object.GetObject<Android.Widget.GridLayout.Spec> (__v.Handle, JniHandleOwnership.TransferLocalRef);
	/*       */             }
	/*       */             set {
	/*       */                 const string __id = "rowSpec.Landroid/widget/GridLayout$Spec;";
	/*       */                 IntPtr native_value = global::Android.Runtime.JNIEnv.ToLocalJniHandle (value);
	/*       */                 try {
	/* L 239 */                     _members.InstanceFields.SetValue (__id, this, new JniObjectReference (value));
	/*       */                 } finally {
	/* L 242 */                     global::Android.Runtime.JNIEnv.DeleteLocalRef (value);
	/*       */                 }
	/*       */             }
	/*       */         }
	/*       */     }
	/*       */ }

due to compilation errors:

	src/Mono.Android/obj/Debug/net6.0/android-32/mcw/Android.Widget.GridLayout.cs(239,77):
	  error CS1503: Argument 1: cannot convert from 'Android.Widget.GridLayout.Spec' to 'System.IntPtr'
	src/Mono.Android/obj/Debug/net6.0/android-32/mcw/Android.Widget.GridLayout.cs(242,54):
	  error CS1503: Argument 1: cannot convert from 'Android.Widget.GridLayout.Spec' to 'System.IntPtr'

This was caused by `BoundFieldAsProperty.cs` not appropriately
setting `arg` to `native_arg`, so that the correct variable would be
cleaned up in the `finally` block.

There was another set of errors:

	src/Mono.Android/obj/Release/net6.0/android-32/mcw/Android.Widget.ArrayAdapter.cs(525,53):
	  error CS1503: Argument 1: cannot convert from 'Java.Lang.ICharSequence[]' to 'string[]?'

which was also caused by a65d6fb mis-refactoring
`SourceWriterExtensions.cs`, and overlooking the entire existence of
the `CharSequence.ArrayToStringArray()` method (oops).

Update `generator` so that xamarin-android once again builds, and add
unit tests to hit these particular code paths.
Fixes: dotnet/java-interop#967

Changes: dotnet/java-interop@05bfece...2a882d2

  * dotnet/java-interop@2a882d2d: [generator] Fix xamarin-android/src/Mono.Android build (dotnet#972)
  * dotnet/java-interop@968e0f5f: [Directory.Build.props] Set dummy $(PackageVersion) to appease NuGet (dotnet#971)
  * dotnet/java-interop@05eddd9a: [generator] Add string cast to prevent CS1503 (dotnet#970)
  * dotnet/java-interop@37cff251: [Java.Base, generator] Bind all of package java.io (dotnet#968)
  * dotnet/java-interop@a65d6fb4: [Java.Base, generator] Bind all of package java.lang (dotnet#966)
  * dotnet/java-interop@ed9c2abf: [Java.Interop-MonoAndroid] Set Version after Directory.Build.props (dotnet#965)
@jonpryor jonpryor force-pushed the jonp-bump-ji-05eddd9a branch from 76d0968 to 641c65e Compare April 21, 2022 16:30
@jonpryor jonpryor marked this pull request as ready for review April 21, 2022 16:30
@jonpryor jonpryor changed the title Bump to xamarin/Java.Interop/main@05eddd9a Bump to xamarin/java.interop@2a882d2d Apr 21, 2022
@jonpryor jonpryor merged commit 2cca764 into dotnet:main Apr 21, 2022
jonathanpeppers pushed a commit that referenced this pull request Apr 25, 2022
Fixes: dotnet/java-interop#967

Changes: dotnet/java-interop@05bfece...2a882d2

  * dotnet/java-interop@2a882d2d: [generator] Fix xamarin-android/src/Mono.Android build (#972)
  * dotnet/java-interop@968e0f5f: [Directory.Build.props] Set dummy $(PackageVersion) to appease NuGet (#971)
  * dotnet/java-interop@05eddd9a: [generator] Add string cast to prevent CS1503 (#970)
  * dotnet/java-interop@37cff251: [Java.Base, generator] Bind all of package java.io (#968)
  * dotnet/java-interop@a65d6fb4: [Java.Base, generator] Bind all of package java.lang (#966)
  * dotnet/java-interop@ed9c2abf: [Java.Interop-MonoAndroid] Set Version after Directory.Build.props (#965)
@github-actions github-actions bot locked and limited conversation to collaborators Jan 24, 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.

CS1503 changing string to JLO via managedType

1 participant