Generated Bindings Remove Generics

I am trying to bind an abstract class that uses generics:

public abstract class ResponseCallback<T>
{
  public ResponseCallback() {}

  public abstract void onResponse(Response<T> paramResponse);

  public abstract void onError(int paramInt, String paramString);
}

However, the generated C# file does not have this

 // Metadata.xml XPath class reference: path="/api/package[@name='com.test.test.module.api']/class[@name='ResponseCallback']"
[global::Android.Runtime.Register ("com/test/test/module/api/ResponseCallback", DoNotGenerateAcw=true)]
[global::Java.Interop.JavaTypeParameters (new string [] {"T"})]
public abstract partial class ResponseCallback : global::Java.Lang.Object {

    internal    new     static  readonly    JniPeerMembers  _members    = new XAPeerMembers ("com/test/test/module/api/ResponseCallback", typeof (ResponseCallback));
    internal static new IntPtr class_ref {
        get {
            return _members.JniPeerType.PeerReference.Handle;
        }
    }

    public override global::Java.Interop.JniPeerMembers JniPeerMembers {
        get { return _members; }
    }

    protected override IntPtr ThresholdClass {
        get { return _members.JniPeerType.PeerReference.Handle; }
    }

    protected override global::System.Type ThresholdType {
        get { return _members.ManagedPeerType; }
    }

    protected ResponseCallback (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {}

    // Metadata.xml XPath constructor reference: path="/api/package[@name='com.test.test.module.api']/class[@name='ResponseCallback']/constructor[@name='ResponseCallback' and count(parameter)=0]"
    [Register (".ctor", "()V", "")]
    public unsafe ResponseCallback ()
        : base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer)
    {
        const string __id = "()V";

        if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero)
            return;

        try {
            var __r = _members.InstanceMethods.StartCreateInstance (__id, ((object) this).GetType (), null);
            SetHandle (__r.Handle, JniHandleOwnership.TransferLocalRef);
            _members.InstanceMethods.FinishCreateInstance (__id, this, null);
        } finally {
        }
    }

    static Delegate cb_onError_ILjava_lang_String_;

    static Delegate GetOnError_ILjava_lang_String_Handler ()
    {
        if (cb_onError_ILjava_lang_String_ == null)
            cb_onError_ILjava_lang_String_ = JNINativeWrapper.CreateDelegate ((Action<IntPtr, IntPtr, int, IntPtr>) n_OnError_ILjava_lang_String_);
        return cb_onError_ILjava_lang_String_;
    }

    static void n_OnError_ILjava_lang_String_ (IntPtr jnienv, IntPtr native__this, int p0, IntPtr native_p1)
    {
        global::Com.Test.Test.Module.Api.ResponseCallback __this = global::Java.Lang.Object.GetObject<global::Com.Test.Test.Module.Api.ResponseCallback> (jnienv, native__this, JniHandleOwnership.DoNotTransfer);
        string p1 = JNIEnv.GetString (native_p1, JniHandleOwnership.DoNotTransfer);
        __this.OnError (p0, p1);
    }


    // Metadata.xml XPath method reference: path="/api/package[@name='com.test.test.module.api']/class[@name='ResponseCallback']/method[@name='onError' and count(parameter)=2 and parameter[1][@type='int'] and parameter[2][@type='java.lang.String']]"
    [Register ("onError", "(ILjava/lang/String;)V", "GetOnError_ILjava_lang_String_Handler")]
    public abstract void OnError (int p0, string p1);

}

[global::Android.Runtime.Register ("com/test/test/module/api/ResponseCallback", DoNotGenerateAcw=true)]
internal partial class ResponseCallbackInvoker : ResponseCallback {

    public ResponseCallbackInvoker (IntPtr handle, JniHandleOwnership transfer) : base (handle, transfer) {}

    internal    new     static  readonly    JniPeerMembers  _members    = new JniPeerMembers ("com/test/test/module/api/ResponseCallback", typeof (ResponseCallbackInvoker));

    public override global::Java.Interop.JniPeerMembers JniPeerMembers {
        get { return _members; }
    }

    protected override global::System.Type ThresholdType {
        get { return _members.ManagedPeerType; }
    }

    // Metadata.xml XPath method reference: path="/api/package[@name='com.test.test.module.api']/class[@name='ResponseCallback']/method[@name='onError' and count(parameter)=2 and parameter[1][@type='int'] and parameter[2][@type='java.lang.String']]"
    [Register ("onError", "(ILjava/lang/String;)V", "GetOnError_ILjava_lang_String_Handler")]
    public override unsafe void OnError (int p0, string p1)
    {
        const string __id = "onError.(ILjava/lang/String;)V";
        IntPtr native_p1 = JNIEnv.NewString (p1);
        try {
            JniArgumentValue* __args = stackalloc JniArgumentValue [2];
            __args [0] = new JniArgumentValue (p0);
            __args [1] = new JniArgumentValue (native_p1);
            _members.InstanceMethods.InvokeAbstractVoidMethod (__id, this, __args);
        } finally {
            JNIEnv.DeleteLocalRef (native_p1);
        }
    }

}

As you can see, I am missing the public abstract void onResponse(Response<T> paramResponse); node in my generated code. What can I do to get this and the generics included in the C# code? I have been googling all night and cant find anything.

Some articles suggest adding to the Additions file in the binding project, but I can't figure out how to get it to work and there is no documentation on the Addtions section of the binding process.

NOTE: I changed the paths in the Metadata comments as it is proprietary.

Tagged:

Answers

Sign In or Register to comment.