Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/generator-Tests/Integration-Tests/Java_Util_List.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace generatortests
[TestFixture]
public class Java_Util_List : BaseGeneratorTest
{
protected override bool TryJavaInterop1 => false;
protected override bool TryJavaInterop1 => true;

[Test]
public void GeneratedOK ()
Expand Down
2 changes: 1 addition & 1 deletion tests/generator-Tests/Integration-Tests/PamareterXPath.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace generatortests
[TestFixture]
public class ParameterXPath : BaseGeneratorTest
{
protected override bool TryJavaInterop1 => false;
protected override bool TryJavaInterop1 => true;

[Test]
public void GeneratedOK ()
Expand Down
14 changes: 14 additions & 0 deletions tests/generator-Tests/expected.ji/NormalMethods/NormalMethods.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@
final="false" name="Integer" static="false" visibility="public">
</class>
</package>

<package name="java.util" jni-name="java/util">
<interface abstract="true" deprecated="not deprecated" final="false" name="List" static="false" visibility="public" jni-signature="Ljava/util/List;">
<typeParameters>
<typeParameter name="E" classBound="java.lang.Object" jni-classBound="Ljava/lang/Object;"></typeParameter>
</typeParameters>
</interface>
<class abstract="false" deprecated="not deprecated" extends="java.lang.Object" extends-generic-aware="java.lang.Object" jni-extends="Ljava/lang/Object;" final="false" name="ArrayList" static="false" visibility="public" jni-signature="Ljava/util/ArrayList;">
<typeParameters>
<typeParameter name="E" classBound="java.lang.Object" jni-classBound="Ljava/lang/Object;"></typeParameter>
</typeParameters>
</class>
</package>

<package name="xamarin.test">
<!--
public class SomeObject {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

#nullable restore
using System;
using System.Collections.Generic;
using Java.Interop;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

#nullable restore
using System;
using System.Collections.Generic;
using Java.Interop;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using Java.Interop;

namespace Java.Util {

// Metadata.xml XPath interface reference: path="/api/package[@name='java.util']/interface[@name='List']"
[global::Java.Interop.JniTypeSignature ("java/util/List", GenerateJavaPeer=false)]
[global::Java.Interop.JavaTypeParameters (new string [] {"E"})]
public partial interface IList : IJavaPeerable {
}

[global::Java.Interop.JniTypeSignature ("java/util/List", GenerateJavaPeer=false)]
internal partial class IListInvoker : global::Java.Lang.Object, IList {
[global::System.Diagnostics.DebuggerBrowsable (global::System.Diagnostics.DebuggerBrowsableState.Never)]
[global::System.ComponentModel.EditorBrowsable (global::System.ComponentModel.EditorBrowsableState.Never)]
public override global::Java.Interop.JniPeerMembers JniPeerMembers {
get { return _members_java_util_List; }
}

static readonly JniPeerMembers _members_java_util_List = new JniPeerMembers ("java/util/List", typeof (IListInvoker));

public IListInvoker (ref JniObjectReference reference, JniObjectReferenceOptions options) : base (ref reference, options)
{
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)Java.Lang.Integer.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Java.Lang.Object.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Java.Util.IList.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Xamarin.Test.A.cs" />
<Compile Include="$(MSBuildThisFileDirectory)__NamespaceMapping__.cs" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@
final="false" name="Integer" static="false" visibility="public">
</class>
</package>

<package name="java.util" jni-name="java/util">
<interface abstract="true" deprecated="not deprecated" final="false" name="List" static="false" visibility="public" jni-signature="Ljava/util/List;">
<typeParameters>
<typeParameter name="E" classBound="java.lang.Object" jni-classBound="Ljava/lang/Object;"></typeParameter>
</typeParameters>
</interface>
</package>

<package name="xamarin.test">
<!--
public class A<T extends java.lang.Object> extends java.lang.Object {
Expand Down
21 changes: 15 additions & 6 deletions tests/generator-Tests/expected.ji/ParameterXPath/Xamarin.Test.A.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

#nullable restore
using System;
using System.Collections.Generic;
using Java.Interop;
Expand All @@ -21,31 +31,30 @@ protected A (ref JniObjectReference reference, JniObjectReferenceOptions options
}

// Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='A']/method[@name='setA' and count(parameter)=1 and parameter[1][@type='T']]"
[global::Java.Interop.JniMethodSignature ("setA", "(Ljava/lang/Object;)V")]
public virtual unsafe void SetA (global::Java.Lang.Object adapter)
{
const string __id = "setA.(Ljava/lang/Object;)V";
IntPtr native_adapter = JNIEnv.ToLocalJniHandle (adapter);
var native_adapter = (adapter?.PeerReference ?? default);
try {
JniArgumentValue* __args = stackalloc JniArgumentValue [1];
__args [0] = new JniArgumentValue (native_adapter);
_members.InstanceMethods.InvokeVirtualVoidMethod (__id, this, __args);
} finally {
JNIEnv.DeleteLocalRef (native_adapter);
global::System.GC.KeepAlive (adapter);
}
}

// Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='A']/method[@name='listTest' and count(parameter)=1 and parameter[1][@type='java.util.List&lt;java.lang.Integer&gt;']]"
public virtual unsafe void ListTest (global::System.Collections.Generic.IList<global::Java.Lang.Integer> p0)
[global::Java.Interop.JniMethodSignature ("listTest", "(Ljava/util/List;)V")]
public virtual unsafe void ListTest (global::Java.Util.IList p0)
{
const string __id = "listTest.(Ljava/util/List;)V";
IntPtr native_p0 = global::Android.Runtime.JavaList<global::Java.Lang.Integer>.ToLocalJniHandle (p0);
try {
JniArgumentValue* __args = stackalloc JniArgumentValue [1];
__args [0] = new JniArgumentValue (native_p0);
__args [0] = new JniArgumentValue (p0);
_members.InstanceMethods.InvokeVirtualVoidMethod (__id, this, __args);
} finally {
JNIEnv.DeleteLocalRef (native_p0);
global::System.GC.KeepAlive (p0);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

#nullable restore
using System;
using System.Collections.Generic;
using Java.Interop;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using Java.Interop;

namespace Java.Util {

// Metadata.xml XPath interface reference: path="/api/package[@name='java.util']/interface[@name='List']"
[global::Java.Interop.JniTypeSignature ("java/util/List", GenerateJavaPeer=false)]
[global::Java.Interop.JavaTypeParameters (new string [] {"E"})]
public partial interface IList : IJavaPeerable {
}

[global::Java.Interop.JniTypeSignature ("java/util/List", GenerateJavaPeer=false)]
internal partial class IListInvoker : global::Java.Lang.Object, IList {
[global::System.Diagnostics.DebuggerBrowsable (global::System.Diagnostics.DebuggerBrowsableState.Never)]
[global::System.ComponentModel.EditorBrowsable (global::System.ComponentModel.EditorBrowsableState.Never)]
public override global::Java.Interop.JniPeerMembers JniPeerMembers {
get { return _members_java_util_List; }
}

static readonly JniPeerMembers _members_java_util_List = new JniPeerMembers ("java/util/List", typeof (IListInvoker));

public IListInvoker (ref JniObjectReference reference, JniObjectReferenceOptions options) : base (ref reference, options)
{
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<!-- Classes -->
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)Java.Lang.Object.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Java.Util.IList.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Xamarin.Test.SomeObject.cs" />
<Compile Include="$(MSBuildThisFileDirectory)__NamespaceMapping__.cs" />
</ItemGroup>
Expand Down
Loading