Skip to content

Commit

Permalink
[jcw-gen] Skip interface types (#825)
Browse files Browse the repository at this point in the history
Context: ebd7d76

ebd7d76 introduced support for including interfaces within typemaps,
but it failed to update the `jcw-gen` utility to ignore interfaces
when generating Java Callable Wrappers.  This, in turn, caused
Xamarin.Android builds to fail:

	bin/Release/lib/xamarin.android/xbuild/Xamarin/Android/jcw-gen.exe" -v10 -o "src/Mono.Android/obj/Release/netcoreapp3.1/android-30/jcw/src" \
	    -L "bin/Release/lib/xamarin.android/xbuild-frameworks/Microsoft.Android/netcoreapp3.1/" \
	    -L "~/.nuget/packages/microsoft.netcore.app.ref/3.1.0/ref/netcoreapp3.1/" \
	    "bin/Release/lib/xamarin.android/xbuild-frameworks/Microsoft.Android/netcoreapp3.1/Mono.Android.dll"
	  jcw-gen: Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA4200: Cannot generate Java wrapper for type 'Org.XmlPull.V1.IXmlPullParser'. Only 'class' types are supported.
	    at Java.Interop.Tools.Diagnostics.Diagnostic.Error (System.Int32 code, Mono.Cecil.Cil.SequencePoint location, System.String message, System.Object[] args) [0x00000] in external/Java.Interop/src/Java.Interop.Tools.Diagnostics/Java.Interop.Tools.Diagnostics/Diagnostic.cs:153 
	    at Java.Interop.Tools.JavaCallableWrappers.JavaCallableWrapperGenerator..ctor (Mono.Cecil.TypeDefinition type, System.String outerType, System.Action`2[T1,T2] log, Java.Interop.Tools.Cecil.TypeDefinitionCache cache) [0x0007f] in external/Java.Interop/src/Java.Interop.Tools.JavaCallableWrappers/Java.Interop.Tools.JavaCallableWrappers/JavaCallableWrapperGenerator.cs:113 
	    at Java.Interop.Tools.JavaCallableWrappers.JavaCallableWrapperGenerator..ctor (Mono.Cecil.TypeDefinition type, System.Action`2[T1,T2] log, Java.Interop.Tools.Cecil.TypeDefinitionCache cache) [0x00000] in external/Java.Interop/src/Java.Interop.Tools.JavaCallableWrappers/Java.Interop.Tools.JavaCallableWrappers/JavaCallableWrapperGenerator.cs:65 
	    at Java.Interop.Tools.App.GenerateJavaCallableWrapper (Mono.Cecil.TypeDefinition type, System.String outputPath, Java.Interop.Tools.Cecil.TypeDefinitionCache cache) [0x00000] in external/Java.Interop/tools/jcw-gen/App.cs:86 
	    at Java.Interop.Tools.App.Main (System.String[] args) [0x00215] in Java.Interop/tools/jcw-gen/App.cs:71

Fix the issue by ignoring interfaces within `jcw-gen`.
  • Loading branch information
grendello authored Apr 22, 2021
1 parent 6439990 commit f9faaab
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tools/jcw-gen/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ public static int Main (string [] args)

static void GenerateJavaCallableWrapper (TypeDefinition type, string outputPath, TypeDefinitionCache cache)
{
if (type.IsInterface) {
return;
}

var generator = new JavaCallableWrapperGenerator (type, log: Console.WriteLine, cache) {
};
generator.Generate (outputPath);
Expand Down

0 comments on commit f9faaab

Please sign in to comment.