diff --git a/src/Java.Interop.Localization/Resources.Designer.cs b/src/Java.Interop.Localization/Resources.Designer.cs index 76e8734a8..81ed44908 100644 --- a/src/Java.Interop.Localization/Resources.Designer.cs +++ b/src/Java.Interop.Localization/Resources.Designer.cs @@ -123,15 +123,6 @@ public static string Generator_BG4400 { } } - /// - /// Looks up a localized string similar to 'lang-features=default-interface-methods' is not compatible with 'codegen-target=xamarinandroid'.. - /// - public static string Generator_BG4500 { - get { - return ResourceManager.GetString("Generator_BG4500", resourceCulture); - } - } - /// /// Looks up a localized string similar to Unexpected class child {0}.. /// diff --git a/src/Java.Interop.Localization/Resources.resx b/src/Java.Interop.Localization/Resources.resx index 95a902004..69753f855 100644 --- a/src/Java.Interop.Localization/Resources.resx +++ b/src/Java.Interop.Localization/Resources.resx @@ -146,10 +146,6 @@ In this message, the term "constants" refers to class or interface members that Unexpected 'global::' specification. This error happens if 'global::' is specified in the Metadata.xml transform file, for example. The following are literal names and should not be translated: global::, Metadata.xml. - - 'lang-features=default-interface-methods' is not compatible with 'codegen-target=xamarinandroid'. - The following are literal command line arguments and should not be translated: 'lang-features=default-interface-methods', 'codegen-target=xamarinandroid'. - Unexpected class child {0}. {0} - The unexpected child class. diff --git a/src/Java.Interop.Tools.Generator/Utilities/Report.cs b/src/Java.Interop.Tools.Generator/Utilities/Report.cs index 0ac90d9c7..76fa1bc74 100644 --- a/src/Java.Interop.Tools.Generator/Utilities/Report.cs +++ b/src/Java.Interop.Tools.Generator/Utilities/Report.cs @@ -33,7 +33,6 @@ public LocalizedMessage (int code, string value) public static LocalizedMessage ErrorRemoveAttrInvalidXPath => new LocalizedMessage (0x4306, Localization.Resources.Generator_BG4300); public static LocalizedMessage ErrorMissingAttrName => new LocalizedMessage (0x4307, Localization.Resources.Generator_BG4307); public static LocalizedMessage ErrorUnexpectedGlobal => new LocalizedMessage (0x4400, Localization.Resources.Generator_BG4400); - public static LocalizedMessage ErrorInvalidDIMArgument => new LocalizedMessage (0x4500, Localization.Resources.Generator_BG4500); public static LocalizedMessage WarningUnexpectedChild => new LocalizedMessage (0x8101, Localization.Resources.Generator_BG8101); public static LocalizedMessage WarningUnknownBaseType => new LocalizedMessage (0x8102, Localization.Resources.Generator_BG8102); diff --git a/tests/generator-Tests/Integration-Tests/AccessModifiers.cs b/tests/generator-Tests/Integration-Tests/AccessModifiers.cs index c749fb72c..1f0f8fb33 100644 --- a/tests/generator-Tests/Integration-Tests/AccessModifiers.cs +++ b/tests/generator-Tests/Integration-Tests/AccessModifiers.cs @@ -11,7 +11,7 @@ public void GeneratedOK () { RunAllTargets ( outputRelativePath: "AccessModifiers", - apiDescriptionFile: "expected/AccessModifiers/AccessModifiers.xml", + apiDescriptionFile: "expected.ji/AccessModifiers/AccessModifiers.xml", expectedRelativePath: "AccessModifiers", additionalSupportPaths: null); } diff --git a/tests/generator-Tests/Integration-Tests/Adapters.cs b/tests/generator-Tests/Integration-Tests/Adapters.cs index e93e7688f..417ee3811 100644 --- a/tests/generator-Tests/Integration-Tests/Adapters.cs +++ b/tests/generator-Tests/Integration-Tests/Adapters.cs @@ -1,4 +1,4 @@ -using System; +using System; using NUnit.Framework; namespace generatortests @@ -13,9 +13,9 @@ public void GeneratedOK () { RunAllTargets ( outputRelativePath: "Adapters", - apiDescriptionFile: "expected/Adapters/Adapters.xml", + apiDescriptionFile: "expected.ji/Adapters/Adapters.xml", expectedRelativePath: "Adapters", - additionalSupportPaths: new[]{ "expected/Adapters/SupportFiles" }); + additionalSupportPaths: new[]{ "expected.ji/Adapters/SupportFiles" }); } } } diff --git a/tests/generator-Tests/Integration-Tests/Android_Graphics_Color.cs b/tests/generator-Tests/Integration-Tests/Android_Graphics_Color.cs index 76323d70e..b3645bb9b 100644 --- a/tests/generator-Tests/Integration-Tests/Android_Graphics_Color.cs +++ b/tests/generator-Tests/Integration-Tests/Android_Graphics_Color.cs @@ -1,4 +1,4 @@ -using System; +using System; using NUnit.Framework; namespace generatortests @@ -11,7 +11,7 @@ public void GeneratedOK () { RunAllTargets ( outputRelativePath: "Android.Graphics.Color", - apiDescriptionFile: "expected/Android.Graphics.Color/Android.Graphics.Color.xml", + apiDescriptionFile: "expected.ji/Android.Graphics.Color/Android.Graphics.Color.xml", expectedRelativePath: "Android.Graphics.Color"); } } diff --git a/tests/generator-Tests/Integration-Tests/Arrays.cs b/tests/generator-Tests/Integration-Tests/Arrays.cs index 73e30baa3..651c03397 100644 --- a/tests/generator-Tests/Integration-Tests/Arrays.cs +++ b/tests/generator-Tests/Integration-Tests/Arrays.cs @@ -1,4 +1,4 @@ -using System; +using System; using NUnit.Framework; namespace generatortests @@ -11,7 +11,7 @@ public void GeneratedOK () { RunAllTargets ( outputRelativePath: "Arrays", - apiDescriptionFile: "expected/Arrays/Arrays.xml", + apiDescriptionFile: "expected.ji/Arrays/Arrays.xml", expectedRelativePath: "Arrays"); } } diff --git a/tests/generator-Tests/Integration-Tests/BaseGeneratorTest.cs b/tests/generator-Tests/Integration-Tests/BaseGeneratorTest.cs index 8de413537..55fe623b0 100644 --- a/tests/generator-Tests/Integration-Tests/BaseGeneratorTest.cs +++ b/tests/generator-Tests/Integration-Tests/BaseGeneratorTest.cs @@ -123,7 +123,6 @@ private byte[] ReadAllBytesIgnoringLineEndings (string path) protected void RunAllTargets (string outputRelativePath, string apiDescriptionFile, string expectedRelativePath, string[] additionalSupportPaths = null, string enumFieldsMapFile = null, string enumMethodMapFile = null, string metadataFile = null) { - Run (CodeGenerationTarget.XamarinAndroid, Path.Combine ("out", outputRelativePath), apiDescriptionFile, Path.Combine ("expected", expectedRelativePath), additionalSupportPaths, enumFieldsMapFile, enumMethodMapFile, metadataFile); Run (CodeGenerationTarget.XAJavaInterop1, Path.Combine ("out.xaji", outputRelativePath), apiDescriptionFile, Path.Combine ("expected.xaji", expectedRelativePath), additionalSupportPaths, enumFieldsMapFile, enumMethodMapFile, metadataFile); #if NET if (TryJavaInterop1) { diff --git a/tests/generator-Tests/Integration-Tests/CSharpKeywords.cs b/tests/generator-Tests/Integration-Tests/CSharpKeywords.cs index c874da492..ab7333b54 100644 --- a/tests/generator-Tests/Integration-Tests/CSharpKeywords.cs +++ b/tests/generator-Tests/Integration-Tests/CSharpKeywords.cs @@ -11,7 +11,7 @@ public void GeneratedOK () { RunAllTargets ( outputRelativePath: "CSharpKeywords", - apiDescriptionFile: "expected/CSharpKeywords/CSharpKeywords.xml", + apiDescriptionFile: "expected.ji/CSharpKeywords/CSharpKeywords.xml", expectedRelativePath: "CSharpKeywords"); } } diff --git a/tests/generator-Tests/Integration-Tests/Constructors.cs b/tests/generator-Tests/Integration-Tests/Constructors.cs index 2847f46fe..4882f4720 100644 --- a/tests/generator-Tests/Integration-Tests/Constructors.cs +++ b/tests/generator-Tests/Integration-Tests/Constructors.cs @@ -1,4 +1,4 @@ -using System; +using System; using NUnit.Framework; namespace generatortests @@ -11,7 +11,7 @@ public void GeneratedOK () { RunAllTargets ( outputRelativePath: "Constructors", - apiDescriptionFile: "expected/Constructors/Constructors.xml", + apiDescriptionFile: "expected.ji/Constructors/Constructors.xml", expectedRelativePath: "Constructors"); } } diff --git a/tests/generator-Tests/Integration-Tests/Core_ClassParse.cs b/tests/generator-Tests/Integration-Tests/Core_ClassParse.cs index 3f4b9af17..8954c5649 100644 --- a/tests/generator-Tests/Integration-Tests/Core_ClassParse.cs +++ b/tests/generator-Tests/Integration-Tests/Core_ClassParse.cs @@ -13,9 +13,9 @@ public void GeneratedOK () RunAllTargets ( outputRelativePath: "Core_ClassParse", - apiDescriptionFile: "expected/Core_ClassParse/api.xml", + apiDescriptionFile: "expected.ji/Core_ClassParse/api.xml", expectedRelativePath: "Core_ClassParse", - metadataFile: FullPath ("expected/Core_ClassParse/metadata.xml")); + metadataFile: FullPath ("expected.ji/Core_ClassParse/metadata.xml")); } } } diff --git a/tests/generator-Tests/Integration-Tests/Core_Jar2Xml.cs b/tests/generator-Tests/Integration-Tests/Core_Jar2Xml.cs index 49d3aa81f..3ec77c2e6 100644 --- a/tests/generator-Tests/Integration-Tests/Core_Jar2Xml.cs +++ b/tests/generator-Tests/Integration-Tests/Core_Jar2Xml.cs @@ -15,10 +15,10 @@ public void GeneratedOK () RunAllTargets ( outputRelativePath: "Core_Jar2Xml", - apiDescriptionFile: "expected/Core_Jar2Xml/api.xml", + apiDescriptionFile: "expected.ji/Core_Jar2Xml/api.xml", expectedRelativePath: "Core_Jar2Xml", - enumFieldsMapFile: "expected/Core_Jar2Xml/fields.xml", - enumMethodMapFile: "expected/Core_Jar2Xml/methods.xml" + enumFieldsMapFile: "expected.ji/Core_Jar2Xml/fields.xml", + enumMethodMapFile: "expected.ji/Core_Jar2Xml/methods.xml" ); } } diff --git a/tests/generator-Tests/Integration-Tests/Enumerations.cs b/tests/generator-Tests/Integration-Tests/Enumerations.cs deleted file mode 100644 index 8a9563ca6..000000000 --- a/tests/generator-Tests/Integration-Tests/Enumerations.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.IO; -using NUnit.Framework; - -namespace generatortests -{ - [TestFixture] - public class Enumerations : BaseGeneratorTest - { - [Test] - public void FixedUp_OK () - { - Cleanup ("out/EnumerationFixup"); - Options.ApiDescriptionFile = FullPath ("expected/EnumerationFixup/EnumerationFixup.xml"); - Options.EnumFieldsMapFile = FullPath ("expected/EnumerationFixup/EnumerationFixupMap.xml"); - Options.EnumOutputDirectory = Options.ManagedCallableWrapperSourceOutputDirectory = FullPath ("out/EnumerationFixup"); - Options.EnumMetadataOutputFile = Path.Combine (Options.EnumOutputDirectory, "enummetadata"); - Execute (); - Options.EnumFieldsMapFile = ""; - Options.EnumOutputDirectory = ""; - CompareOutputs ("expected/EnumerationFixup", "out/EnumerationFixup"); - } - - } -} - diff --git a/tests/generator-Tests/Integration-Tests/GenericArguments.cs b/tests/generator-Tests/Integration-Tests/GenericArguments.cs index 87b8f63b4..de97f10bf 100644 --- a/tests/generator-Tests/Integration-Tests/GenericArguments.cs +++ b/tests/generator-Tests/Integration-Tests/GenericArguments.cs @@ -1,4 +1,4 @@ -using System; +using System; using NUnit.Framework; namespace generatortests @@ -13,7 +13,7 @@ public void GeneratedOK () { RunAllTargets ( outputRelativePath: "GenericArguments", - apiDescriptionFile: "expected/GenericArguments/GenericArguments.xml", + apiDescriptionFile: "expected.ji/GenericArguments/GenericArguments.xml", expectedRelativePath: "GenericArguments", additionalSupportPaths: null); } diff --git a/tests/generator-Tests/Integration-Tests/InterfaceMethodsConflict.cs b/tests/generator-Tests/Integration-Tests/InterfaceMethodsConflict.cs index 36b5c9b95..c5dda3916 100644 --- a/tests/generator-Tests/Integration-Tests/InterfaceMethodsConflict.cs +++ b/tests/generator-Tests/Integration-Tests/InterfaceMethodsConflict.cs @@ -1,4 +1,4 @@ -using System; +using System; using NUnit.Framework; namespace generatortests @@ -11,7 +11,7 @@ public void GeneratedOK () { RunAllTargets ( outputRelativePath: "InterfaceMethodsConflict", - apiDescriptionFile: "expected/InterfaceMethodsConflict/InterfaceMethodsConflict.xml", + apiDescriptionFile: "expected.ji/InterfaceMethodsConflict/InterfaceMethodsConflict.xml", expectedRelativePath: "InterfaceMethodsConflict"); } } diff --git a/tests/generator-Tests/Integration-Tests/Interfaces.cs b/tests/generator-Tests/Integration-Tests/Interfaces.cs index 06d5f4917..2e3074bff 100644 --- a/tests/generator-Tests/Integration-Tests/Interfaces.cs +++ b/tests/generator-Tests/Integration-Tests/Interfaces.cs @@ -1,4 +1,4 @@ -using System; +using System; using NUnit.Framework; namespace generatortests @@ -13,7 +13,7 @@ public void Generated_OK () { RunAllTargets ( outputRelativePath: "TestInterface", - apiDescriptionFile: "expected/TestInterface/TestInterface.xml", + apiDescriptionFile: "expected.ji/TestInterface/TestInterface.xml", expectedRelativePath: "TestInterface"); } } diff --git a/tests/generator-Tests/Integration-Tests/Java_Lang_Enum.cs b/tests/generator-Tests/Integration-Tests/Java_Lang_Enum.cs index 52467ba64..2155e3beb 100644 --- a/tests/generator-Tests/Integration-Tests/Java_Lang_Enum.cs +++ b/tests/generator-Tests/Integration-Tests/Java_Lang_Enum.cs @@ -13,7 +13,7 @@ public void Generated_OK () { RunAllTargets ( outputRelativePath: "java.lang.Enum", - apiDescriptionFile: "expected/java.lang.Enum/Java.Lang.Enum.xml", + apiDescriptionFile: "expected.ji/java.lang.Enum/Java.Lang.Enum.xml", expectedRelativePath: "java.lang.Enum"); } } diff --git a/tests/generator-Tests/Integration-Tests/Java_Lang_Object.cs b/tests/generator-Tests/Integration-Tests/Java_Lang_Object.cs index 40fa28126..7aeff7b15 100644 --- a/tests/generator-Tests/Integration-Tests/Java_Lang_Object.cs +++ b/tests/generator-Tests/Integration-Tests/Java_Lang_Object.cs @@ -12,21 +12,9 @@ public class Java_Lang_Object : BaseGeneratorTest [Test] public void Generated_OK () { - Run (target: Xamarin.Android.Binder.CodeGenerationTarget.XamarinAndroid, - outputPath: "out/java.lang.Object", - apiDescriptionFile: "expected/java.lang.Object/java.lang.Object.xml", - expectedPath: "expected/java.lang.Object"); - - var javaLangObject = BuiltAssembly.GetType ("Java.Lang.Object"); - - Assert.IsNotNull (javaLangObject); - Assert.IsTrue (javaLangObject.IsPublic); - Assert.IsTrue (javaLangObject.FullName == "Java.Lang.Object"); - Assert.IsTrue (javaLangObject.GetCustomAttributes (false).Any (x => x.GetType ().Name == "RegisterAttribute")); - Run (target: Xamarin.Android.Binder.CodeGenerationTarget.JavaInterop1, outputPath: "out.ji/java.lang.Object", - apiDescriptionFile: "expected/java.lang.Object/java.lang.Object.xml", + apiDescriptionFile: "expected.ji/java.lang.Object/java.lang.Object.xml", expectedPath: "expected.ji/java.lang.Object"); } } diff --git a/tests/generator-Tests/Integration-Tests/Java_Util_List.cs b/tests/generator-Tests/Integration-Tests/Java_Util_List.cs index 05fe04fbc..eca1ac785 100644 --- a/tests/generator-Tests/Integration-Tests/Java_Util_List.cs +++ b/tests/generator-Tests/Integration-Tests/Java_Util_List.cs @@ -13,7 +13,7 @@ public void GeneratedOK () { RunAllTargets ( outputRelativePath: "java.util.List", - apiDescriptionFile: "expected/java.util.List/java.util.List.xml", + apiDescriptionFile: "expected.ji/java.util.List/java.util.List.xml", expectedRelativePath: "java.util.List"); } } diff --git a/tests/generator-Tests/Integration-Tests/NestedTypes.cs b/tests/generator-Tests/Integration-Tests/NestedTypes.cs index 07c42efb9..df954e74c 100644 --- a/tests/generator-Tests/Integration-Tests/NestedTypes.cs +++ b/tests/generator-Tests/Integration-Tests/NestedTypes.cs @@ -13,7 +13,7 @@ public void GeneratedOK () { RunAllTargets ( outputRelativePath: "NestedTypes", - apiDescriptionFile: "expected/NestedTypes/NestedTypes.xml", + apiDescriptionFile: "expected.ji/NestedTypes/NestedTypes.xml", expectedRelativePath: "NestedTypes"); } } diff --git a/tests/generator-Tests/Integration-Tests/NonStaticFields.cs b/tests/generator-Tests/Integration-Tests/NonStaticFields.cs index 06ddf2139..bd56d4d4c 100644 --- a/tests/generator-Tests/Integration-Tests/NonStaticFields.cs +++ b/tests/generator-Tests/Integration-Tests/NonStaticFields.cs @@ -11,7 +11,7 @@ public void GeneratedOK () { RunAllTargets ( outputRelativePath: "NonStaticFields", - apiDescriptionFile: "expected/NonStaticFields/NonStaticField.xml", + apiDescriptionFile: "expected.ji/NonStaticFields/NonStaticField.xml", expectedRelativePath: "NonStaticFields"); } } diff --git a/tests/generator-Tests/Integration-Tests/NormalMethods.cs b/tests/generator-Tests/Integration-Tests/NormalMethods.cs index 5fbd5ed84..a30350685 100644 --- a/tests/generator-Tests/Integration-Tests/NormalMethods.cs +++ b/tests/generator-Tests/Integration-Tests/NormalMethods.cs @@ -13,7 +13,7 @@ public void GeneratedOK () { RunAllTargets ( outputRelativePath: "NormalMethods", - apiDescriptionFile: "expected/NormalMethods/NormalMethods.xml", + apiDescriptionFile: "expected.ji/NormalMethods/NormalMethods.xml", expectedRelativePath: "NormalMethods"); } } diff --git a/tests/generator-Tests/Integration-Tests/NormalProperties.cs b/tests/generator-Tests/Integration-Tests/NormalProperties.cs index 9a45365b6..97e973b3f 100644 --- a/tests/generator-Tests/Integration-Tests/NormalProperties.cs +++ b/tests/generator-Tests/Integration-Tests/NormalProperties.cs @@ -11,7 +11,7 @@ public void GeneratedOK () { RunAllTargets ( outputRelativePath: "NormalProperties", - apiDescriptionFile: "expected/NormalProperties/NormalProperties.xml", + apiDescriptionFile: "expected.ji/NormalProperties/NormalProperties.xml", expectedRelativePath: "NormalProperties"); } } diff --git a/tests/generator-Tests/Integration-Tests/PamareterXPath.cs b/tests/generator-Tests/Integration-Tests/PamareterXPath.cs index b2cb00282..d590ce562 100644 --- a/tests/generator-Tests/Integration-Tests/PamareterXPath.cs +++ b/tests/generator-Tests/Integration-Tests/PamareterXPath.cs @@ -13,7 +13,7 @@ public void GeneratedOK () { RunAllTargets ( outputRelativePath: "ParameterXPath", - apiDescriptionFile: "expected/ParameterXPath/ParameterXPath.xml", + apiDescriptionFile: "expected.ji/ParameterXPath/ParameterXPath.xml", expectedRelativePath: "ParameterXPath"); } } diff --git a/tests/generator-Tests/Integration-Tests/StaticFields.cs b/tests/generator-Tests/Integration-Tests/StaticFields.cs index 4e3837772..ecb22dac6 100644 --- a/tests/generator-Tests/Integration-Tests/StaticFields.cs +++ b/tests/generator-Tests/Integration-Tests/StaticFields.cs @@ -11,7 +11,7 @@ public void GeneratedOK () { RunAllTargets ( outputRelativePath: "StaticFields", - apiDescriptionFile: "expected/StaticFields/StaticField.xml", + apiDescriptionFile: "expected.ji/StaticFields/StaticField.xml", expectedRelativePath: "StaticFields"); } } diff --git a/tests/generator-Tests/Integration-Tests/StaticMethods.cs b/tests/generator-Tests/Integration-Tests/StaticMethods.cs index d3044c71b..cb33ce955 100644 --- a/tests/generator-Tests/Integration-Tests/StaticMethods.cs +++ b/tests/generator-Tests/Integration-Tests/StaticMethods.cs @@ -11,7 +11,7 @@ public void GeneratedOK () { RunAllTargets ( outputRelativePath: "StaticMethods", - apiDescriptionFile: "expected/StaticMethods/StaticMethod.xml", + apiDescriptionFile: "expected.ji/StaticMethods/StaticMethod.xml", expectedRelativePath: "StaticMethods"); } } diff --git a/tests/generator-Tests/Integration-Tests/StaticProperties.cs b/tests/generator-Tests/Integration-Tests/StaticProperties.cs index 2ea369113..0e25b3fe4 100644 --- a/tests/generator-Tests/Integration-Tests/StaticProperties.cs +++ b/tests/generator-Tests/Integration-Tests/StaticProperties.cs @@ -11,7 +11,7 @@ public void GeneratedOK () { RunAllTargets ( outputRelativePath: "StaticProperties", - apiDescriptionFile: "expected/StaticProperties/StaticProperties.xml", + apiDescriptionFile: "expected.ji/StaticProperties/StaticProperties.xml", expectedRelativePath: "StaticProperties"); } } diff --git a/tests/generator-Tests/Integration-Tests/Streams.cs b/tests/generator-Tests/Integration-Tests/Streams.cs index 948743cca..e27cfc3d6 100644 --- a/tests/generator-Tests/Integration-Tests/Streams.cs +++ b/tests/generator-Tests/Integration-Tests/Streams.cs @@ -11,9 +11,9 @@ public void GeneratedOK () { RunAllTargets ( outputRelativePath: "Streams", - apiDescriptionFile: "expected/Streams/Streams.xml", + apiDescriptionFile: "expected.ji/Streams/Streams.xml", expectedRelativePath: "Streams", - additionalSupportPaths: new[]{ "expected/Streams/SupportFiles" }); + additionalSupportPaths: new[]{ "expected.ji/Streams/SupportFiles" }); } } } diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WriteCharSequenceEnumerator.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WriteCharSequenceEnumerator.txt deleted file mode 100644 index 0a27a4a22..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WriteCharSequenceEnumerator.txt +++ /dev/null @@ -1,11 +0,0 @@ -System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator () -{ - return GetEnumerator (); -} - -public System.Collections.Generic.IEnumerator GetEnumerator () -{ - for (int i = 0; i < Length(); i++) - yield return CharAt (i); -} - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WriteClassAbstractMembers.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WriteClassAbstractMembers.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WriteInterfaceEventArgs.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WriteInterfaceEventArgs.txt deleted file mode 100644 index 135abf81e..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WriteInterfaceEventArgs.txt +++ /dev/null @@ -1,2 +0,0 @@ -public delegate int MyIGetCountForKeyHandler (string key); - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WriteInterfaceEventArgsWithParamArray.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WriteInterfaceEventArgsWithParamArray.txt deleted file mode 100644 index c937a0439..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WriteInterfaceEventArgsWithParamArray.txt +++ /dev/null @@ -1,14 +0,0 @@ -// event args for com.xamarin.android.MyListener.onDoSomething -public partial class MyEventArgs : global::System.EventArgs { - - public MyEventArgs (params Java.Lang.Object[] args) - { - this.args = args; - } - - Java.Lang.Object[] args; - public Java.Lang.Object[] Args { - get { return args; } - } -} - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WriteInterfaceEventHandler.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WriteInterfaceEventHandler.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WriteInterfaceEventHandlerImpl.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WriteInterfaceEventHandlerImpl.txt deleted file mode 100644 index b231fdf90..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WriteInterfaceEventHandlerImpl.txt +++ /dev/null @@ -1,59 +0,0 @@ -[global::Android.Runtime.Register ("mono/java/code/IMyInterfaceImplementor")] -internal sealed partial class IMyInterfaceImplementor : global::Java.Lang.Object, IMyInterface { - - object sender; - - public IMyInterfaceImplementor (object sender) - : base ( - global::Android.Runtime.JNIEnv.StartCreateInstance ("mono/java/code/IMyInterfaceImplementor", "()V"), - JniHandleOwnership.TransferLocalRef) - { - global::Android.Runtime.JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, "()V"); - this.sender = sender; - } - -#pragma warning disable 0649 - public MyIGetCountForKeyHandler GetCountForKeyHandler; -#pragma warning restore 0649 - - public int GetCountForKey (string key) - { - var __h = GetCountForKeyHandler; - return __h != null ? __h (key) : default (int); - } -#pragma warning disable 0649 - public MyIKeyHandler KeyHandler; -#pragma warning restore 0649 - - public string Key () - { - var __h = KeyHandler; - return __h != null ? __h () : default (string); - } -#pragma warning disable 0649 - public EventHandler StaticMethodHandler; -#pragma warning restore 0649 - - public void StaticMethod () - { - var __h = StaticMethodHandler; - if (__h != null) - __h (sender, new EventArgs ()); - } -#pragma warning disable 0649 - public EventHandler AbstractMethodHandler; -#pragma warning restore 0649 - - public void AbstractMethod () - { - var __h = AbstractMethodHandler; - if (__h != null) - __h (sender, new EventArgs ()); - } - - internal static bool __IsEmpty (IMyInterfaceImplementor value) - { - return value.GetCountForKeyHandler == null && value.KeyHandler == null && value.StaticMethodHandler == null && value.AbstractMethodHandler == null; - } -} - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WriteInterfaceEventHandlerImplContent.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WriteInterfaceEventHandlerImplContent.txt deleted file mode 100644 index a190fc776..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WriteInterfaceEventHandlerImplContent.txt +++ /dev/null @@ -1,9 +0,0 @@ -#pragma warning disable 0649 - public MyIGetCountForKeyHandler GetCountForKeyHandler; -#pragma warning restore 0649 - - public int GetCountForKey (string key) - { - var __h = GetCountForKeyHandler; - return __h != null ? __h (key) : default (int); - } diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WriteInterfaceExtensionMethods.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WriteInterfaceExtensionMethods.txt deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WritePropertyAbstractDeclaration.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WritePropertyAbstractDeclaration.txt deleted file mode 100644 index ba0d8f006..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WritePropertyAbstractDeclaration.txt +++ /dev/null @@ -1,39 +0,0 @@ -static Delegate cb_get_MyProperty; -#pragma warning disable 0169 -static Delegate Getget_MyPropertyHandler () -{ - if (cb_get_MyProperty == null) - cb_get_MyProperty = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_I) n_get_MyProperty); - return cb_get_MyProperty; -} - -static int n_get_MyProperty (IntPtr jnienv, IntPtr native__this) -{ - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return __this.MyProperty; -} -#pragma warning restore 0169 - -static Delegate cb_set_MyProperty_I; -#pragma warning disable 0169 -static Delegate Getset_MyProperty_IHandler () -{ - if (cb_set_MyProperty_I == null) - cb_set_MyProperty_I = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPI_V) n_set_MyProperty_I); - return cb_set_MyProperty_I; -} - -static void n_set_MyProperty_I (IntPtr jnienv, IntPtr native__this, int value) -{ - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.MyProperty = value; -} -#pragma warning restore 0169 - -public abstract int MyProperty { - // Metadata.xml XPath method reference: path="/api/package[@name='com.mypackage']/class[@name='foo']/method[@name='get_MyProperty' and count(parameter)=0]" - [Register ("get_MyProperty", "()I", "Getget_MyPropertyHandler")] get; - // Metadata.xml XPath method reference: path="/api/package[@name='com.mypackage']/class[@name='foo']/method[@name='set_MyProperty' and count(parameter)=1 and parameter[1][@type='int']]" - [Register ("set_MyProperty", "(I)V", "Getset_MyProperty_IHandler")] set; -} - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WritePropertyCallbacks.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WritePropertyCallbacks.txt deleted file mode 100644 index 3ee57d568..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WritePropertyCallbacks.txt +++ /dev/null @@ -1,32 +0,0 @@ -static Delegate cb_get_MyProperty; -#pragma warning disable 0169 -static Delegate Getget_MyPropertyHandler () -{ - if (cb_get_MyProperty == null) - cb_get_MyProperty = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_I) n_get_MyProperty); - return cb_get_MyProperty; -} - -static int n_get_MyProperty (IntPtr jnienv, IntPtr native__this) -{ - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return __this.MyProperty; -} -#pragma warning restore 0169 - -static Delegate cb_set_MyProperty_I; -#pragma warning disable 0169 -static Delegate Getset_MyProperty_IHandler () -{ - if (cb_set_MyProperty_I == null) - cb_set_MyProperty_I = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPI_V) n_set_MyProperty_I); - return cb_set_MyProperty_I; -} - -static void n_set_MyProperty_I (IntPtr jnienv, IntPtr native__this, int value) -{ - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.MyProperty = value; -} -#pragma warning restore 0169 - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WritePropertyDeclaration.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WritePropertyDeclaration.txt deleted file mode 100644 index d23bc113c..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WritePropertyDeclaration.txt +++ /dev/null @@ -1,7 +0,0 @@ -int MyProperty { - // Metadata.xml XPath method reference: path="/api/package[@name='com.mypackage']/class[@name='foo']/method[@name='get_MyProperty' and count(parameter)=0]" - [Register ("get_MyProperty", "()I", "Getget_MyPropertyHandler:ObjectAdapter, ")] get; - // Metadata.xml XPath method reference: path="/api/package[@name='com.mypackage']/class[@name='foo']/method[@name='set_MyProperty' and count(parameter)=1 and parameter[1][@type='int']]" - [Register ("set_MyProperty", "(I)V", "Getset_MyProperty_IHandler:ObjectAdapter, ")] set; -} - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WritePropertyInvoker.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WritePropertyInvoker.txt deleted file mode 100644 index bb1e9939f..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WritePropertyInvoker.txt +++ /dev/null @@ -1,49 +0,0 @@ -static Delegate cb_get_MyProperty; -#pragma warning disable 0169 -static Delegate Getget_MyPropertyHandler () -{ - if (cb_get_MyProperty == null) - cb_get_MyProperty = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_I) n_get_MyProperty); - return cb_get_MyProperty; -} - -static int n_get_MyProperty (IntPtr jnienv, IntPtr native__this) -{ - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return __this.MyProperty; -} -#pragma warning restore 0169 - -static Delegate cb_set_MyProperty_I; -#pragma warning disable 0169 -static Delegate Getset_MyProperty_IHandler () -{ - if (cb_set_MyProperty_I == null) - cb_set_MyProperty_I = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPI_V) n_set_MyProperty_I); - return cb_set_MyProperty_I; -} - -static void n_set_MyProperty_I (IntPtr jnienv, IntPtr native__this, int value) -{ - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.MyProperty = value; -} -#pragma warning restore 0169 - -IntPtr id_get_MyProperty; -IntPtr id_set_MyProperty_I; -public unsafe int MyProperty { - get { - if (id_get_MyProperty == IntPtr.Zero) - id_get_MyProperty = JNIEnv.GetMethodID (class_ref, "get_MyProperty", "()I"); - return JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_get_MyProperty); - } - set { - if (id_set_MyProperty_I == IntPtr.Zero) - id_set_MyProperty_I = JNIEnv.GetMethodID (class_ref, "set_MyProperty", "(I)V"); - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (value); - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_set_MyProperty_I, __args); - } -} - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WritePropertyStringVariant.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WritePropertyStringVariant.txt deleted file mode 100644 index 639a5fc22..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/Common/WritePropertyStringVariant.txt +++ /dev/null @@ -1,9 +0,0 @@ -public string MyProperty { - get { return MyProperty == null ? null : MyProperty.ToString (); } - set { - var jls = value == null ? null : new global::Java.Lang.String (value); - MyProperty = jls; - if (jls != null) jls.Dispose (); - } -} - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XAJavaInterop1/WriteConstSugarInterfaceFields.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XAJavaInterop1/WriteConstSugarInterfaceFields.txt index fe8fb5d7e..25e31bc37 100644 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XAJavaInterop1/WriteConstSugarInterfaceFields.txt +++ b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XAJavaInterop1/WriteConstSugarInterfaceFields.txt @@ -1,5 +1,8 @@ -// Metadata.xml XPath interface reference: path="/api/package[@name='java.code']/interface[@name='IMyInterface']" -public partial interface IMyInterface { +[Register ("java/code/IMyInterface", DoNotGenerateAcw=true)] +public abstract class MyInterface : Java.Lang.Object { + internal MyInterface () + { + } // Metadata.xml XPath field reference: path="/api/package[@name='java.code']/interface[@name='IMyInterface']/field[@name='MyConstantField']" [Register ("MyConstantField")] @@ -11,8 +14,51 @@ public partial interface IMyInterface { // Metadata.xml XPath field reference: path="/api/package[@name='java.code']/interface[@name='IMyInterface']/field[@name='MyDeprecatedField']" [Register ("MyDeprecatedField")] - [Obsolete ("")] + [global::System.Obsolete] public const int MyDeprecatedField = (int) 7; + // Metadata.xml XPath field reference: path="/api/package[@name='java.code']/interface[@name='IMyInterface']/field[@name='MyDeprecatedEnumField']" + [Register ("MyDeprecatedEnumField")] + [global::System.Obsolete (@"This constant will be removed in the future version.")] + public const int MyDeprecatedEnumField = (int) MyEnumValue; + + + // Metadata.xml XPath field reference: path="/api/package[@name='java.code']/interface[@name='IMyInterface']/field[@name='MyStaticField']" + [Register ("MyStaticField")] + public static int MyStaticField { + get { + const string __id = "MyStaticField.I"; + + var __v = _members.StaticFields.GetInt32Value (__id); + return __v; + } + set { + const string __id = "MyStaticField.I"; + + try { + _members.StaticFields.SetValue (__id, value); + } finally { + } + } + } + + static readonly JniPeerMembers _members = new XAPeerMembers ("java/code/IMyInterface", typeof (MyInterface)); + } +// Metadata.xml XPath interface reference: path="/api/package[@name='java.code']/interface[@name='IMyInterface']" +public partial interface IMyInterface { + // Metadata.xml XPath field reference: path="/api/package[@name='java.code']/interface[@name='IMyInterface']/field[@name='MyConstantField']" + [Register ("MyConstantField")] + public const int MyConstantField = (int) 7; + + // Metadata.xml XPath field reference: path="/api/package[@name='java.code']/interface[@name='IMyInterface']/field[@name='MyConstantStringField']" + [Register ("MyConstantStringField")] + public const string MyConstantStringField = (string) "hello"; + + // Metadata.xml XPath field reference: path="/api/package[@name='java.code']/interface[@name='IMyInterface']/field[@name='MyDeprecatedField']" + [Register ("MyDeprecatedField")] + [global::System.Obsolete] + public const int MyDeprecatedField = (int) 7; + +} diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteClass.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteClass.txt deleted file mode 100644 index 453570e07..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteClass.txt +++ /dev/null @@ -1,384 +0,0 @@ -// Metadata.xml XPath class reference: path="/api/package[@name='java.code']/class[@name='MyClass']" -[global::Android.Runtime.Register ("java/code/MyClass", DoNotGenerateAcw=true)] -public partial class MyClass { - - internal static IntPtr java_class_handle; - internal static IntPtr class_ref { - get { - return JNIEnv.FindClass ("java/code/MyClass", ref java_class_handle); - } - } - - protected MyClass (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static IntPtr id_ctor; - // Metadata.xml XPath constructor reference: path="/api/package[@name='java.code']/class[@name='MyClass']/constructor[@name='MyClass' and count(parameter)=0]" - [Register (".ctor", "()V", "")] - unsafe MyClass () - : base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer) - { - if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero) - return; - - try { - if (((object) this).GetType () != typeof (MyClass)) { - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (((object) this).GetType (), "()V"), - JniHandleOwnership.TransferLocalRef); - global::Android.Runtime.JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, "()V"); - return; - } - - if (id_ctor == IntPtr.Zero) - id_ctor = JNIEnv.GetMethodID (class_ref, "", "()V"); - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (class_ref, id_ctor), - JniHandleOwnership.TransferLocalRef); - JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, class_ref, id_ctor); - } finally { - } - } - - static IntPtr id_ctor_Ljava_lang_String_; - // Metadata.xml XPath constructor reference: path="/api/package[@name='java.code']/class[@name='MyClass']/constructor[@name='MyClass' and count(parameter)=1 and parameter[1][@type='java.lang.String']]" - [Register (".ctor", "(Ljava/lang/String;)V", "")] - unsafe MyClass (string p0) - : base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer) - { - if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero) - return; - - IntPtr native_p0 = JNIEnv.NewString ((string)p0); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_p0); - if (((object) this).GetType () != typeof (MyClass)) { - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (((object) this).GetType (), "(Ljava/lang/String;)V", __args), - JniHandleOwnership.TransferLocalRef); - global::Android.Runtime.JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, "(Ljava/lang/String;)V", __args); - return; - } - - if (id_ctor_Ljava_lang_String_ == IntPtr.Zero) - id_ctor_Ljava_lang_String_ = JNIEnv.GetMethodID (class_ref, "", "(Ljava/lang/String;)V"); - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (class_ref, id_ctor_Ljava_lang_String_, __args), - JniHandleOwnership.TransferLocalRef); - JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, class_ref, id_ctor_Ljava_lang_String_, __args); - } finally { - JNIEnv.DeleteLocalRef (native_p0); - } - } - - static Delegate cb_get_Count; -#pragma warning disable 0169 - static Delegate Getget_CountHandler () - { - if (cb_get_Count == null) - cb_get_Count = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_I) n_get_Count); - return cb_get_Count; - } - - static int n_get_Count (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return __this.Count; - } -#pragma warning restore 0169 - - static Delegate cb_set_Count_I; -#pragma warning disable 0169 - static Delegate Getset_Count_IHandler () - { - if (cb_set_Count_I == null) - cb_set_Count_I = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPI_V) n_set_Count_I); - return cb_set_Count_I; - } - - static void n_set_Count_I (IntPtr jnienv, IntPtr native__this, int value) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.Count = value; - } -#pragma warning restore 0169 - - static IntPtr id_get_Count; - static IntPtr id_set_Count_I; - public virtual unsafe int Count { - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/class[@name='MyClass']/method[@name='get_Count' and count(parameter)=0]" - [Register ("get_Count", "()I", "Getget_CountHandler")] - get { - if (id_get_Count == IntPtr.Zero) - id_get_Count = JNIEnv.GetMethodID (class_ref, "get_Count", "()I"); - try { - - if (((object) this).GetType () == ThresholdType) - return JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_get_Count); - else - return JNIEnv.CallNonvirtualIntMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "get_Count", "()I")); - } finally { - } - } - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/class[@name='MyClass']/method[@name='set_Count' and count(parameter)=1 and parameter[1][@type='int']]" - [Register ("set_Count", "(I)V", "Getset_Count_IHandler")] - set { - if (id_set_Count_I == IntPtr.Zero) - id_set_Count_I = JNIEnv.GetMethodID (class_ref, "set_Count", "(I)V"); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (value); - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_set_Count_I, __args); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "set_Count", "(I)V"), __args); - } finally { - } - } - } - - static Delegate cb_get_Key; -#pragma warning disable 0169 - static Delegate Getget_KeyHandler () - { - if (cb_get_Key == null) - cb_get_Key = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_L) n_get_Key); - return cb_get_Key; - } - - static IntPtr n_get_Key (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return JNIEnv.NewString (__this.Key); - } -#pragma warning restore 0169 - - static Delegate cb_set_Key_Ljava_lang_String_; -#pragma warning disable 0169 - static Delegate Getset_Key_Ljava_lang_String_Handler () - { - if (cb_set_Key_Ljava_lang_String_ == null) - cb_set_Key_Ljava_lang_String_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_V) n_set_Key_Ljava_lang_String_); - return cb_set_Key_Ljava_lang_String_; - } - - static void n_set_Key_Ljava_lang_String_ (IntPtr jnienv, IntPtr native__this, IntPtr native_value) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var value = JNIEnv.GetString (native_value, JniHandleOwnership.DoNotTransfer); - __this.Key = value; - } -#pragma warning restore 0169 - - static IntPtr id_get_Key; - static IntPtr id_set_Key_Ljava_lang_String_; - public virtual unsafe string Key { - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/class[@name='MyClass']/method[@name='get_Key' and count(parameter)=0]" - [Register ("get_Key", "()Ljava/lang/String;", "Getget_KeyHandler")] - get { - if (id_get_Key == IntPtr.Zero) - id_get_Key = JNIEnv.GetMethodID (class_ref, "get_Key", "()Ljava/lang/String;"); - try { - - if (((object) this).GetType () == ThresholdType) - return JNIEnv.GetString (JNIEnv.CallObjectMethod (((global::Java.Lang.Object) this).Handle, id_get_Key), JniHandleOwnership.TransferLocalRef); - else - return JNIEnv.GetString (JNIEnv.CallNonvirtualObjectMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "get_Key", "()Ljava/lang/String;")), JniHandleOwnership.TransferLocalRef); - } finally { - } - } - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/class[@name='MyClass']/method[@name='set_Key' and count(parameter)=1 and parameter[1][@type='java.lang.String']]" - [Register ("set_Key", "(Ljava/lang/String;)V", "Getset_Key_Ljava_lang_String_Handler")] - set { - if (id_set_Key_Ljava_lang_String_ == IntPtr.Zero) - id_set_Key_Ljava_lang_String_ = JNIEnv.GetMethodID (class_ref, "set_Key", "(Ljava/lang/String;)V"); - IntPtr native_value = JNIEnv.NewString ((string)value); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_value); - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_set_Key_Ljava_lang_String_, __args); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "set_Key", "(Ljava/lang/String;)V"), __args); - } finally { - JNIEnv.DeleteLocalRef (native_value); - } - } - } - - static IntPtr id_get_StaticCount; - static IntPtr id_set_StaticCount_I; - public static unsafe int StaticCount { - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/class[@name='MyClass']/method[@name='get_StaticCount' and count(parameter)=0]" - [Register ("get_StaticCount", "()I", "")] - get { - if (id_get_StaticCount == IntPtr.Zero) - id_get_StaticCount = JNIEnv.GetStaticMethodID (class_ref, "get_StaticCount", "()I"); - try { - return JNIEnv.CallStaticIntMethod (class_ref, id_get_StaticCount); - } finally { - } - } - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/class[@name='MyClass']/method[@name='set_StaticCount' and count(parameter)=1 and parameter[1][@type='int']]" - [Register ("set_StaticCount", "(I)V", "")] - set { - if (id_set_StaticCount_I == IntPtr.Zero) - id_set_StaticCount_I = JNIEnv.GetStaticMethodID (class_ref, "set_StaticCount", "(I)V"); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (value); - JNIEnv.CallStaticVoidMethod (class_ref, id_set_StaticCount_I, __args); - } finally { - } - } - } - - static Delegate cb_get_AbstractCount; -#pragma warning disable 0169 - static Delegate Getget_AbstractCountHandler () - { - if (cb_get_AbstractCount == null) - cb_get_AbstractCount = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_I) n_get_AbstractCount); - return cb_get_AbstractCount; - } - - static int n_get_AbstractCount (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return __this.AbstractCount; - } -#pragma warning restore 0169 - - static Delegate cb_set_AbstractCount_I; -#pragma warning disable 0169 - static Delegate Getset_AbstractCount_IHandler () - { - if (cb_set_AbstractCount_I == null) - cb_set_AbstractCount_I = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPI_V) n_set_AbstractCount_I); - return cb_set_AbstractCount_I; - } - - static void n_set_AbstractCount_I (IntPtr jnienv, IntPtr native__this, int value) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.AbstractCount = value; - } -#pragma warning restore 0169 - - public abstract int AbstractCount { - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/class[@name='MyClass']/method[@name='get_AbstractCount' and count(parameter)=0]" - [Register ("get_AbstractCount", "()I", "Getget_AbstractCountHandler")] get; - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/class[@name='MyClass']/method[@name='set_AbstractCount' and count(parameter)=1 and parameter[1][@type='int']]" - [Register ("set_AbstractCount", "(I)V", "Getset_AbstractCount_IHandler")] set; - } - - static Delegate cb_GetCountForKey_Ljava_lang_String_; -#pragma warning disable 0169 - static Delegate GetGetCountForKey_Ljava_lang_String_Handler () - { - if (cb_GetCountForKey_Ljava_lang_String_ == null) - cb_GetCountForKey_Ljava_lang_String_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_I) n_GetCountForKey_Ljava_lang_String_); - return cb_GetCountForKey_Ljava_lang_String_; - } - - static int n_GetCountForKey_Ljava_lang_String_ (IntPtr jnienv, IntPtr native__this, IntPtr native_key) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var key = JNIEnv.GetString (native_key, JniHandleOwnership.DoNotTransfer); - int __ret = __this.GetCountForKey (key); - return __ret; - } -#pragma warning restore 0169 - - static IntPtr id_GetCountForKey_Ljava_lang_String_; - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/class[@name='MyClass']/method[@name='GetCountForKey' and count(parameter)=1 and parameter[1][@type='java.lang.String']]" - [Register ("GetCountForKey", "(Ljava/lang/String;)I", "GetGetCountForKey_Ljava_lang_String_Handler")] - public virtual unsafe int GetCountForKey (string key) - { - if (id_GetCountForKey_Ljava_lang_String_ == IntPtr.Zero) - id_GetCountForKey_Ljava_lang_String_ = JNIEnv.GetMethodID (class_ref, "GetCountForKey", "(Ljava/lang/String;)I"); - IntPtr native_key = JNIEnv.NewString ((string)key); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_key); - - int __ret; - if (((object) this).GetType () == ThresholdType) - __ret = JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_GetCountForKey_Ljava_lang_String_, __args); - else - __ret = JNIEnv.CallNonvirtualIntMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "GetCountForKey", "(Ljava/lang/String;)I"), __args); - return __ret; - } finally { - JNIEnv.DeleteLocalRef (native_key); - } - } - - static Delegate cb_Key; -#pragma warning disable 0169 - static Delegate GetKeyHandler () - { - if (cb_Key == null) - cb_Key = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_L) n_Key); - return cb_Key; - } - - static IntPtr n_Key (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return JNIEnv.NewString (__this.Key ()); - } -#pragma warning restore 0169 - - static IntPtr id_Key; - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/class[@name='MyClass']/method[@name='Key' and count(parameter)=0]" - [Register ("Key", "()Ljava/lang/String;", "GetKeyHandler")] - public virtual unsafe string Key () - { - if (id_Key == IntPtr.Zero) - id_Key = JNIEnv.GetMethodID (class_ref, "Key", "()Ljava/lang/String;"); - try { - - if (((object) this).GetType () == ThresholdType) - return JNIEnv.GetString (JNIEnv.CallObjectMethod (((global::Java.Lang.Object) this).Handle, id_Key), JniHandleOwnership.TransferLocalRef); - else - return JNIEnv.GetString (JNIEnv.CallNonvirtualObjectMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "Key", "()Ljava/lang/String;")), JniHandleOwnership.TransferLocalRef); - } finally { - } - } - - static IntPtr id_StaticMethod; - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/class[@name='MyClass']/method[@name='StaticMethod' and count(parameter)=0]" - [Register ("StaticMethod", "()V", "")] - public static unsafe void StaticMethod () - { - if (id_StaticMethod == IntPtr.Zero) - id_StaticMethod = JNIEnv.GetStaticMethodID (class_ref, "StaticMethod", "()V"); - try { - JNIEnv.CallStaticVoidMethod (class_ref, id_StaticMethod); - } finally { - } - } - - static Delegate cb_AbstractMethod; -#pragma warning disable 0169 - static Delegate GetAbstractMethodHandler () - { - if (cb_AbstractMethod == null) - cb_AbstractMethod = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_V) n_AbstractMethod); - return cb_AbstractMethod; - } - - static void n_AbstractMethod (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.AbstractMethod (); - } -#pragma warning restore 0169 - - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/class[@name='MyClass']/method[@name='AbstractMethod' and count(parameter)=0]" - [Register ("AbstractMethod", "()V", "GetAbstractMethodHandler")] - public abstract void AbstractMethod (); - -} diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteClassConstructors.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteClassConstructors.txt deleted file mode 100644 index 02a4b382c..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteClassConstructors.txt +++ /dev/null @@ -1,62 +0,0 @@ -protected MyClass (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - -static IntPtr id_ctor; -// Metadata.xml XPath constructor reference: path="/api/package[@name='java.code']/class[@name='MyClass']/constructor[@name='MyClass' and count(parameter)=0]" -[Register (".ctor", "()V", "")] - unsafe MyClass () - : base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer) -{ - if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero) - return; - - try { - if (((object) this).GetType () != typeof (MyClass)) { - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (((object) this).GetType (), "()V"), - JniHandleOwnership.TransferLocalRef); - global::Android.Runtime.JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, "()V"); - return; - } - - if (id_ctor == IntPtr.Zero) - id_ctor = JNIEnv.GetMethodID (class_ref, "", "()V"); - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (class_ref, id_ctor), - JniHandleOwnership.TransferLocalRef); - JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, class_ref, id_ctor); - } finally { - } -} - -static IntPtr id_ctor_Ljava_lang_String_; -// Metadata.xml XPath constructor reference: path="/api/package[@name='java.code']/class[@name='MyClass']/constructor[@name='MyClass' and count(parameter)=1 and parameter[1][@type='java.lang.String']]" -[Register (".ctor", "(Ljava/lang/String;)V", "")] - unsafe MyClass (string p0) - : base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer) -{ - if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero) - return; - - IntPtr native_p0 = JNIEnv.NewString ((string)p0); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_p0); - if (((object) this).GetType () != typeof (MyClass)) { - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (((object) this).GetType (), "(Ljava/lang/String;)V", __args), - JniHandleOwnership.TransferLocalRef); - global::Android.Runtime.JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, "(Ljava/lang/String;)V", __args); - return; - } - - if (id_ctor_Ljava_lang_String_ == IntPtr.Zero) - id_ctor_Ljava_lang_String_ = JNIEnv.GetMethodID (class_ref, "", "(Ljava/lang/String;)V"); - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (class_ref, id_ctor_Ljava_lang_String_, __args), - JniHandleOwnership.TransferLocalRef); - JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, class_ref, id_ctor_Ljava_lang_String_, __args); - } finally { - JNIEnv.DeleteLocalRef (native_p0); - } -} - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteClassHandle.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteClassHandle.txt deleted file mode 100644 index 7e06aa56f..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteClassHandle.txt +++ /dev/null @@ -1,7 +0,0 @@ - internal static IntPtr java_class_handle; - internal static IntPtr class_ref { - get { - return JNIEnv.FindClass ("com/mypackage/foo", ref java_class_handle); - } - } - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteClassInvoker.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteClassInvoker.txt deleted file mode 100644 index 3296dbbed..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteClassInvoker.txt +++ /dev/null @@ -1,51 +0,0 @@ -[global::Android.Runtime.Register ("java/code/MyClass", DoNotGenerateAcw=true)] -internal partial class MyClassInvoker : MyClass { - - public MyClassInvoker (IntPtr handle, JniHandleOwnership transfer) : base (handle, transfer) {} - - protected override global::System.Type ThresholdType { - get { return typeof (MyClassInvoker); } - } - - static IntPtr id_get_AbstractCount; - static IntPtr id_set_AbstractCount_I; - public override unsafe int AbstractCount { - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/class[@name='MyClass']/method[@name='get_AbstractCount' and count(parameter)=0]" - [Register ("get_AbstractCount", "()I", "Getget_AbstractCountHandler")] - get { - if (id_get_AbstractCount == IntPtr.Zero) - id_get_AbstractCount = JNIEnv.GetMethodID (class_ref, "get_AbstractCount", "()I"); - try { - return JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_get_AbstractCount); - } finally { - } - } - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/class[@name='MyClass']/method[@name='set_AbstractCount' and count(parameter)=1 and parameter[1][@type='int']]" - [Register ("set_AbstractCount", "(I)V", "Getset_AbstractCount_IHandler")] - set { - if (id_set_AbstractCount_I == IntPtr.Zero) - id_set_AbstractCount_I = JNIEnv.GetMethodID (class_ref, "set_AbstractCount", "(I)V"); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (value); - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_set_AbstractCount_I, __args); - } finally { - } - } - } - - static IntPtr id_AbstractMethod; - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/class[@name='MyClass']/method[@name='AbstractMethod' and count(parameter)=0]" - [Register ("AbstractMethod", "()V", "GetAbstractMethodHandler")] - public override unsafe void AbstractMethod () - { - if (id_AbstractMethod == IntPtr.Zero) - id_AbstractMethod = JNIEnv.GetMethodID (class_ref, "AbstractMethod", "()V"); - try { - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_AbstractMethod); - } finally { - } - } - -} - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteClassInvokerHandle.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteClassInvokerHandle.txt deleted file mode 100644 index 0ec403601..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteClassInvokerHandle.txt +++ /dev/null @@ -1,4 +0,0 @@ -protected override global::System.Type ThresholdType { - get { return typeof (Com.MyPackage.Foo); } -} - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteClassInvokerMembers.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteClassInvokerMembers.txt deleted file mode 100644 index 68c8676a3..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteClassInvokerMembers.txt +++ /dev/null @@ -1,40 +0,0 @@ -static IntPtr id_get_AbstractCount; -static IntPtr id_set_AbstractCount_I; -public override unsafe int AbstractCount { - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/class[@name='MyClass']/method[@name='get_AbstractCount' and count(parameter)=0]" - [Register ("get_AbstractCount", "()I", "Getget_AbstractCountHandler")] - get { - if (id_get_AbstractCount == IntPtr.Zero) - id_get_AbstractCount = JNIEnv.GetMethodID (class_ref, "get_AbstractCount", "()I"); - try { - return JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_get_AbstractCount); - } finally { - } - } - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/class[@name='MyClass']/method[@name='set_AbstractCount' and count(parameter)=1 and parameter[1][@type='int']]" - [Register ("set_AbstractCount", "(I)V", "Getset_AbstractCount_IHandler")] - set { - if (id_set_AbstractCount_I == IntPtr.Zero) - id_set_AbstractCount_I = JNIEnv.GetMethodID (class_ref, "set_AbstractCount", "(I)V"); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (value); - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_set_AbstractCount_I, __args); - } finally { - } - } -} - -static IntPtr id_AbstractMethod; -// Metadata.xml XPath method reference: path="/api/package[@name='java.code']/class[@name='MyClass']/method[@name='AbstractMethod' and count(parameter)=0]" -[Register ("AbstractMethod", "()V", "GetAbstractMethodHandler")] -public override unsafe void AbstractMethod () -{ - if (id_AbstractMethod == IntPtr.Zero) - id_AbstractMethod = JNIEnv.GetMethodID (class_ref, "AbstractMethod", "()V"); - try { - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_AbstractMethod); - } finally { - } -} - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteClassMethodInvokers.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteClassMethodInvokers.txt deleted file mode 100644 index ac99a7980..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteClassMethodInvokers.txt +++ /dev/null @@ -1,13 +0,0 @@ -static IntPtr id_AbstractMethod; -// Metadata.xml XPath method reference: path="/api/package[@name='java.code']/class[@name='MyClass']/method[@name='AbstractMethod' and count(parameter)=0]" -[Register ("AbstractMethod", "()V", "GetAbstractMethodHandler")] -public override unsafe void AbstractMethod () -{ - if (id_AbstractMethod == IntPtr.Zero) - id_AbstractMethod = JNIEnv.GetMethodID (class_ref, "AbstractMethod", "()V"); - try { - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_AbstractMethod); - } finally { - } -} - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteClassMethodInvokersWithSkips.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteClassMethodInvokersWithSkips.txt deleted file mode 100644 index ac99a7980..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteClassMethodInvokersWithSkips.txt +++ /dev/null @@ -1,13 +0,0 @@ -static IntPtr id_AbstractMethod; -// Metadata.xml XPath method reference: path="/api/package[@name='java.code']/class[@name='MyClass']/method[@name='AbstractMethod' and count(parameter)=0]" -[Register ("AbstractMethod", "()V", "GetAbstractMethodHandler")] -public override unsafe void AbstractMethod () -{ - if (id_AbstractMethod == IntPtr.Zero) - id_AbstractMethod = JNIEnv.GetMethodID (class_ref, "AbstractMethod", "()V"); - try { - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_AbstractMethod); - } finally { - } -} - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteClassMethods.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteClassMethods.txt deleted file mode 100644 index 01ed620c5..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteClassMethods.txt +++ /dev/null @@ -1,107 +0,0 @@ -static Delegate cb_GetCountForKey_Ljava_lang_String_; -#pragma warning disable 0169 -static Delegate GetGetCountForKey_Ljava_lang_String_Handler () -{ - if (cb_GetCountForKey_Ljava_lang_String_ == null) - cb_GetCountForKey_Ljava_lang_String_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_I) n_GetCountForKey_Ljava_lang_String_); - return cb_GetCountForKey_Ljava_lang_String_; -} - -static int n_GetCountForKey_Ljava_lang_String_ (IntPtr jnienv, IntPtr native__this, IntPtr native_key) -{ - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var key = JNIEnv.GetString (native_key, JniHandleOwnership.DoNotTransfer); - int __ret = __this.GetCountForKey (key); - return __ret; -} -#pragma warning restore 0169 - -static IntPtr id_GetCountForKey_Ljava_lang_String_; -// Metadata.xml XPath method reference: path="/api/package[@name='java.code']/class[@name='MyClass']/method[@name='GetCountForKey' and count(parameter)=1 and parameter[1][@type='java.lang.String']]" -[Register ("GetCountForKey", "(Ljava/lang/String;)I", "GetGetCountForKey_Ljava_lang_String_Handler")] -public virtual unsafe int GetCountForKey (string key) -{ - if (id_GetCountForKey_Ljava_lang_String_ == IntPtr.Zero) - id_GetCountForKey_Ljava_lang_String_ = JNIEnv.GetMethodID (class_ref, "GetCountForKey", "(Ljava/lang/String;)I"); - IntPtr native_key = JNIEnv.NewString ((string)key); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_key); - - int __ret; - if (((object) this).GetType () == ThresholdType) - __ret = JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_GetCountForKey_Ljava_lang_String_, __args); - else - __ret = JNIEnv.CallNonvirtualIntMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "GetCountForKey", "(Ljava/lang/String;)I"), __args); - return __ret; - } finally { - JNIEnv.DeleteLocalRef (native_key); - } -} - -static Delegate cb_Key; -#pragma warning disable 0169 -static Delegate GetKeyHandler () -{ - if (cb_Key == null) - cb_Key = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_L) n_Key); - return cb_Key; -} - -static IntPtr n_Key (IntPtr jnienv, IntPtr native__this) -{ - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return JNIEnv.NewString (__this.Key ()); -} -#pragma warning restore 0169 - -static IntPtr id_Key; -// Metadata.xml XPath method reference: path="/api/package[@name='java.code']/class[@name='MyClass']/method[@name='Key' and count(parameter)=0]" -[Register ("Key", "()Ljava/lang/String;", "GetKeyHandler")] -public virtual unsafe string Key () -{ - if (id_Key == IntPtr.Zero) - id_Key = JNIEnv.GetMethodID (class_ref, "Key", "()Ljava/lang/String;"); - try { - - if (((object) this).GetType () == ThresholdType) - return JNIEnv.GetString (JNIEnv.CallObjectMethod (((global::Java.Lang.Object) this).Handle, id_Key), JniHandleOwnership.TransferLocalRef); - else - return JNIEnv.GetString (JNIEnv.CallNonvirtualObjectMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "Key", "()Ljava/lang/String;")), JniHandleOwnership.TransferLocalRef); - } finally { - } -} - -static IntPtr id_StaticMethod; -// Metadata.xml XPath method reference: path="/api/package[@name='java.code']/class[@name='MyClass']/method[@name='StaticMethod' and count(parameter)=0]" -[Register ("StaticMethod", "()V", "")] -public static unsafe void StaticMethod () -{ - if (id_StaticMethod == IntPtr.Zero) - id_StaticMethod = JNIEnv.GetStaticMethodID (class_ref, "StaticMethod", "()V"); - try { - JNIEnv.CallStaticVoidMethod (class_ref, id_StaticMethod); - } finally { - } -} - -static Delegate cb_AbstractMethod; -#pragma warning disable 0169 -static Delegate GetAbstractMethodHandler () -{ - if (cb_AbstractMethod == null) - cb_AbstractMethod = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_V) n_AbstractMethod); - return cb_AbstractMethod; -} - -static void n_AbstractMethod (IntPtr jnienv, IntPtr native__this) -{ - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.AbstractMethod (); -} -#pragma warning restore 0169 - -// Metadata.xml XPath method reference: path="/api/package[@name='java.code']/class[@name='MyClass']/method[@name='AbstractMethod' and count(parameter)=0]" -[Register ("AbstractMethod", "()V", "GetAbstractMethodHandler")] -public abstract void AbstractMethod (); - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteClassProperties.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteClassProperties.txt deleted file mode 100644 index 0774dda29..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteClassProperties.txt +++ /dev/null @@ -1,203 +0,0 @@ -static Delegate cb_get_Count; -#pragma warning disable 0169 -static Delegate Getget_CountHandler () -{ - if (cb_get_Count == null) - cb_get_Count = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_I) n_get_Count); - return cb_get_Count; -} - -static int n_get_Count (IntPtr jnienv, IntPtr native__this) -{ - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return __this.Count; -} -#pragma warning restore 0169 - -static Delegate cb_set_Count_I; -#pragma warning disable 0169 -static Delegate Getset_Count_IHandler () -{ - if (cb_set_Count_I == null) - cb_set_Count_I = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPI_V) n_set_Count_I); - return cb_set_Count_I; -} - -static void n_set_Count_I (IntPtr jnienv, IntPtr native__this, int value) -{ - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.Count = value; -} -#pragma warning restore 0169 - -static IntPtr id_get_Count; -static IntPtr id_set_Count_I; -public virtual unsafe int Count { - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/class[@name='MyClass']/method[@name='get_Count' and count(parameter)=0]" - [Register ("get_Count", "()I", "Getget_CountHandler")] - get { - if (id_get_Count == IntPtr.Zero) - id_get_Count = JNIEnv.GetMethodID (class_ref, "get_Count", "()I"); - try { - - if (((object) this).GetType () == ThresholdType) - return JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_get_Count); - else - return JNIEnv.CallNonvirtualIntMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "get_Count", "()I")); - } finally { - } - } - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/class[@name='MyClass']/method[@name='set_Count' and count(parameter)=1 and parameter[1][@type='int']]" - [Register ("set_Count", "(I)V", "Getset_Count_IHandler")] - set { - if (id_set_Count_I == IntPtr.Zero) - id_set_Count_I = JNIEnv.GetMethodID (class_ref, "set_Count", "(I)V"); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (value); - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_set_Count_I, __args); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "set_Count", "(I)V"), __args); - } finally { - } - } -} - -static Delegate cb_get_Key; -#pragma warning disable 0169 -static Delegate Getget_KeyHandler () -{ - if (cb_get_Key == null) - cb_get_Key = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_L) n_get_Key); - return cb_get_Key; -} - -static IntPtr n_get_Key (IntPtr jnienv, IntPtr native__this) -{ - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return JNIEnv.NewString (__this.Key); -} -#pragma warning restore 0169 - -static Delegate cb_set_Key_Ljava_lang_String_; -#pragma warning disable 0169 -static Delegate Getset_Key_Ljava_lang_String_Handler () -{ - if (cb_set_Key_Ljava_lang_String_ == null) - cb_set_Key_Ljava_lang_String_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_V) n_set_Key_Ljava_lang_String_); - return cb_set_Key_Ljava_lang_String_; -} - -static void n_set_Key_Ljava_lang_String_ (IntPtr jnienv, IntPtr native__this, IntPtr native_value) -{ - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var value = JNIEnv.GetString (native_value, JniHandleOwnership.DoNotTransfer); - __this.Key = value; -} -#pragma warning restore 0169 - -static IntPtr id_get_Key; -static IntPtr id_set_Key_Ljava_lang_String_; -public virtual unsafe string Key { - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/class[@name='MyClass']/method[@name='get_Key' and count(parameter)=0]" - [Register ("get_Key", "()Ljava/lang/String;", "Getget_KeyHandler")] - get { - if (id_get_Key == IntPtr.Zero) - id_get_Key = JNIEnv.GetMethodID (class_ref, "get_Key", "()Ljava/lang/String;"); - try { - - if (((object) this).GetType () == ThresholdType) - return JNIEnv.GetString (JNIEnv.CallObjectMethod (((global::Java.Lang.Object) this).Handle, id_get_Key), JniHandleOwnership.TransferLocalRef); - else - return JNIEnv.GetString (JNIEnv.CallNonvirtualObjectMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "get_Key", "()Ljava/lang/String;")), JniHandleOwnership.TransferLocalRef); - } finally { - } - } - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/class[@name='MyClass']/method[@name='set_Key' and count(parameter)=1 and parameter[1][@type='java.lang.String']]" - [Register ("set_Key", "(Ljava/lang/String;)V", "Getset_Key_Ljava_lang_String_Handler")] - set { - if (id_set_Key_Ljava_lang_String_ == IntPtr.Zero) - id_set_Key_Ljava_lang_String_ = JNIEnv.GetMethodID (class_ref, "set_Key", "(Ljava/lang/String;)V"); - IntPtr native_value = JNIEnv.NewString ((string)value); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_value); - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_set_Key_Ljava_lang_String_, __args); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "set_Key", "(Ljava/lang/String;)V"), __args); - } finally { - JNIEnv.DeleteLocalRef (native_value); - } - } -} - -static IntPtr id_get_StaticCount; -static IntPtr id_set_StaticCount_I; -public static unsafe int StaticCount { - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/class[@name='MyClass']/method[@name='get_StaticCount' and count(parameter)=0]" - [Register ("get_StaticCount", "()I", "")] - get { - if (id_get_StaticCount == IntPtr.Zero) - id_get_StaticCount = JNIEnv.GetStaticMethodID (class_ref, "get_StaticCount", "()I"); - try { - return JNIEnv.CallStaticIntMethod (class_ref, id_get_StaticCount); - } finally { - } - } - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/class[@name='MyClass']/method[@name='set_StaticCount' and count(parameter)=1 and parameter[1][@type='int']]" - [Register ("set_StaticCount", "(I)V", "")] - set { - if (id_set_StaticCount_I == IntPtr.Zero) - id_set_StaticCount_I = JNIEnv.GetStaticMethodID (class_ref, "set_StaticCount", "(I)V"); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (value); - JNIEnv.CallStaticVoidMethod (class_ref, id_set_StaticCount_I, __args); - } finally { - } - } -} - -static Delegate cb_get_AbstractCount; -#pragma warning disable 0169 -static Delegate Getget_AbstractCountHandler () -{ - if (cb_get_AbstractCount == null) - cb_get_AbstractCount = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_I) n_get_AbstractCount); - return cb_get_AbstractCount; -} - -static int n_get_AbstractCount (IntPtr jnienv, IntPtr native__this) -{ - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return __this.AbstractCount; -} -#pragma warning restore 0169 - -static Delegate cb_set_AbstractCount_I; -#pragma warning disable 0169 -static Delegate Getset_AbstractCount_IHandler () -{ - if (cb_set_AbstractCount_I == null) - cb_set_AbstractCount_I = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPI_V) n_set_AbstractCount_I); - return cb_set_AbstractCount_I; -} - -static void n_set_AbstractCount_I (IntPtr jnienv, IntPtr native__this, int value) -{ - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.AbstractCount = value; -} -#pragma warning restore 0169 - -public abstract int AbstractCount { - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/class[@name='MyClass']/method[@name='get_AbstractCount' and count(parameter)=0]" - [Register ("get_AbstractCount", "()I", "Getget_AbstractCountHandler")] get; - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/class[@name='MyClass']/method[@name='set_AbstractCount' and count(parameter)=1 and parameter[1][@type='int']]" - [Register ("set_AbstractCount", "(I)V", "Getset_AbstractCount_IHandler")] set; -} - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteClassPropertyInvokers.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteClassPropertyInvokers.txt deleted file mode 100644 index 06dcb4711..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteClassPropertyInvokers.txt +++ /dev/null @@ -1,27 +0,0 @@ -static IntPtr id_get_AbstractCount; -static IntPtr id_set_AbstractCount_I; -public override unsafe int AbstractCount { - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/class[@name='MyClass']/method[@name='get_AbstractCount' and count(parameter)=0]" - [Register ("get_AbstractCount", "()I", "Getget_AbstractCountHandler")] - get { - if (id_get_AbstractCount == IntPtr.Zero) - id_get_AbstractCount = JNIEnv.GetMethodID (class_ref, "get_AbstractCount", "()I"); - try { - return JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_get_AbstractCount); - } finally { - } - } - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/class[@name='MyClass']/method[@name='set_AbstractCount' and count(parameter)=1 and parameter[1][@type='int']]" - [Register ("set_AbstractCount", "(I)V", "Getset_AbstractCount_IHandler")] - set { - if (id_set_AbstractCount_I == IntPtr.Zero) - id_set_AbstractCount_I = JNIEnv.GetMethodID (class_ref, "set_AbstractCount", "(I)V"); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (value); - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_set_AbstractCount_I, __args); - } finally { - } - } -} - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteClassPropertyInvokersWithSkips.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteClassPropertyInvokersWithSkips.txt deleted file mode 100644 index 06dcb4711..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteClassPropertyInvokersWithSkips.txt +++ /dev/null @@ -1,27 +0,0 @@ -static IntPtr id_get_AbstractCount; -static IntPtr id_set_AbstractCount_I; -public override unsafe int AbstractCount { - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/class[@name='MyClass']/method[@name='get_AbstractCount' and count(parameter)=0]" - [Register ("get_AbstractCount", "()I", "Getget_AbstractCountHandler")] - get { - if (id_get_AbstractCount == IntPtr.Zero) - id_get_AbstractCount = JNIEnv.GetMethodID (class_ref, "get_AbstractCount", "()I"); - try { - return JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_get_AbstractCount); - } finally { - } - } - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/class[@name='MyClass']/method[@name='set_AbstractCount' and count(parameter)=1 and parameter[1][@type='int']]" - [Register ("set_AbstractCount", "(I)V", "Getset_AbstractCount_IHandler")] - set { - if (id_set_AbstractCount_I == IntPtr.Zero) - id_set_AbstractCount_I = JNIEnv.GetMethodID (class_ref, "set_AbstractCount", "(I)V"); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (value); - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_set_AbstractCount_I, __args); - } finally { - } - } -} - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteConstSugarInterfaceFields.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteConstSugarInterfaceFields.txt deleted file mode 100644 index fe8fb5d7e..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteConstSugarInterfaceFields.txt +++ /dev/null @@ -1,18 +0,0 @@ -// Metadata.xml XPath interface reference: path="/api/package[@name='java.code']/interface[@name='IMyInterface']" -public partial interface IMyInterface { - - // Metadata.xml XPath field reference: path="/api/package[@name='java.code']/interface[@name='IMyInterface']/field[@name='MyConstantField']" - [Register ("MyConstantField")] - public const int MyConstantField = (int) 7; - - // Metadata.xml XPath field reference: path="/api/package[@name='java.code']/interface[@name='IMyInterface']/field[@name='MyConstantStringField']" - [Register ("MyConstantStringField")] - public const string MyConstantStringField = (string) "hello"; - - // Metadata.xml XPath field reference: path="/api/package[@name='java.code']/interface[@name='IMyInterface']/field[@name='MyDeprecatedField']" - [Register ("MyDeprecatedField")] - [Obsolete ("")] - public const int MyDeprecatedField = (int) 7; - -} - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteCtor.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteCtor.txt deleted file mode 100644 index a5259f4c6..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteCtor.txt +++ /dev/null @@ -1,28 +0,0 @@ -static IntPtr id_ctor; -// Metadata.xml XPath constructor reference: path="/api/package[@name='com.mypackage']/class[@name='foo']/constructor[@name='foo' and count(parameter)=0]" -[Register (".ctor", "", "")] - unsafe Object () - : base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer) -{ - if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero) - return; - - try { - if (((object) this).GetType () != typeof (Object)) { - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (((object) this).GetType (), ""), - JniHandleOwnership.TransferLocalRef); - global::Android.Runtime.JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, ""); - return; - } - - if (id_ctor == IntPtr.Zero) - id_ctor = JNIEnv.GetMethodID (class_ref, "", ""); - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (class_ref, id_ctor), - JniHandleOwnership.TransferLocalRef); - JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, class_ref, id_ctor); - } finally { - } -} - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteCtorDeprecated.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteCtorDeprecated.txt deleted file mode 100644 index de93a253a..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteCtorDeprecated.txt +++ /dev/null @@ -1,31 +0,0 @@ -static IntPtr id_ctor; -// Metadata.xml XPath constructor reference: path="/api/package[@name='com.mypackage']/class[@name='foo']/constructor[@name='foo' and count(parameter)=0]" -[Register (".ctor", "", "")] -[Obsolete (@"This constructor is obsolete")] -[MyAttribute] -[global::Android.Runtime.IntDefinition (null, JniField = "xamarin/test/SomeObject.SOME_VALUE")] - unsafe Object () - : base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer) -{ - if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero) - return; - - try { - if (((object) this).GetType () != typeof (Object)) { - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (((object) this).GetType (), ""), - JniHandleOwnership.TransferLocalRef); - global::Android.Runtime.JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, ""); - return; - } - - if (id_ctor == IntPtr.Zero) - id_ctor = JNIEnv.GetMethodID (class_ref, "", ""); - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (class_ref, id_ctor), - JniHandleOwnership.TransferLocalRef); - JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, class_ref, id_ctor); - } finally { - } -} - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteCtorWithStringOverload.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteCtorWithStringOverload.txt deleted file mode 100644 index cb1bddef9..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteCtorWithStringOverload.txt +++ /dev/null @@ -1,62 +0,0 @@ -static IntPtr id_ctor_Ljava_lang_CharSequence_; -// Metadata.xml XPath constructor reference: path="/api/package[@name='com.mypackage']/class[@name='foo']/constructor[@name='foo' and count(parameter)=1 and parameter[1][@type='java.lang.CharSequence']]" -[Register (".ctor", "(Ljava/lang/CharSequence;)V", "")] - unsafe Object (Java.Lang.ICharSequence mystring) - : base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer) -{ - if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero) - return; - - IntPtr native_mystring = CharSequence.ToLocalJniHandle (mystring); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_mystring); - if (((object) this).GetType () != typeof (Object)) { - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (((object) this).GetType (), "(Ljava/lang/CharSequence;)V", __args), - JniHandleOwnership.TransferLocalRef); - global::Android.Runtime.JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, "(Ljava/lang/CharSequence;)V", __args); - return; - } - - if (id_ctor_Ljava_lang_CharSequence_ == IntPtr.Zero) - id_ctor_Ljava_lang_CharSequence_ = JNIEnv.GetMethodID (class_ref, "", "(Ljava/lang/CharSequence;)V"); - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (class_ref, id_ctor_Ljava_lang_CharSequence_, __args), - JniHandleOwnership.TransferLocalRef); - JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, class_ref, id_ctor_Ljava_lang_CharSequence_, __args); - } finally { - JNIEnv.DeleteLocalRef (native_mystring); - } -} - -[Register (".ctor", "(Ljava/lang/CharSequence;)V", "")] - unsafe Object (string mystring) - : base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer) -{ - if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero) - return; - - IntPtr native_mystring = CharSequence.ToLocalJniHandle (mystring); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_mystring); - if (((object) this).GetType () != typeof (Object)) { - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (((object) this).GetType (), "(Ljava/lang/CharSequence;)V", __args), - JniHandleOwnership.TransferLocalRef); - global::Android.Runtime.JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, "(Ljava/lang/CharSequence;)V", __args); - return; - } - - if (id_ctor_Ljava_lang_CharSequence_ == IntPtr.Zero) - id_ctor_Ljava_lang_CharSequence_ = JNIEnv.GetMethodID (class_ref, "", "(Ljava/lang/CharSequence;)V"); - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (class_ref, id_ctor_Ljava_lang_CharSequence_, __args), - JniHandleOwnership.TransferLocalRef); - JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, class_ref, id_ctor_Ljava_lang_CharSequence_, __args); - } finally { - JNIEnv.DeleteLocalRef (native_mystring); - } -} - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteFieldConstant.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteFieldConstant.txt deleted file mode 100644 index 2606c5621..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteFieldConstant.txt +++ /dev/null @@ -1,12 +0,0 @@ -static IntPtr bar_jfieldId; - -// Metadata.xml XPath field reference: path="/api/package[@name='com.mypackage']/class[@name='foo']/field[@name='bar']" -[Register ("bar")] -public static string bar { - get { - if (bar_jfieldId == IntPtr.Zero) - bar_jfieldId = JNIEnv.GetStaticFieldID (class_ref, "bar", "Ljava/lang/String;"); - IntPtr __ret = JNIEnv.GetStaticObjectField (class_ref, bar_jfieldId); - return JNIEnv.GetString (__ret, JniHandleOwnership.TransferLocalRef); - } -} diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteFieldConstantWithIntValue.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteFieldConstantWithIntValue.txt deleted file mode 100644 index a1f3257f0..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteFieldConstantWithIntValue.txt +++ /dev/null @@ -1,3 +0,0 @@ -// Metadata.xml XPath field reference: path="/api/package[@name='com.mypackage']/class[@name='foo']/field[@name='bar']" -[Register ("bar")] -public const int bar = (int) 1234; diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteFieldConstantWithStringValue.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteFieldConstantWithStringValue.txt deleted file mode 100644 index 1e7186b00..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteFieldConstantWithStringValue.txt +++ /dev/null @@ -1,3 +0,0 @@ -// Metadata.xml XPath field reference: path="/api/package[@name='com.mypackage']/class[@name='foo']/field[@name='bar']" -[Register ("bar")] -public const string bar = (string) "hello"; diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteFieldGetBody.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteFieldGetBody.txt deleted file mode 100644 index f80140f8f..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteFieldGetBody.txt +++ /dev/null @@ -1,4 +0,0 @@ -if (bar_jfieldId == IntPtr.Zero) - bar_jfieldId = JNIEnv.GetFieldID (class_ref, "bar", "Ljava/lang/String;"); -IntPtr __ret = JNIEnv.GetObjectField (((global::Java.Lang.Object) this).Handle, bar_jfieldId); -return JNIEnv.GetString (__ret, JniHandleOwnership.TransferLocalRef); diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteFieldIdField.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteFieldIdField.txt deleted file mode 100644 index a4d61e9bd..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteFieldIdField.txt +++ /dev/null @@ -1 +0,0 @@ -static IntPtr bar_jfieldId; diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteFieldInt.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteFieldInt.txt deleted file mode 100644 index 3715acfa8..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteFieldInt.txt +++ /dev/null @@ -1,19 +0,0 @@ -static IntPtr bar_jfieldId; - -// Metadata.xml XPath field reference: path="/api/package[@name='com.mypackage']/class[@name='foo']/field[@name='bar']" -[Register ("bar")] -public int bar { - get { - if (bar_jfieldId == IntPtr.Zero) - bar_jfieldId = JNIEnv.GetFieldID (class_ref, "bar", "I"); - return JNIEnv.GetIntField (((global::Java.Lang.Object) this).Handle, bar_jfieldId); - } - set { - if (bar_jfieldId == IntPtr.Zero) - bar_jfieldId = JNIEnv.GetFieldID (class_ref, "bar", "I"); - try { - JNIEnv.SetField (((global::Java.Lang.Object) this).Handle, bar_jfieldId, value); - } finally { - } - } -} diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteFieldSetBody.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteFieldSetBody.txt deleted file mode 100644 index bf10c288b..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteFieldSetBody.txt +++ /dev/null @@ -1,8 +0,0 @@ -if (bar_jfieldId == IntPtr.Zero) - bar_jfieldId = JNIEnv.GetFieldID (class_ref, "bar", "Ljava/lang/String;"); -IntPtr native_value = JNIEnv.NewString ((string)value); -try { - JNIEnv.SetField (((global::Java.Lang.Object) this).Handle, bar_jfieldId, native_value); -} finally { - JNIEnv.DeleteLocalRef (native_value); -} diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteFieldString.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteFieldString.txt deleted file mode 100644 index 62e2046b2..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteFieldString.txt +++ /dev/null @@ -1,22 +0,0 @@ -static IntPtr bar_jfieldId; - -// Metadata.xml XPath field reference: path="/api/package[@name='com.mypackage']/class[@name='foo']/field[@name='bar']" -[Register ("bar")] -public string bar { - get { - if (bar_jfieldId == IntPtr.Zero) - bar_jfieldId = JNIEnv.GetFieldID (class_ref, "bar", "Ljava/lang/String;"); - IntPtr __ret = JNIEnv.GetObjectField (((global::Java.Lang.Object) this).Handle, bar_jfieldId); - return JNIEnv.GetString (__ret, JniHandleOwnership.TransferLocalRef); - } - set { - if (bar_jfieldId == IntPtr.Zero) - bar_jfieldId = JNIEnv.GetFieldID (class_ref, "bar", "Ljava/lang/String;"); - IntPtr native_value = JNIEnv.NewString ((string)value); - try { - JNIEnv.SetField (((global::Java.Lang.Object) this).Handle, bar_jfieldId, native_value); - } finally { - JNIEnv.DeleteLocalRef (native_value); - } - } -} diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteInterface.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteInterface.txt deleted file mode 100644 index cff9a6b9b..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteInterface.txt +++ /dev/null @@ -1,345 +0,0 @@ -[Register ("java/code/IMyInterface", DoNotGenerateAcw=true)] -public abstract class MyInterface : Java.Lang.Object { - - internal MyInterface () - { - } - static IntPtr id_StaticMethod; - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/interface[@name='IMyInterface']/method[@name='StaticMethod' and count(parameter)=0]" - [Register ("StaticMethod", "()V", "")] - public static unsafe void StaticMethod () - { - if (id_StaticMethod == IntPtr.Zero) - id_StaticMethod = JNIEnv.GetStaticMethodID (class_ref, "StaticMethod", "()V"); - try { - JNIEnv.CallStaticVoidMethod (class_ref, id_StaticMethod); - } finally { - } - } - - - new static IntPtr class_ref = JNIEnv.FindClass ("java/code/IMyInterface"); -} - -[Register ("java/code/IMyInterface", DoNotGenerateAcw=true)] -[global::System.Obsolete ("Use the 'MyInterface' type. This type will be removed in a future release.", error: true)] -public abstract class MyInterfaceConsts : MyInterface { - - private MyInterfaceConsts () - { - } -} - -// Metadata.xml XPath interface reference: path="/api/package[@name='java.code']/interface[@name='IMyInterface']" -[Register ("java/code/IMyInterface", "", "java.code.IMyInterfaceInvoker")] -public partial interface IMyInterface : IJavaObject { - - int Count { - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/interface[@name='IMyInterface']/method[@name='get_Count' and count(parameter)=0]" - [Register ("get_Count", "()I", "Getget_CountHandler:java.code.IMyInterfaceInvoker, ")] get; - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/interface[@name='IMyInterface']/method[@name='set_Count' and count(parameter)=1 and parameter[1][@type='int']]" - [Register ("set_Count", "(I)V", "Getset_Count_IHandler:java.code.IMyInterfaceInvoker, ")] set; - } - - string Key { - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/interface[@name='IMyInterface']/method[@name='get_Key' and count(parameter)=0]" - [Register ("get_Key", "()Ljava/lang/String;", "Getget_KeyHandler:java.code.IMyInterfaceInvoker, ")] get; - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/interface[@name='IMyInterface']/method[@name='set_Key' and count(parameter)=1 and parameter[1][@type='java.lang.String']]" - [Register ("set_Key", "(Ljava/lang/String;)V", "Getset_Key_Ljava_lang_String_Handler:java.code.IMyInterfaceInvoker, ")] set; - } - - int AbstractCount { - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/interface[@name='IMyInterface']/method[@name='get_AbstractCount' and count(parameter)=0]" - [Register ("get_AbstractCount", "()I", "Getget_AbstractCountHandler:java.code.IMyInterfaceInvoker, ")] get; - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/interface[@name='IMyInterface']/method[@name='set_AbstractCount' and count(parameter)=1 and parameter[1][@type='int']]" - [Register ("set_AbstractCount", "(I)V", "Getset_AbstractCount_IHandler:java.code.IMyInterfaceInvoker, ")] set; - } - - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/interface[@name='IMyInterface']/method[@name='GetCountForKey' and count(parameter)=1 and parameter[1][@type='java.lang.String']]" - [Register ("GetCountForKey", "(Ljava/lang/String;)I", "GetGetCountForKey_Ljava_lang_String_Handler:java.code.IMyInterfaceInvoker, ")] - int GetCountForKey (string key); - - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/interface[@name='IMyInterface']/method[@name='Key' and count(parameter)=0]" - [Register ("Key", "()Ljava/lang/String;", "GetKeyHandler:java.code.IMyInterfaceInvoker, ")] - string Key (); - - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/interface[@name='IMyInterface']/method[@name='AbstractMethod' and count(parameter)=0]" - [Register ("AbstractMethod", "()V", "GetAbstractMethodHandler:java.code.IMyInterfaceInvoker, ")] - void AbstractMethod (); - -} - -[global::Android.Runtime.Register ("java/code/IMyInterface", DoNotGenerateAcw=true)] -internal partial class IMyInterfaceInvoker : global::Java.Lang.Object, IMyInterface { - - static IntPtr java_class_ref = JNIEnv.FindClass ("java/code/IMyInterface"); - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (IMyInterfaceInvoker); } - } - - IntPtr class_ref; - - public static IMyInterface GetObject (IntPtr handle, JniHandleOwnership transfer) - { - return global::Java.Lang.Object.GetObject (handle, transfer); - } - - static IntPtr Validate (IntPtr handle) - { - if (!JNIEnv.IsInstanceOf (handle, java_class_ref)) - throw new InvalidCastException (string.Format ("Unable to convert instance of type '{0}' to type '{1}'.", - JNIEnv.GetClassNameFromInstance (handle), "java.code.IMyInterface")); - return handle; - } - - protected override void Dispose (bool disposing) - { - if (this.class_ref != IntPtr.Zero) - JNIEnv.DeleteGlobalRef (this.class_ref); - this.class_ref = IntPtr.Zero; - base.Dispose (disposing); - } - - public IMyInterfaceInvoker (IntPtr handle, JniHandleOwnership transfer) : base (Validate (handle), transfer) - { - IntPtr local_ref = JNIEnv.GetObjectClass (((global::Java.Lang.Object) this).Handle); - this.class_ref = JNIEnv.NewGlobalRef (local_ref); - JNIEnv.DeleteLocalRef (local_ref); - } - - static Delegate cb_get_Count; -#pragma warning disable 0169 - static Delegate Getget_CountHandler () - { - if (cb_get_Count == null) - cb_get_Count = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_I) n_get_Count); - return cb_get_Count; - } - - static int n_get_Count (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return __this.Count; - } -#pragma warning restore 0169 - - static Delegate cb_set_Count_I; -#pragma warning disable 0169 - static Delegate Getset_Count_IHandler () - { - if (cb_set_Count_I == null) - cb_set_Count_I = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPI_V) n_set_Count_I); - return cb_set_Count_I; - } - - static void n_set_Count_I (IntPtr jnienv, IntPtr native__this, int value) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.Count = value; - } -#pragma warning restore 0169 - - IntPtr id_get_Count; - IntPtr id_set_Count_I; - public unsafe int Count { - get { - if (id_get_Count == IntPtr.Zero) - id_get_Count = JNIEnv.GetMethodID (class_ref, "get_Count", "()I"); - return JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_get_Count); - } - set { - if (id_set_Count_I == IntPtr.Zero) - id_set_Count_I = JNIEnv.GetMethodID (class_ref, "set_Count", "(I)V"); - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (value); - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_set_Count_I, __args); - } - } - - static Delegate cb_get_Key; -#pragma warning disable 0169 - static Delegate Getget_KeyHandler () - { - if (cb_get_Key == null) - cb_get_Key = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_L) n_get_Key); - return cb_get_Key; - } - - static IntPtr n_get_Key (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return JNIEnv.NewString (__this.Key); - } -#pragma warning restore 0169 - - static Delegate cb_set_Key_Ljava_lang_String_; -#pragma warning disable 0169 - static Delegate Getset_Key_Ljava_lang_String_Handler () - { - if (cb_set_Key_Ljava_lang_String_ == null) - cb_set_Key_Ljava_lang_String_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_V) n_set_Key_Ljava_lang_String_); - return cb_set_Key_Ljava_lang_String_; - } - - static void n_set_Key_Ljava_lang_String_ (IntPtr jnienv, IntPtr native__this, IntPtr native_value) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var value = JNIEnv.GetString (native_value, JniHandleOwnership.DoNotTransfer); - __this.Key = value; - } -#pragma warning restore 0169 - - IntPtr id_get_Key; - IntPtr id_set_Key_Ljava_lang_String_; - public unsafe string Key { - get { - if (id_get_Key == IntPtr.Zero) - id_get_Key = JNIEnv.GetMethodID (class_ref, "get_Key", "()Ljava/lang/String;"); - return JNIEnv.GetString (JNIEnv.CallObjectMethod (((global::Java.Lang.Object) this).Handle, id_get_Key), JniHandleOwnership.TransferLocalRef); - } - set { - if (id_set_Key_Ljava_lang_String_ == IntPtr.Zero) - id_set_Key_Ljava_lang_String_ = JNIEnv.GetMethodID (class_ref, "set_Key", "(Ljava/lang/String;)V"); - IntPtr native_value = JNIEnv.NewString ((string)value); - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_value); - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_set_Key_Ljava_lang_String_, __args); - JNIEnv.DeleteLocalRef (native_value); - } - } - - static Delegate cb_get_AbstractCount; -#pragma warning disable 0169 - static Delegate Getget_AbstractCountHandler () - { - if (cb_get_AbstractCount == null) - cb_get_AbstractCount = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_I) n_get_AbstractCount); - return cb_get_AbstractCount; - } - - static int n_get_AbstractCount (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return __this.AbstractCount; - } -#pragma warning restore 0169 - - static Delegate cb_set_AbstractCount_I; -#pragma warning disable 0169 - static Delegate Getset_AbstractCount_IHandler () - { - if (cb_set_AbstractCount_I == null) - cb_set_AbstractCount_I = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPI_V) n_set_AbstractCount_I); - return cb_set_AbstractCount_I; - } - - static void n_set_AbstractCount_I (IntPtr jnienv, IntPtr native__this, int value) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.AbstractCount = value; - } -#pragma warning restore 0169 - - IntPtr id_get_AbstractCount; - IntPtr id_set_AbstractCount_I; - public unsafe int AbstractCount { - get { - if (id_get_AbstractCount == IntPtr.Zero) - id_get_AbstractCount = JNIEnv.GetMethodID (class_ref, "get_AbstractCount", "()I"); - return JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_get_AbstractCount); - } - set { - if (id_set_AbstractCount_I == IntPtr.Zero) - id_set_AbstractCount_I = JNIEnv.GetMethodID (class_ref, "set_AbstractCount", "(I)V"); - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (value); - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_set_AbstractCount_I, __args); - } - } - - static Delegate cb_GetCountForKey_Ljava_lang_String_; -#pragma warning disable 0169 - static Delegate GetGetCountForKey_Ljava_lang_String_Handler () - { - if (cb_GetCountForKey_Ljava_lang_String_ == null) - cb_GetCountForKey_Ljava_lang_String_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_I) n_GetCountForKey_Ljava_lang_String_); - return cb_GetCountForKey_Ljava_lang_String_; - } - - static int n_GetCountForKey_Ljava_lang_String_ (IntPtr jnienv, IntPtr native__this, IntPtr native_key) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var key = JNIEnv.GetString (native_key, JniHandleOwnership.DoNotTransfer); - int __ret = __this.GetCountForKey (key); - return __ret; - } -#pragma warning restore 0169 - - IntPtr id_GetCountForKey_Ljava_lang_String_; - public unsafe int GetCountForKey (string key) - { - if (id_GetCountForKey_Ljava_lang_String_ == IntPtr.Zero) - id_GetCountForKey_Ljava_lang_String_ = JNIEnv.GetMethodID (class_ref, "GetCountForKey", "(Ljava/lang/String;)I"); - IntPtr native_key = JNIEnv.NewString ((string)key); - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_key); - var __ret = JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_GetCountForKey_Ljava_lang_String_, __args); - JNIEnv.DeleteLocalRef (native_key); - return __ret; - } - - static Delegate cb_Key; -#pragma warning disable 0169 - static Delegate GetKeyHandler () - { - if (cb_Key == null) - cb_Key = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_L) n_Key); - return cb_Key; - } - - static IntPtr n_Key (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return JNIEnv.NewString (__this.Key ()); - } -#pragma warning restore 0169 - - IntPtr id_Key; - public unsafe string Key () - { - if (id_Key == IntPtr.Zero) - id_Key = JNIEnv.GetMethodID (class_ref, "Key", "()Ljava/lang/String;"); - return JNIEnv.GetString (JNIEnv.CallObjectMethod (((global::Java.Lang.Object) this).Handle, id_Key), JniHandleOwnership.TransferLocalRef); - } - - static Delegate cb_AbstractMethod; -#pragma warning disable 0169 - static Delegate GetAbstractMethodHandler () - { - if (cb_AbstractMethod == null) - cb_AbstractMethod = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_V) n_AbstractMethod); - return cb_AbstractMethod; - } - - static void n_AbstractMethod (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.AbstractMethod (); - } -#pragma warning restore 0169 - - IntPtr id_AbstractMethod; - public unsafe void AbstractMethod () - { - if (id_AbstractMethod == IntPtr.Zero) - id_AbstractMethod = JNIEnv.GetMethodID (class_ref, "AbstractMethod", "()V"); - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_AbstractMethod); - } - -} - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteInterfaceDeclaration.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteInterfaceDeclaration.txt deleted file mode 100644 index fb079e879..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteInterfaceDeclaration.txt +++ /dev/null @@ -1,39 +0,0 @@ -// Metadata.xml XPath interface reference: path="/api/package[@name='java.code']/interface[@name='IMyInterface']" -[Register ("java/code/IMyInterface", "", "java.code.IMyInterfaceInvoker")] -public partial interface IMyInterface : IJavaObject { - - int Count { - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/interface[@name='IMyInterface']/method[@name='get_Count' and count(parameter)=0]" - [Register ("get_Count", "()I", "Getget_CountHandler:java.code.IMyInterfaceInvoker, ")] get; - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/interface[@name='IMyInterface']/method[@name='set_Count' and count(parameter)=1 and parameter[1][@type='int']]" - [Register ("set_Count", "(I)V", "Getset_Count_IHandler:java.code.IMyInterfaceInvoker, ")] set; - } - - string Key { - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/interface[@name='IMyInterface']/method[@name='get_Key' and count(parameter)=0]" - [Register ("get_Key", "()Ljava/lang/String;", "Getget_KeyHandler:java.code.IMyInterfaceInvoker, ")] get; - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/interface[@name='IMyInterface']/method[@name='set_Key' and count(parameter)=1 and parameter[1][@type='java.lang.String']]" - [Register ("set_Key", "(Ljava/lang/String;)V", "Getset_Key_Ljava_lang_String_Handler:java.code.IMyInterfaceInvoker, ")] set; - } - - int AbstractCount { - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/interface[@name='IMyInterface']/method[@name='get_AbstractCount' and count(parameter)=0]" - [Register ("get_AbstractCount", "()I", "Getget_AbstractCountHandler:java.code.IMyInterfaceInvoker, ")] get; - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/interface[@name='IMyInterface']/method[@name='set_AbstractCount' and count(parameter)=1 and parameter[1][@type='int']]" - [Register ("set_AbstractCount", "(I)V", "Getset_AbstractCount_IHandler:java.code.IMyInterfaceInvoker, ")] set; - } - - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/interface[@name='IMyInterface']/method[@name='GetCountForKey' and count(parameter)=1 and parameter[1][@type='java.lang.String']]" - [Register ("GetCountForKey", "(Ljava/lang/String;)I", "GetGetCountForKey_Ljava_lang_String_Handler:java.code.IMyInterfaceInvoker, ")] - int GetCountForKey (string key); - - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/interface[@name='IMyInterface']/method[@name='Key' and count(parameter)=0]" - [Register ("Key", "()Ljava/lang/String;", "GetKeyHandler:java.code.IMyInterfaceInvoker, ")] - string Key (); - - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/interface[@name='IMyInterface']/method[@name='AbstractMethod' and count(parameter)=0]" - [Register ("AbstractMethod", "()V", "GetAbstractMethodHandler:java.code.IMyInterfaceInvoker, ")] - void AbstractMethod (); - -} - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteInterfaceFields.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteInterfaceFields.txt deleted file mode 100644 index 085ad91e2..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteInterfaceFields.txt +++ /dev/null @@ -1,14 +0,0 @@ -// Metadata.xml XPath interface reference: path="/api/package[@name='java.code']/interface[@name='IMyInterface']" -[Register ("java/code/IMyInterface", "", "java.code.IMyInterfaceInvoker")] -public partial interface IMyInterface : IJavaObject { - - // Metadata.xml XPath field reference: path="/api/package[@name='java.code']/interface[@name='IMyInterface']/field[@name='MyConstantField']" - [Register ("MyConstantField")] - public const int MyConstantField = (int) 7; - - // Metadata.xml XPath method reference: path="/api/package[@name='java.code']/interface[@name='IMyInterface']/method[@name='DoSomething' and count(parameter)=0]" - [Register ("DoSomething", "()V", "GetDoSomethingHandler:java.code.IMyInterfaceInvoker, ")] - void DoSomething (); - -} - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteInterfaceInvoker.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteInterfaceInvoker.txt deleted file mode 100644 index 2929e5b33..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteInterfaceInvoker.txt +++ /dev/null @@ -1,274 +0,0 @@ -[global::Android.Runtime.Register ("java/code/IMyInterface", DoNotGenerateAcw=true)] -internal partial class IMyInterfaceInvoker : global::Java.Lang.Object, IMyInterface { - - static IntPtr java_class_ref = JNIEnv.FindClass ("java/code/IMyInterface"); - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (IMyInterfaceInvoker); } - } - - IntPtr class_ref; - - public static IMyInterface GetObject (IntPtr handle, JniHandleOwnership transfer) - { - return global::Java.Lang.Object.GetObject (handle, transfer); - } - - static IntPtr Validate (IntPtr handle) - { - if (!JNIEnv.IsInstanceOf (handle, java_class_ref)) - throw new InvalidCastException (string.Format ("Unable to convert instance of type '{0}' to type '{1}'.", - JNIEnv.GetClassNameFromInstance (handle), "java.code.IMyInterface")); - return handle; - } - - protected override void Dispose (bool disposing) - { - if (this.class_ref != IntPtr.Zero) - JNIEnv.DeleteGlobalRef (this.class_ref); - this.class_ref = IntPtr.Zero; - base.Dispose (disposing); - } - - public IMyInterfaceInvoker (IntPtr handle, JniHandleOwnership transfer) : base (Validate (handle), transfer) - { - IntPtr local_ref = JNIEnv.GetObjectClass (((global::Java.Lang.Object) this).Handle); - this.class_ref = JNIEnv.NewGlobalRef (local_ref); - JNIEnv.DeleteLocalRef (local_ref); - } - - static Delegate cb_get_Count; -#pragma warning disable 0169 - static Delegate Getget_CountHandler () - { - if (cb_get_Count == null) - cb_get_Count = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_I) n_get_Count); - return cb_get_Count; - } - - static int n_get_Count (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return __this.Count; - } -#pragma warning restore 0169 - - static Delegate cb_set_Count_I; -#pragma warning disable 0169 - static Delegate Getset_Count_IHandler () - { - if (cb_set_Count_I == null) - cb_set_Count_I = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPI_V) n_set_Count_I); - return cb_set_Count_I; - } - - static void n_set_Count_I (IntPtr jnienv, IntPtr native__this, int value) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.Count = value; - } -#pragma warning restore 0169 - - IntPtr id_get_Count; - IntPtr id_set_Count_I; - public unsafe int Count { - get { - if (id_get_Count == IntPtr.Zero) - id_get_Count = JNIEnv.GetMethodID (class_ref, "get_Count", "()I"); - return JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_get_Count); - } - set { - if (id_set_Count_I == IntPtr.Zero) - id_set_Count_I = JNIEnv.GetMethodID (class_ref, "set_Count", "(I)V"); - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (value); - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_set_Count_I, __args); - } - } - - static Delegate cb_get_Key; -#pragma warning disable 0169 - static Delegate Getget_KeyHandler () - { - if (cb_get_Key == null) - cb_get_Key = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_L) n_get_Key); - return cb_get_Key; - } - - static IntPtr n_get_Key (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return JNIEnv.NewString (__this.Key); - } -#pragma warning restore 0169 - - static Delegate cb_set_Key_Ljava_lang_String_; -#pragma warning disable 0169 - static Delegate Getset_Key_Ljava_lang_String_Handler () - { - if (cb_set_Key_Ljava_lang_String_ == null) - cb_set_Key_Ljava_lang_String_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_V) n_set_Key_Ljava_lang_String_); - return cb_set_Key_Ljava_lang_String_; - } - - static void n_set_Key_Ljava_lang_String_ (IntPtr jnienv, IntPtr native__this, IntPtr native_value) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var value = JNIEnv.GetString (native_value, JniHandleOwnership.DoNotTransfer); - __this.Key = value; - } -#pragma warning restore 0169 - - IntPtr id_get_Key; - IntPtr id_set_Key_Ljava_lang_String_; - public unsafe string Key { - get { - if (id_get_Key == IntPtr.Zero) - id_get_Key = JNIEnv.GetMethodID (class_ref, "get_Key", "()Ljava/lang/String;"); - return JNIEnv.GetString (JNIEnv.CallObjectMethod (((global::Java.Lang.Object) this).Handle, id_get_Key), JniHandleOwnership.TransferLocalRef); - } - set { - if (id_set_Key_Ljava_lang_String_ == IntPtr.Zero) - id_set_Key_Ljava_lang_String_ = JNIEnv.GetMethodID (class_ref, "set_Key", "(Ljava/lang/String;)V"); - IntPtr native_value = JNIEnv.NewString ((string)value); - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_value); - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_set_Key_Ljava_lang_String_, __args); - JNIEnv.DeleteLocalRef (native_value); - } - } - - static Delegate cb_get_AbstractCount; -#pragma warning disable 0169 - static Delegate Getget_AbstractCountHandler () - { - if (cb_get_AbstractCount == null) - cb_get_AbstractCount = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_I) n_get_AbstractCount); - return cb_get_AbstractCount; - } - - static int n_get_AbstractCount (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return __this.AbstractCount; - } -#pragma warning restore 0169 - - static Delegate cb_set_AbstractCount_I; -#pragma warning disable 0169 - static Delegate Getset_AbstractCount_IHandler () - { - if (cb_set_AbstractCount_I == null) - cb_set_AbstractCount_I = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPI_V) n_set_AbstractCount_I); - return cb_set_AbstractCount_I; - } - - static void n_set_AbstractCount_I (IntPtr jnienv, IntPtr native__this, int value) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.AbstractCount = value; - } -#pragma warning restore 0169 - - IntPtr id_get_AbstractCount; - IntPtr id_set_AbstractCount_I; - public unsafe int AbstractCount { - get { - if (id_get_AbstractCount == IntPtr.Zero) - id_get_AbstractCount = JNIEnv.GetMethodID (class_ref, "get_AbstractCount", "()I"); - return JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_get_AbstractCount); - } - set { - if (id_set_AbstractCount_I == IntPtr.Zero) - id_set_AbstractCount_I = JNIEnv.GetMethodID (class_ref, "set_AbstractCount", "(I)V"); - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (value); - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_set_AbstractCount_I, __args); - } - } - - static Delegate cb_GetCountForKey_Ljava_lang_String_; -#pragma warning disable 0169 - static Delegate GetGetCountForKey_Ljava_lang_String_Handler () - { - if (cb_GetCountForKey_Ljava_lang_String_ == null) - cb_GetCountForKey_Ljava_lang_String_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_I) n_GetCountForKey_Ljava_lang_String_); - return cb_GetCountForKey_Ljava_lang_String_; - } - - static int n_GetCountForKey_Ljava_lang_String_ (IntPtr jnienv, IntPtr native__this, IntPtr native_key) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var key = JNIEnv.GetString (native_key, JniHandleOwnership.DoNotTransfer); - int __ret = __this.GetCountForKey (key); - return __ret; - } -#pragma warning restore 0169 - - IntPtr id_GetCountForKey_Ljava_lang_String_; - public unsafe int GetCountForKey (string key) - { - if (id_GetCountForKey_Ljava_lang_String_ == IntPtr.Zero) - id_GetCountForKey_Ljava_lang_String_ = JNIEnv.GetMethodID (class_ref, "GetCountForKey", "(Ljava/lang/String;)I"); - IntPtr native_key = JNIEnv.NewString ((string)key); - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_key); - var __ret = JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_GetCountForKey_Ljava_lang_String_, __args); - JNIEnv.DeleteLocalRef (native_key); - return __ret; - } - - static Delegate cb_Key; -#pragma warning disable 0169 - static Delegate GetKeyHandler () - { - if (cb_Key == null) - cb_Key = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_L) n_Key); - return cb_Key; - } - - static IntPtr n_Key (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return JNIEnv.NewString (__this.Key ()); - } -#pragma warning restore 0169 - - IntPtr id_Key; - public unsafe string Key () - { - if (id_Key == IntPtr.Zero) - id_Key = JNIEnv.GetMethodID (class_ref, "Key", "()Ljava/lang/String;"); - return JNIEnv.GetString (JNIEnv.CallObjectMethod (((global::Java.Lang.Object) this).Handle, id_Key), JniHandleOwnership.TransferLocalRef); - } - - static Delegate cb_AbstractMethod; -#pragma warning disable 0169 - static Delegate GetAbstractMethodHandler () - { - if (cb_AbstractMethod == null) - cb_AbstractMethod = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_V) n_AbstractMethod); - return cb_AbstractMethod; - } - - static void n_AbstractMethod (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.AbstractMethod (); - } -#pragma warning restore 0169 - - IntPtr id_AbstractMethod; - public unsafe void AbstractMethod () - { - if (id_AbstractMethod == IntPtr.Zero) - id_AbstractMethod = JNIEnv.GetMethodID (class_ref, "AbstractMethod", "()V"); - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_AbstractMethod); - } - -} - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteMethodAbstractWithVoidReturn.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteMethodAbstractWithVoidReturn.txt deleted file mode 100644 index cece31ea1..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteMethodAbstractWithVoidReturn.txt +++ /dev/null @@ -1,29 +0,0 @@ -static Delegate cb_bar; -#pragma warning disable 0169 -static Delegate GetbarHandler () -{ - if (cb_bar == null) - cb_bar = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_V) n_bar); - return cb_bar; -} - -static void n_bar (IntPtr jnienv, IntPtr native__this) -{ - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.bar (); -} -#pragma warning restore 0169 - -static IntPtr id_bar; -// Metadata.xml XPath method reference: path="/api/package[@name='com.mypackage']/class[@name='foo']/method[@name='bar' and count(parameter)=0]" -[Register ("bar", "()V", "GetbarHandler")] -public virtual unsafe void bar () -{ - if (id_bar == IntPtr.Zero) - id_bar = JNIEnv.GetMethodID (class_ref, "bar", "()V"); - try { - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_bar); - } finally { - } -} - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteMethodAsyncifiedWithIntReturn.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteMethodAsyncifiedWithIntReturn.txt deleted file mode 100644 index 0bbf890bb..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteMethodAsyncifiedWithIntReturn.txt +++ /dev/null @@ -1,38 +0,0 @@ -static Delegate cb_bar; -#pragma warning disable 0169 -static Delegate GetbarHandler () -{ - if (cb_bar == null) - cb_bar = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_I) n_bar); - return cb_bar; -} - -static int n_bar (IntPtr jnienv, IntPtr native__this) -{ - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return __this.bar (); -} -#pragma warning restore 0169 - -static IntPtr id_bar; -// Metadata.xml XPath method reference: path="/api/package[@name='com.mypackage']/class[@name='foo']/method[@name='bar' and count(parameter)=0]" -[Register ("bar", "()I", "GetbarHandler")] -public virtual unsafe int bar () -{ - if (id_bar == IntPtr.Zero) - id_bar = JNIEnv.GetMethodID (class_ref, "bar", "()I"); - try { - - if (((object) this).GetType () == ThresholdType) - return JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_bar); - else - return JNIEnv.CallNonvirtualIntMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "bar", "()I")); - } finally { - } -} - -public global::System.Threading.Tasks.Task barAsync () -{ - return global::System.Threading.Tasks.Task.Run (() => bar ()); -} - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteMethodAsyncifiedWithVoidReturn.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteMethodAsyncifiedWithVoidReturn.txt deleted file mode 100644 index 75007ea61..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteMethodAsyncifiedWithVoidReturn.txt +++ /dev/null @@ -1,38 +0,0 @@ -static Delegate cb_bar; -#pragma warning disable 0169 -static Delegate GetbarHandler () -{ - if (cb_bar == null) - cb_bar = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_V) n_bar); - return cb_bar; -} - -static void n_bar (IntPtr jnienv, IntPtr native__this) -{ - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.bar (); -} -#pragma warning restore 0169 - -static IntPtr id_bar; -// Metadata.xml XPath method reference: path="/api/package[@name='com.mypackage']/class[@name='foo']/method[@name='bar' and count(parameter)=0]" -[Register ("bar", "()V", "GetbarHandler")] -public virtual unsafe void bar () -{ - if (id_bar == IntPtr.Zero) - id_bar = JNIEnv.GetMethodID (class_ref, "bar", "()V"); - try { - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_bar); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "bar", "()V")); - } finally { - } -} - -public global::System.Threading.Tasks.Task barAsync () -{ - return global::System.Threading.Tasks.Task.Run (() => bar ()); -} - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteMethodBody.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteMethodBody.txt deleted file mode 100644 index a17b1861a..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteMethodBody.txt +++ /dev/null @@ -1,10 +0,0 @@ -if (id_bar == IntPtr.Zero) - id_bar = JNIEnv.GetMethodID (class_ref, "bar", "()V"); -try { - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_bar); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "bar", "()V")); -} finally { -} diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteMethodFinalWithVoidReturn.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteMethodFinalWithVoidReturn.txt deleted file mode 100644 index a69c7a4f1..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteMethodFinalWithVoidReturn.txt +++ /dev/null @@ -1,13 +0,0 @@ -static IntPtr id_bar; -// Metadata.xml XPath method reference: path="/api/package[@name='com.mypackage']/class[@name='foo']/method[@name='bar' and count(parameter)=0]" -[Register ("bar", "()V", "")] -public unsafe void bar () -{ - if (id_bar == IntPtr.Zero) - id_bar = JNIEnv.GetMethodID (class_ref, "bar", "()V"); - try { - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_bar); - } finally { - } -} - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteMethodIdField.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteMethodIdField.txt deleted file mode 100644 index d3296250d..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteMethodIdField.txt +++ /dev/null @@ -1 +0,0 @@ -static IntPtr id_bar; diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteMethodProtected.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteMethodProtected.txt deleted file mode 100644 index ea87148b8..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteMethodProtected.txt +++ /dev/null @@ -1,33 +0,0 @@ -static Delegate cb_bar; -#pragma warning disable 0169 -static Delegate GetbarHandler () -{ - if (cb_bar == null) - cb_bar = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_V) n_bar); - return cb_bar; -} - -static void n_bar (IntPtr jnienv, IntPtr native__this) -{ - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.bar (); -} -#pragma warning restore 0169 - -static IntPtr id_bar; -// Metadata.xml XPath method reference: path="/api/package[@name='com.mypackage']/class[@name='foo']/method[@name='bar' and count(parameter)=0]" -[Register ("bar", "()V", "GetbarHandler")] -protected virtual unsafe void bar () -{ - if (id_bar == IntPtr.Zero) - id_bar = JNIEnv.GetMethodID (class_ref, "bar", "()V"); - try { - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_bar); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "bar", "()V")); - } finally { - } -} - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteMethodStaticWithVoidReturn.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteMethodStaticWithVoidReturn.txt deleted file mode 100644 index 52b51df85..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteMethodStaticWithVoidReturn.txt +++ /dev/null @@ -1,13 +0,0 @@ -static IntPtr id_bar; -// Metadata.xml XPath method reference: path="/api/package[@name='com.mypackage']/class[@name='foo']/method[@name='bar' and count(parameter)=0]" -[Register ("bar", "()V", "")] -public static unsafe void bar () -{ - if (id_bar == IntPtr.Zero) - id_bar = JNIEnv.GetStaticMethodID (class_ref, "bar", "()V"); - try { - JNIEnv.CallStaticVoidMethod (class_ref, id_bar); - } finally { - } -} - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteMethodWithCharSequenceArrays.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteMethodWithCharSequenceArrays.txt deleted file mode 100644 index fa4246b66..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteMethodWithCharSequenceArrays.txt +++ /dev/null @@ -1,77 +0,0 @@ -// Metadata.xml XPath class reference: path="/api/package[@name='com.example']/class[@name='MyClass']" -[global::Android.Runtime.Register ("com/example/MyClass", DoNotGenerateAcw=true)] -public partial class MyClass : Java.Lang.Object { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("com/example/MyClass", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (MyClass); } - } - - protected MyClass (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static Delegate cb_echo_arrayLjava_lang_CharSequence_; -#pragma warning disable 0169 - static Delegate GetEcho_arrayLjava_lang_CharSequence_Handler () - { - if (cb_echo_arrayLjava_lang_CharSequence_ == null) - cb_echo_arrayLjava_lang_CharSequence_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_L) n_Echo_arrayLjava_lang_CharSequence_); - return cb_echo_arrayLjava_lang_CharSequence_; - } - - static IntPtr n_Echo_arrayLjava_lang_CharSequence_ (IntPtr jnienv, IntPtr native__this, IntPtr native_messages) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var messages = (Java.Lang.ICharSequence[]) JNIEnv.GetArray (native_messages, JniHandleOwnership.DoNotTransfer, typeof (Java.Lang.ICharSequence)); - IntPtr __ret = JNIEnv.NewArray (__this.EchoFormatted (messages)); - if (messages != null) - JNIEnv.CopyArray (messages, native_messages); - return __ret; - } -#pragma warning restore 0169 - - static IntPtr id_echo_arrayLjava_lang_CharSequence_; - // Metadata.xml XPath method reference: path="/api/package[@name='com.example']/class[@name='MyClass']/method[@name='echo' and count(parameter)=1 and parameter[1][@type='java.lang.CharSequence[]']]" - [Register ("echo", "([Ljava/lang/CharSequence;)[Ljava/lang/CharSequence;", "GetEcho_arrayLjava_lang_CharSequence_Handler")] - public virtual unsafe Java.Lang.ICharSequence[] EchoFormatted (Java.Lang.ICharSequence[] messages) - { - if (id_echo_arrayLjava_lang_CharSequence_ == IntPtr.Zero) - id_echo_arrayLjava_lang_CharSequence_ = JNIEnv.GetMethodID (class_ref, "echo", "([Ljava/lang/CharSequence;)[Ljava/lang/CharSequence;"); - IntPtr native_messages = JNIEnv.NewArray (messages); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_messages); - - Java.Lang.ICharSequence[] __ret; - if (((object) this).GetType () == ThresholdType) - __ret = (Java.Lang.ICharSequence[]) JNIEnv.GetArray (JNIEnv.CallObjectMethod (((global::Java.Lang.Object) this).Handle, id_echo_arrayLjava_lang_CharSequence_, __args), JniHandleOwnership.TransferLocalRef, typeof (Java.Lang.ICharSequence)); - else - __ret = (Java.Lang.ICharSequence[]) JNIEnv.GetArray (JNIEnv.CallNonvirtualObjectMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "echo", "([Ljava/lang/CharSequence;)[Ljava/lang/CharSequence;"), __args), JniHandleOwnership.TransferLocalRef, typeof (Java.Lang.ICharSequence)); - return __ret; - } finally { - if (messages != null) { - JNIEnv.CopyArray (native_messages, messages); - JNIEnv.DeleteLocalRef (native_messages); - } - } - } - - public string[] Echo (string[] messages) - { - var jlca_messages = CharSequence.ArrayFromStringArray(messages); - Java.Lang.ICharSequence[] __result = EchoFormatted (jlca_messages); - var __rsval = CharSequence.ArrayToStringArray (__result); - if (jlca_messages != null) foreach (var s in jlca_messages) s?.Dispose (); - return __rsval; - } - -} diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteMethodWithIntReturn.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteMethodWithIntReturn.txt deleted file mode 100644 index 15de7ed1f..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteMethodWithIntReturn.txt +++ /dev/null @@ -1,33 +0,0 @@ -static Delegate cb_bar; -#pragma warning disable 0169 -static Delegate GetbarHandler () -{ - if (cb_bar == null) - cb_bar = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_I) n_bar); - return cb_bar; -} - -static int n_bar (IntPtr jnienv, IntPtr native__this) -{ - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return __this.bar (); -} -#pragma warning restore 0169 - -static IntPtr id_bar; -// Metadata.xml XPath method reference: path="/api/package[@name='com.mypackage']/class[@name='foo']/method[@name='bar' and count(parameter)=0]" -[Register ("bar", "()I", "GetbarHandler")] -public virtual unsafe int bar () -{ - if (id_bar == IntPtr.Zero) - id_bar = JNIEnv.GetMethodID (class_ref, "bar", "()I"); - try { - - if (((object) this).GetType () == ThresholdType) - return JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_bar); - else - return JNIEnv.CallNonvirtualIntMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "bar", "()I")); - } finally { - } -} - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteMethodWithStringReturn.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteMethodWithStringReturn.txt deleted file mode 100644 index 61a711b00..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteMethodWithStringReturn.txt +++ /dev/null @@ -1,33 +0,0 @@ -static Delegate cb_bar; -#pragma warning disable 0169 -static Delegate GetbarHandler () -{ - if (cb_bar == null) - cb_bar = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_L) n_bar); - return cb_bar; -} - -static IntPtr n_bar (IntPtr jnienv, IntPtr native__this) -{ - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return JNIEnv.NewString (__this.bar ()); -} -#pragma warning restore 0169 - -static IntPtr id_bar; -// Metadata.xml XPath method reference: path="/api/package[@name='com.mypackage']/class[@name='foo']/method[@name='bar' and count(parameter)=0]" -[Register ("bar", "()Ljava/lang/String;", "GetbarHandler")] -public virtual unsafe string bar () -{ - if (id_bar == IntPtr.Zero) - id_bar = JNIEnv.GetMethodID (class_ref, "bar", "()Ljava/lang/String;"); - try { - - if (((object) this).GetType () == ThresholdType) - return JNIEnv.GetString (JNIEnv.CallObjectMethod (((global::Java.Lang.Object) this).Handle, id_bar), JniHandleOwnership.TransferLocalRef); - else - return JNIEnv.GetString (JNIEnv.CallNonvirtualObjectMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "bar", "()Ljava/lang/String;")), JniHandleOwnership.TransferLocalRef); - } finally { - } -} - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteMethodWithVoidReturn.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteMethodWithVoidReturn.txt deleted file mode 100644 index ec83f3d74..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteMethodWithVoidReturn.txt +++ /dev/null @@ -1,33 +0,0 @@ -static Delegate cb_bar; -#pragma warning disable 0169 -static Delegate GetbarHandler () -{ - if (cb_bar == null) - cb_bar = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_V) n_bar); - return cb_bar; -} - -static void n_bar (IntPtr jnienv, IntPtr native__this) -{ - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.bar (); -} -#pragma warning restore 0169 - -static IntPtr id_bar; -// Metadata.xml XPath method reference: path="/api/package[@name='com.mypackage']/class[@name='foo']/method[@name='bar' and count(parameter)=0]" -[Register ("bar", "()V", "GetbarHandler")] -public virtual unsafe void bar () -{ - if (id_bar == IntPtr.Zero) - id_bar = JNIEnv.GetMethodID (class_ref, "bar", "()V"); - try { - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_bar); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "bar", "()V")); - } finally { - } -} - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteObjectField.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteObjectField.txt deleted file mode 100644 index 6380d20f4..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteObjectField.txt +++ /dev/null @@ -1,37 +0,0 @@ -// Metadata.xml XPath class reference: path="/api/package[@name='java.code']/class[@name='MyClass']" -[global::Android.Runtime.Register ("java/code/MyClass", DoNotGenerateAcw=true)] -public partial class MyClass { - - - static IntPtr field_jfieldId; - - // Metadata.xml XPath field reference: path="/api/package[@name='java.code']/class[@name='MyClass']/field[@name='field']" - [Register ("field")] - public java.code.Example field { - get { - if (field_jfieldId == IntPtr.Zero) - field_jfieldId = JNIEnv.GetFieldID (class_ref, "field", "Ljava/code/Example;"); - IntPtr __ret = JNIEnv.GetObjectField (((global::Java.Lang.Object) this).Handle, field_jfieldId); - return global::Java.Lang.Object.GetObject (__ret, JniHandleOwnership.TransferLocalRef); - } - set { - if (field_jfieldId == IntPtr.Zero) - field_jfieldId = JNIEnv.GetFieldID (class_ref, "field", "Ljava/code/Example;"); - IntPtr native_value = JNIEnv.ToLocalJniHandle (value); - try { - JNIEnv.SetField (((global::Java.Lang.Object) this).Handle, field_jfieldId, native_value); - } finally { - JNIEnv.DeleteLocalRef (native_value); - } - } - } - internal static IntPtr java_class_handle; - internal static IntPtr class_ref { - get { - return JNIEnv.FindClass ("java/code/MyClass", ref java_class_handle); - } - } - - protected MyClass (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - -} diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteParameterListCallArgs.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteParameterListCallArgs.txt deleted file mode 100644 index 1506c62aa..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteParameterListCallArgs.txt +++ /dev/null @@ -1,4 +0,0 @@ -JValue* __args = stackalloc JValue [3]; -__args [0] = new JValue (value); -__args [1] = new JValue (native_str); -__args [2] = new JValue (flag); diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteParameterListCallArgsForInvoker.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteParameterListCallArgsForInvoker.txt deleted file mode 100644 index 1506c62aa..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteParameterListCallArgsForInvoker.txt +++ /dev/null @@ -1,4 +0,0 @@ -JValue* __args = stackalloc JValue [3]; -__args [0] = new JValue (value); -__args [1] = new JValue (native_str); -__args [2] = new JValue (flag); diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteProperty.txt b/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteProperty.txt deleted file mode 100644 index 3d6fdb31e..000000000 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorExpectedResults/XamarinAndroid/WriteProperty.txt +++ /dev/null @@ -1,67 +0,0 @@ -static Delegate cb_get_MyProperty; -#pragma warning disable 0169 -static Delegate Getget_MyPropertyHandler () -{ - if (cb_get_MyProperty == null) - cb_get_MyProperty = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_I) n_get_MyProperty); - return cb_get_MyProperty; -} - -static int n_get_MyProperty (IntPtr jnienv, IntPtr native__this) -{ - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return __this.MyProperty; -} -#pragma warning restore 0169 - -static Delegate cb_set_MyProperty_I; -#pragma warning disable 0169 -static Delegate Getset_MyProperty_IHandler () -{ - if (cb_set_MyProperty_I == null) - cb_set_MyProperty_I = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPI_V) n_set_MyProperty_I); - return cb_set_MyProperty_I; -} - -static void n_set_MyProperty_I (IntPtr jnienv, IntPtr native__this, int value) -{ - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.MyProperty = value; -} -#pragma warning restore 0169 - -static IntPtr id_get_MyProperty; -static IntPtr id_set_MyProperty_I; -public virtual unsafe int MyProperty { - // Metadata.xml XPath method reference: path="/api/package[@name='com.mypackage']/class[@name='foo']/method[@name='get_MyProperty' and count(parameter)=0]" - [Register ("get_MyProperty", "()I", "Getget_MyPropertyHandler")] - get { - if (id_get_MyProperty == IntPtr.Zero) - id_get_MyProperty = JNIEnv.GetMethodID (class_ref, "get_MyProperty", "()I"); - try { - - if (((object) this).GetType () == ThresholdType) - return JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_get_MyProperty); - else - return JNIEnv.CallNonvirtualIntMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "get_MyProperty", "()I")); - } finally { - } - } - // Metadata.xml XPath method reference: path="/api/package[@name='com.mypackage']/class[@name='foo']/method[@name='set_MyProperty' and count(parameter)=1 and parameter[1][@type='int']]" - [Register ("set_MyProperty", "(I)V", "Getset_MyProperty_IHandler")] - set { - if (id_set_MyProperty_I == IntPtr.Zero) - id_set_MyProperty_I = JNIEnv.GetMethodID (class_ref, "set_MyProperty", "(I)V"); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (value); - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_set_MyProperty_I, __args); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "set_MyProperty", "(I)V"), __args); - } finally { - } - } -} - diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorTestBase.cs b/tests/generator-Tests/Unit-Tests/CodeGeneratorTestBase.cs index 69fb3964f..a54dc94a6 100644 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorTestBase.cs +++ b/tests/generator-Tests/Unit-Tests/CodeGeneratorTestBase.cs @@ -12,7 +12,7 @@ namespace generatortests { abstract class CodeGeneratorTestBase { - protected CodeGenerator generator; + protected JavaInteropCodeGenerator generator; protected StringBuilder builder; protected StringWriter writer; protected CodeGenerationOptions options; diff --git a/tests/generator-Tests/Unit-Tests/CodeGeneratorTests.cs b/tests/generator-Tests/Unit-Tests/CodeGeneratorTests.cs index 7104fc477..c242eb3f3 100644 --- a/tests/generator-Tests/Unit-Tests/CodeGeneratorTests.cs +++ b/tests/generator-Tests/Unit-Tests/CodeGeneratorTests.cs @@ -1343,695 +1343,8 @@ public void StringPropertyOverride ([Values ("true", "false")] string final) } } - [TestFixture] - class XamarinAndroidCodeGeneratorTests : CodeGeneratorTests - { - protected override CodeGenerationTarget Target => CodeGenerationTarget.XamarinAndroid; - - [Test] - public void WriteClassConstructors () - { - var @class = SupportTypeBuilder.CreateClass ("java.code.MyClass", options); - - generator.Context.ContextTypes.Push (@class); - generator.WriteClassConstructors (@class, string.Empty); - generator.Context.ContextTypes.Pop (); - - AssertTargetedExpected (nameof (WriteClassConstructors), writer.ToString ()); - } - - [Test] - public void WriteClassHandle () - { - var @class = new TestClass ("java.lang.Object", "com.mypackage.foo"); - - generator.WriteClassHandle (@class, string.Empty, false); - - AssertTargetedExpected (nameof (WriteClassHandle), writer.ToString ()); - } - - [Test] - public void WriteClassInvoker () - { - var @class = SupportTypeBuilder.CreateClass ("java.code.MyClass", options); - - generator.Context.ContextTypes.Push (@class); - generator.WriteClassInvoker (@class, string.Empty); - generator.Context.ContextTypes.Pop (); - - AssertTargetedExpected (nameof (WriteClassInvoker), writer.ToString ()); - } - - [Test] - public void WriteClassInvokerHandle () - { - var @class = new TestClass ("java.lang.Object", "com.mypackage.foo"); - - generator.WriteClassInvokerHandle (@class, string.Empty, "Com.MyPackage.Foo"); - - AssertTargetedExpected (nameof (WriteClassInvokerHandle), writer.ToString ()); - } - - [Test] - public void WriteClassInvokerMembers () - { - // This test should generate all the members (members is empty) - var @class = SupportTypeBuilder.CreateClass ("java.code.MyClass", options); - var members = new HashSet (); - - generator.Context.ContextTypes.Push (@class); - generator.WriteClassInvokerMembers (@class, string.Empty, members); - generator.Context.ContextTypes.Pop (); - - AssertTargetedExpected (nameof (WriteClassInvokerMembers), writer.ToString ()); - } - - [Test] - public void WriteClassMethodInvokers () - { - // This test should generate all the methods (members is empty) - var @class = SupportTypeBuilder.CreateClass ("java.code.MyClass", options); - var members = new HashSet (); - - generator.Context.ContextTypes.Push (@class); - generator.WriteClassMethodInvokers (@class, @class.Methods, string.Empty, members, null); - generator.Context.ContextTypes.Pop (); - - AssertTargetedExpected (nameof (WriteClassMethodInvokers), writer.ToString ()); - } - - [Test] - public void WriteClassMethodInvokersWithSkips () - { - // This test should skip the first Method because members contains the Method - var @class = SupportTypeBuilder.CreateClass ("java.code.MyClass", options); - var members = new HashSet (new [] { @class.Methods [0].Name }); - - generator.Context.ContextTypes.Push (@class); - generator.WriteClassMethodInvokers (@class, @class.Methods, string.Empty, members, null); - generator.Context.ContextTypes.Pop (); - - AssertTargetedExpected (nameof (WriteClassMethodInvokersWithSkips), writer.ToString ()); - } - - [Test] - public void WriteClassMethods () - { - var @class = SupportTypeBuilder.CreateClass ("java.code.MyClass", options); - - generator.Context.ContextTypes.Push (@class); - generator.WriteClassMethods (@class, string.Empty); - generator.Context.ContextTypes.Pop (); - - AssertTargetedExpected (nameof (WriteClassMethods), writer.ToString ()); - } - - [Test] - public void WriteClassProperties () - { - var @class = SupportTypeBuilder.CreateClass ("java.code.MyClass", options); - - generator.Context.ContextTypes.Push (@class); - generator.WriteImplementedProperties (@class.Properties, string.Empty, @class.IsFinal, @class); - generator.Context.ContextTypes.Pop (); - - AssertTargetedExpected (nameof (WriteClassProperties), writer.ToString ()); - } - - [Test] - public void WriteClassPropertyInvokers () - { - // This test should generate all the properties (members is empty) - var @class = SupportTypeBuilder.CreateClass ("java.code.MyClass", options); - var members = new HashSet (); - - generator.Context.ContextTypes.Push (@class); - generator.WriteClassPropertyInvokers (@class, @class.Properties, string.Empty, members); - generator.Context.ContextTypes.Pop (); - - AssertTargetedExpected (nameof (WriteClassPropertyInvokers), writer.ToString ()); - } - - [Test] - public void WriteClassPropertyInvokersWithSkips () - { - // This test should skip the first Property because members contains the Property - var @class = SupportTypeBuilder.CreateClass ("java.code.MyClass", options); - var members = new HashSet (new [] { @class.Properties [0].Name }); - - generator.Context.ContextTypes.Push (@class); - generator.WriteClassPropertyInvokers (@class, @class.Properties, string.Empty, members); - generator.Context.ContextTypes.Pop (); - - AssertTargetedExpected (nameof (WriteClassPropertyInvokersWithSkips), writer.ToString ()); - } - - [Test] - public void WriteCtor () - { - var @class = new TestClass ("java.lang.Object", "com.mypackage.foo"); - var ctor = new TestCtor (@class, "Object"); - - generator.Context.ContextTypes.Push (@class); - generator.WriteConstructor (ctor, string.Empty, true, @class); - generator.Context.ContextTypes.Pop (); - - AssertTargetedExpected (nameof (WriteCtor), writer.ToString ()); - } - - [Test] - public void WriteCtorDeprecated () - { - var @class = new TestClass ("java.lang.Object", "com.mypackage.foo"); - var ctor = new TestCtor (@class, "Object") - .SetDeprecated ("This constructor is obsolete") - .SetCustomAttributes ("[MyAttribute]") - .SetAnnotation ("[global::Android.Runtime.IntDefinition (null, JniField = \"xamarin/test/SomeObject.SOME_VALUE\")]"); - - generator.Context.ContextTypes.Push (@class); - generator.WriteConstructor (ctor, string.Empty, true, @class); - generator.Context.ContextTypes.Pop (); - - AssertTargetedExpected (nameof (WriteCtorDeprecated), writer.ToString ()); - } - - [Test] - public void WriteCtorWithStringOverload () - { - var @class = new TestClass ("java.lang.Object", "com.mypackage.foo"); - var ctor = new TestCtor (@class, "Object"); - - ctor.Parameters.Add (new Parameter ("mystring", "java.lang.CharSequence", "Java.Lang.ICharSequence", false)); - ctor.Validate (options, null, new CodeGeneratorContext ()); - - generator.Context.ContextTypes.Push (@class); - generator.WriteConstructor (ctor, string.Empty, true, @class); - generator.Context.ContextTypes.Pop (); - - AssertTargetedExpected (nameof (WriteCtorWithStringOverload), writer.ToString ()); - } - - [Test] - public void WriteEnumifiedField () - { - var @class = new TestClass ("java.lang.Object", "com.mypackage.foo"); - var field = new TestField ("int", "bar").SetEnumified (); - Assert.IsTrue (field.Validate (options, new GenericParameterDefinitionList (), new CodeGeneratorContext ()), "field.Validate failed!"); - generator.WriteField (field, string.Empty, @class); - - StringAssert.Contains ("[global::Android.Runtime.GeneratedEnum]", builder.ToString (), "Should contain GeneratedEnumAttribute!"); - } - - [Test] - public void WriteDeprecatedField () - { - var comment = "Don't use this!"; - var @class = new TestClass ("java.lang.Object", "com.mypackage.foo"); - var field = new TestField ("int", "bar").SetConstant ("1234").SetDeprecated (comment, true); - Assert.IsTrue (field.Validate (options, new GenericParameterDefinitionList (), new CodeGeneratorContext ()), "field.Validate failed!"); - generator.WriteField (field, string.Empty, @class); - - StringAssert.Contains ($"[Obsolete (\"{comment}\", error: true)]", builder.ToString (), "Should contain ObsoleteAttribute!"); - } - - [Test] - public void WriteProtectedField () - { - var @class = new TestClass ("java.lang.Object", "com.mypackage.foo"); - var field = new TestField ("int", "bar").SetVisibility ("protected"); - Assert.IsTrue (field.Validate (options, new GenericParameterDefinitionList (), new CodeGeneratorContext ()), "field.Validate failed!"); - generator.WriteField (field, string.Empty, @class); - - StringAssert.Contains ("protected int bar {", builder.ToString (), "Property should be protected!"); - } - - [Test] - public void WriteFieldConstant () - { - var @class = new TestClass ("java.lang.Object", "com.mypackage.foo"); - var field = new TestField ("java.lang.String", "bar").SetConstant (); - - Assert.IsTrue (field.Validate (options, new GenericParameterDefinitionList (), new CodeGeneratorContext ()), "field.Validate failed!"); - generator.WriteField (field, string.Empty, @class); - - AssertTargetedExpected (nameof (WriteFieldConstant), writer.ToString ()); - } - - [Test] - public void WriteFieldConstantWithIntValue () - { - var @class = new TestClass ("java.lang.Object", "com.mypackage.foo"); - var field = new TestField ("int", "bar").SetConstant ("1234"); - - Assert.IsTrue (field.Validate (options, new GenericParameterDefinitionList (), new CodeGeneratorContext ()), "field.Validate failed!"); - generator.WriteField (field, string.Empty, @class); - - AssertTargetedExpected (nameof (WriteFieldConstantWithIntValue), writer.ToString ()); - } - - [Test] - public void WriteFieldConstantWithStringValue () - { - var @class = new TestClass ("java.lang.Object", "com.mypackage.foo"); - var field = new TestField ("java.lang.String", "bar").SetConstant ("\"hello\""); - - Assert.IsTrue (field.Validate (options, new GenericParameterDefinitionList (), new CodeGeneratorContext ()), "field.Validate failed!"); - generator.WriteField (field, string.Empty, @class); - - AssertTargetedExpected (nameof (WriteFieldConstantWithStringValue), writer.ToString ()); - } - - [Test] - public void WriteFieldGetBody () - { - var @class = new TestClass ("java.lang.Object", "com.mypackage.foo"); - var field = new TestField ("java.lang.String", "bar"); - - Assert.IsTrue (field.Validate (options, new GenericParameterDefinitionList (), new CodeGeneratorContext ()), "field.Validate failed!"); - generator.WriteFieldGetBody (field, string.Empty, @class); - - AssertTargetedExpected (nameof (WriteFieldGetBody), writer.ToString ()); - } - - [Test] - public void WriteFieldIdField () - { - var field = new TestField ("java.lang.String", "bar"); - - generator.WriteFieldIdField (field, string.Empty); - - AssertTargetedExpected (nameof (WriteFieldIdField), writer.ToString ()); - } - - [Test] - public void WriteFieldInt () - { - var @class = new TestClass ("java.lang.Object", "com.mypackage.foo"); - var field = new TestField ("int", "bar"); - - Assert.IsTrue (field.Validate (options, new GenericParameterDefinitionList (), new CodeGeneratorContext ()), "field.Validate failed!"); - generator.WriteField (field, string.Empty, @class); - - AssertTargetedExpected (nameof (WriteFieldInt), writer.ToString ()); - } - - [Test] - public void WriteFieldSetBody () - { - var @class = new TestClass ("java.lang.Object", "com.mypackage.foo"); - var field = new TestField ("java.lang.String", "bar"); - - Assert.IsTrue (field.Validate (options, new GenericParameterDefinitionList (), new CodeGeneratorContext ()), "field.Validate failed!"); - generator.WriteFieldSetBody (field, string.Empty, @class); - - AssertTargetedExpected (nameof (WriteFieldSetBody), writer.ToString ()); - } - - [Test] - public void WriteFieldString () - { - var @class = new TestClass ("java.lang.Object", "com.mypackage.foo"); - var field = new TestField ("java.lang.String", "bar"); - - Assert.IsTrue (field.Validate (options, new GenericParameterDefinitionList (), new CodeGeneratorContext ()), "field.Validate failed!"); - generator.WriteField (field, string.Empty, @class); - - AssertTargetedExpected (nameof (WriteFieldString), writer.ToString ()); - } - - [Test] - public void WriteDeprecatedMethod () - { - var comment = "Don't use this!"; - var @class = new TestClass ("java.lang.Object", "com.mypackage.foo"); - var method = new TestMethod (@class, "bar").SetDeprecated (comment); - Assert.IsTrue (method.Validate (options, new GenericParameterDefinitionList (), new CodeGeneratorContext ()), "method.Validate failed!"); - generator.WriteMethod (method, string.Empty, @class, true); - - StringAssert.Contains ($"[Obsolete (@\"{comment}\")]", builder.ToString (), "Should contain ObsoleteAttribute!"); - } - - [Test] - public void WritedMethodWithManagedReturn () - { - var @class = new TestClass ("java.lang.Object", "com.mypackage.foo"); - var method = new TestMethod (@class, "bar", @return: "int").SetManagedReturn ("long"); - Assert.IsTrue (method.Validate (options, new GenericParameterDefinitionList (), new CodeGeneratorContext ()), "method.Validate failed!"); - generator.WriteMethod (method, string.Empty, @class, true); - - StringAssert.Contains ("public virtual unsafe long bar ()", builder.ToString (), "Should contain return long!"); - } - - [Test] - public void WritedMethodWithEnumifiedReturn () - { - var @class = new TestClass ("java.lang.Object", "com.mypackage.foo"); - var method = new TestMethod (@class, "bar", @return: "int").SetManagedReturn ("int").SetReturnEnumified (); - Assert.IsTrue (method.Validate (options, new GenericParameterDefinitionList (), new CodeGeneratorContext ()), "method.Validate failed!"); - generator.WriteMethod (method, string.Empty, @class, true); - - StringAssert.Contains ("[return:global::Android.Runtime.GeneratedEnum]", builder.ToString (), "Should contain GeneratedEnumAttribute!"); - } - - [Test] - public void WriteInterfaceInvoker () - { - var iface = SupportTypeBuilder.CreateInterface ("java.code.IMyInterface", options); - - generator.Context.ContextTypes.Push (iface); - generator.WriteInterfaceInvoker (iface, string.Empty); - generator.Context.ContextTypes.Pop (); - - AssertTargetedExpected (nameof (WriteInterfaceInvoker), writer.ToString ()); - } - - [Test] - public void WriteInterfaceListenerEvent () - { - var iface = SupportTypeBuilder.CreateInterface ("java.code.IMyInterface", options); - - generator.Context.ContextTypes.Push (iface); - generator.WriteInterfaceListenerEvent (iface, string.Empty, "MyName", "MyNameSpec", "MyMethodName", "MyFullDelegateName", true, "MyWrefSuffix", "Add", "Remove"); - generator.Context.ContextTypes.Pop (); - - AssertOriginalExpected (nameof (WriteInterfaceListenerEvent), writer.ToString ()); - } - - [Test] - public void WriteInterfaceListenerEventWithHandlerArgument () - { - var iface = SupportTypeBuilder.CreateInterface ("java.code.IMyInterface", options); - - generator.Context.ContextTypes.Push (iface); - generator.WriteInterfaceListenerEvent (iface, string.Empty, "MyName", "MyNameSpec", "MyMethodName", "MyFullDelegateName", true, "MyWrefSuffix", "AddMyName", "RemoveMyName", true); - generator.Context.ContextTypes.Pop (); - - AssertOriginalExpected (nameof (WriteInterfaceListenerEventWithHandlerArgument), writer.ToString ()); - } - - [Test] - public void WriteInterfaceListenerProperty () - { - var iface = SupportTypeBuilder.CreateInterface ("java.code.IMyInterface", options); - - generator.Context.ContextTypes.Push (iface); - generator.WriteInterfaceListenerProperty (iface, string.Empty, "MyName", "MyNameSpec", "MyMethodName", "MyConnectorFmt", "MyFullDelegateName"); - generator.Context.ContextTypes.Pop (); - - AssertOriginalExpected (nameof (WriteInterfaceListenerProperty), writer.ToString ()); - } - - [Test] - public void WriteInterfaceMethodInvokers () - { - // This test should generate all the methods (members is empty) - var iface = SupportTypeBuilder.CreateInterface ("java.code.IMyInterface", options); - var members = new HashSet (); - - generator.Context.ContextTypes.Push (iface); - generator.WriteInterfaceMethodInvokers (iface, iface.Methods, string.Empty, members); - generator.Context.ContextTypes.Pop (); - - AssertOriginalExpected (nameof (WriteInterfaceMethodInvokers), writer.ToString ()); - } - - [Test] - public void WriteInterfaceMethodInvokersWithSkips () - { - // This test should skip the first Method because members contains the Method - var iface = SupportTypeBuilder.CreateInterface ("java.code.IMyInterface", options); - var members = new HashSet (new [] { iface.Methods [0].Name }); - - generator.Context.ContextTypes.Push (iface); - generator.WriteInterfaceMethodInvokers (iface, iface.Methods, string.Empty, members); - generator.Context.ContextTypes.Pop (); - - AssertOriginalExpected (nameof (WriteInterfaceMethodInvokersWithSkips), writer.ToString ()); - } - - [Test] - public void WriteInterfaceMethods () - { - var iface = SupportTypeBuilder.CreateInterface ("java.code.IMyInterface", options); - - generator.Context.ContextTypes.Push (iface); - generator.WriteInterfaceMethods (iface, string.Empty); - generator.Context.ContextTypes.Pop (); - - AssertOriginalExpected (nameof (WriteInterfaceMethods), writer.ToString ()); - } - - [Test] - public void WriteInterfaceProperties () - { - var iface = SupportTypeBuilder.CreateInterface ("java.code.IMyInterface", options); - - generator.Context.ContextTypes.Push (iface); - generator.WriteInterfaceProperties (iface, string.Empty); - generator.Context.ContextTypes.Pop (); - - AssertOriginalExpected (nameof (WriteInterfaceProperties), writer.ToString ()); - } - - [Test] - public void WriteInterfacePropertyInvokers () - { - // This test should generate all the properties (members is empty) - var iface = SupportTypeBuilder.CreateInterface ("java.code.IMyInterface", options); - var members = new HashSet (); - - generator.Context.ContextTypes.Push (iface); - generator.WriteInterfacePropertyInvokers (iface, iface.Properties, string.Empty, members); - generator.Context.ContextTypes.Pop (); - - AssertOriginalExpected (nameof (WriteInterfacePropertyInvokers), writer.ToString ()); - } - - [Test] - public void WriteInterfacePropertyInvokersWithSkips () - { - // This test should skip the first Property because members contains the Property - var iface = SupportTypeBuilder.CreateInterface ("java.code.IMyInterface", options); - var members = new HashSet (new [] { iface.Properties [0].Name }); - - generator.Context.ContextTypes.Push (iface); - generator.WriteInterfacePropertyInvokers (iface, iface.Properties, string.Empty, members); - generator.Context.ContextTypes.Pop (); - - AssertOriginalExpected (nameof (WriteInterfacePropertyInvokersWithSkips), writer.ToString ()); - } - - [Test] - public void WriteMethodAbstractWithVoidReturn () - { - var @class = new TestClass ("java.lang.Object", "com.mypackage.foo"); - var method = new TestMethod (@class, "bar").SetAbstract (); - - Assert.IsTrue (method.Validate (options, new GenericParameterDefinitionList (), new CodeGeneratorContext ()), "method.Validate failed!"); - generator.WriteMethod (method, string.Empty, @class, true); - - AssertTargetedExpected (nameof (WriteMethodAbstractWithVoidReturn), writer.ToString ()); - } - - [Test] - public void WriteMethodAsyncifiedWithIntReturn () - { - var @class = new TestClass ("java.lang.Object", "com.mypackage.foo"); - var method = new TestMethod (@class, "bar", @return: "int").SetAsyncify (); - - Assert.IsTrue (method.Validate (options, new GenericParameterDefinitionList (), new CodeGeneratorContext ()), "method.Validate failed!"); - generator.WriteMethod (method, string.Empty, @class, true); - - AssertTargetedExpected (nameof (WriteMethodAsyncifiedWithIntReturn), writer.ToString ()); - } - - [Test] - public void WriteMethodAsyncifiedWithVoidReturn () - { - var @class = new TestClass ("java.lang.Object", "com.mypackage.foo"); - var method = new TestMethod (@class, "bar").SetAsyncify (); - - Assert.IsTrue (method.Validate (options, new GenericParameterDefinitionList (), new CodeGeneratorContext ()), "method.Validate failed!"); - generator.WriteMethod (method, string.Empty, @class, true); - - AssertTargetedExpected (nameof (WriteMethodAsyncifiedWithVoidReturn), writer.ToString ()); - } - - [Test] - public void WriteMethodBody () - { - var @class = new TestClass ("java.lang.Object", "com.mypackage.foo"); - var method = new TestMethod (@class, "bar"); - - Assert.IsTrue (method.Validate (options, new GenericParameterDefinitionList (), new CodeGeneratorContext ()), "method.Validate failed!"); - generator.WriteMethodBody (method, string.Empty, @class); - - AssertTargetedExpected (nameof (WriteMethodBody), writer.ToString ()); - } - - [Test] - public void WriteMethodFinalWithVoidReturn () - { - var @class = new TestClass ("java.lang.Object", "com.mypackage.foo"); - var method = new TestMethod (@class, "bar").SetFinal (); - - Assert.IsTrue (method.Validate (options, new GenericParameterDefinitionList (), new CodeGeneratorContext ()), "method.Validate failed!"); - generator.WriteMethod (method, string.Empty, @class, true); - - AssertTargetedExpected (nameof (WriteMethodFinalWithVoidReturn), writer.ToString ()); - } - - [Test] - public void WriteMethodIdField () - { - var @class = new TestClass ("java.lang.Object", "com.mypackage.foo"); - var method = new TestMethod (@class, "bar"); - - generator.WriteMethodIdField (method, string.Empty); - - AssertTargetedExpected (nameof (WriteMethodIdField), writer.ToString ()); - } - - [Test] - public void WriteMethodProtected () - { - var @class = new TestClass ("java.lang.Object", "com.mypackage.foo"); - var method = new TestMethod (@class, "bar").SetVisibility ("protected"); - - Assert.IsTrue (method.Validate (options, new GenericParameterDefinitionList (), new CodeGeneratorContext ()), "method.Validate failed!"); - generator.WriteMethod (method, string.Empty, @class, true); - - AssertTargetedExpected (nameof (WriteMethodProtected), writer.ToString ()); - } - - [Test] - public void WriteMethodStaticWithVoidReturn () - { - var @class = new TestClass ("java.lang.Object", "com.mypackage.foo"); - var method = new TestMethod (@class, "bar").SetStatic (); - - Assert.IsTrue (method.Validate (options, new GenericParameterDefinitionList (), new CodeGeneratorContext ()), "method.Validate failed!"); - generator.WriteMethod (method, string.Empty, @class, true); - - AssertTargetedExpected (nameof (WriteMethodStaticWithVoidReturn), writer.ToString ()); - } - - [Test] - public void WriteMethodWithIntReturn () - { - var @class = new TestClass ("java.lang.Object", "com.mypackage.foo"); - var method = new TestMethod (@class, "bar", @return: "int"); - - Assert.IsTrue (method.Validate (options, new GenericParameterDefinitionList (), new CodeGeneratorContext ()), "method.Validate failed!"); - generator.WriteMethod (method, string.Empty, @class, true); - - AssertTargetedExpected (nameof (WriteMethodWithIntReturn), writer.ToString ()); - } - - [Test] - public void WriteMethodWithStringReturn () - { - var @class = new TestClass ("java.lang.Object", "com.mypackage.foo"); - var method = new TestMethod (@class, "bar", @return: "java.lang.String"); - - Assert.IsTrue (method.Validate (options, new GenericParameterDefinitionList (), new CodeGeneratorContext ()), "method.Validate failed!"); - generator.WriteMethod (method, string.Empty, @class, true); - - AssertTargetedExpected (nameof (WriteMethodWithStringReturn), writer.ToString ()); - } - - [Test] - public void WriteMethodWithVoidReturn () - { - var @class = new TestClass ("java.lang.Object", "com.mypackage.foo"); - var method = new TestMethod (@class, "bar"); - - Assert.IsTrue (method.Validate (options, new GenericParameterDefinitionList (), new CodeGeneratorContext ()), "method.Validate failed!"); - generator.WriteMethod (method, string.Empty, @class, true); - - AssertTargetedExpected (nameof (WriteMethodWithVoidReturn), writer.ToString ()); - } - - [Test] - public void WriteMethodWithInvalidJavaName () - { - var @class = new TestClass ("java.lang.Object", "com.mypackage.foo"); - var method = new TestMethod (@class, "has-hyp$hen"); - - method.Name = "nohyphen"; - - Assert.IsTrue (method.Validate (options, new GenericParameterDefinitionList (), new CodeGeneratorContext ()), "method.Validate failed!"); - generator.WriteMethod (method, string.Empty, @class, true); - - var result = writer.ToString ().NormalizeLineEndings (); - - // Ensure we escape hyphens/dollar signs in callback names - Assert.False (result.Contains ("cb_has-hyp$hen")); - Assert.True (result.Contains ("cb_has_x45_hyp_x36_hen")); - } - - [Test] - public void WriteMethodWithInvalidParameterName () - { - var @class = new TestClass ("java.lang.Object", "com.mypackage.foo"); - var method = new TestMethod (@class, "DoStuff"); - - method.Parameters.Add (new Parameter ("$this", "byte[]", "byte[]", false)); - - Assert.IsTrue (method.Validate (options, new GenericParameterDefinitionList (), new CodeGeneratorContext ()), "method.Validate failed!"); - generator.WriteMethod (method, string.Empty, @class, true); - - var result = writer.ToString ().NormalizeLineEndings (); - - // Ensure we escape dollar signs - Assert.False (result.Contains ("$this")); - } - - [Test] - public void WriteInterfaceExtensionsDeclaration () - { - var iface = SupportTypeBuilder.CreateInterface ("java.code.IMyInterface", options); - - generator.Context.ContextTypes.Push (iface); - generator.WriteInterfaceExtensionsDeclaration (iface, string.Empty, "java.code.DeclaringType"); - generator.Context.ContextTypes.Pop (); - - Assert.AreEqual (GetExpected (nameof (WriteInterfaceExtensionsDeclaration)), writer.ToString ().NormalizeLineEndings ()); - } - - [Test] - public void WriteInterfaceDeclaration () - { - var iface = SupportTypeBuilder.CreateInterface ("java.code.IMyInterface", options); - - generator.Context.ContextTypes.Push (iface); - generator.WriteInterfaceDeclaration (iface, string.Empty, new GenerationInfo (null, null, null)); - generator.Context.ContextTypes.Pop (); - - AssertTargetedExpected (nameof (WriteInterfaceDeclaration), writer.ToString ()); - } - - [Test] - public void WriteProperty () - { - var @class = SupportTypeBuilder.CreateClassWithProperty ("java.lang.Object", "com.mypackage.foo", "MyProperty", "int", options); - - generator.WriteProperty (@class.Properties.First (), @class, string.Empty); - - AssertTargetedExpected (nameof (WriteProperty), writer.ToString ()); - } - } - abstract class CodeGeneratorTests : CodeGeneratorTestBase { - [Test] - public void WriteCharSequenceEnumerator () - { - generator.WriteCharSequenceEnumerator (string.Empty); - - Assert.AreEqual (GetExpected (nameof (WriteCharSequenceEnumerator)), writer.ToString ().NormalizeLineEndings ()); - } - [Test] public void WriteClass () { @@ -2044,18 +1357,6 @@ public void WriteClass () AssertTargetedExpected (nameof (WriteClass), writer.ToString ()); } - [Test] - public void WriteClassAbstractMembers () - { - var @class = SupportTypeBuilder.CreateClass ("java.code.MyClass", options); - - generator.Context.ContextTypes.Push (@class); - generator.WriteClassAbstractMembers (@class, string.Empty); - generator.Context.ContextTypes.Pop (); - - Assert.AreEqual (GetExpected (nameof (WriteClassAbstractMembers)), writer.ToString ().NormalizeLineEndings ()); - } - [Test] public void WriteObjectField () { @@ -2089,99 +1390,6 @@ public void WriteInterface () AssertTargetedExpected (nameof (WriteInterface), writer.ToString ()); } - [Test] - public void WriteInterfaceExtensionMethods () - { - var iface = SupportTypeBuilder.CreateInterface ("java.code.IMyInterface", options); - - generator.Context.ContextTypes.Push (iface); - generator.WriteInterfaceExtensionMethods (iface, string.Empty); - generator.Context.ContextTypes.Pop (); - - Assert.AreEqual (GetExpected (nameof (WriteInterfaceExtensionMethods)), writer.ToString ().NormalizeLineEndings ()); - } - - [Test] - public void WriteInterfaceEventArgs () - { - var iface = SupportTypeBuilder.CreateInterface ("java.code.IMyInterface", options); - - generator.Context.ContextTypes.Push (iface); - generator.WriteInterfaceEventArgs (iface, iface.Methods [0], string.Empty); - generator.Context.ContextTypes.Pop (); - - WriteActualContents (nameof (WriteInterfaceEventArgs), writer.ToString ()); - - Assert.AreEqual (GetExpected (nameof (WriteInterfaceEventArgs)), writer.ToString ().NormalizeLineEndings ()); - } - - [Test] - public void WriteInterfaceEventArgsWithParamArray () - { - var xml = @" - - - - - - - - - - - "; - - var gens = ParseApiDefinition (xml); - var iface = gens.Single (g => g.Name == "IMyListener"); - - generator.Context.ContextTypes.Push (iface); - generator.WriteInterfaceEventArgs (iface as InterfaceGen, iface.Methods [0], string.Empty); - generator.Context.ContextTypes.Pop (); - - WriteActualContents (nameof (WriteInterfaceEventArgsWithParamArray), writer.ToString ()); - - Assert.AreEqual (GetExpected (nameof (WriteInterfaceEventArgsWithParamArray)), writer.ToString ().NormalizeLineEndings ()); - } - - [Test] - public void WriteInterfaceEventHandler () - { - var iface = SupportTypeBuilder.CreateInterface ("java.code.IMyInterface", options); - - generator.Context.ContextTypes.Push (iface); - generator.WriteInterfaceEventHandler (iface, string.Empty); - generator.Context.ContextTypes.Pop (); - - AssertOriginalExpected (nameof (WriteInterfaceEventHandler), writer.ToString ()); - } - - [Test] - public void WriteInterfaceEventHandlerImpl () - { - var iface = SupportTypeBuilder.CreateInterface ("java.code.IMyInterface", options); - - generator.Context.ContextTypes.Push (iface); - generator.WriteInterfaceEventHandlerImpl (iface, string.Empty); - generator.Context.ContextTypes.Pop (); - - AssertOriginalExpected (nameof (WriteInterfaceEventHandlerImpl), writer.ToString ()); - } - - [Test] - public void WriteInterfaceEventHandlerImplContent () - { - var iface = SupportTypeBuilder.CreateInterface ("java.code.IMyInterface", options); - var handlers = new List (); - - generator.Context.ContextTypes.Push (iface); - generator.WriteInterfaceEventHandlerImplContent (iface, iface.Methods [0], string.Empty, true, string.Empty, handlers); - generator.Context.ContextTypes.Pop (); - - Assert.AreEqual (1, handlers.Count); - Assert.AreEqual ("GetCountForKey", handlers [0]); - AssertOriginalExpected (nameof (WriteInterfaceEventHandlerImplContent), writer.ToString ()); - } - [Test] public void WriteMethodWithCharSequenceArrays () { @@ -2209,78 +1417,6 @@ public void WriteMethodWithCharSequenceArrays () AssertOriginalTargetExpected (nameof (WriteMethodWithCharSequenceArrays), writer.ToString ()); } - [Test] - public void WriteParameterListCallArgs () - { - var list = SupportTypeBuilder.CreateParameterList (options); - - generator.WriteParameterListCallArgs (list, string.Empty, false); - - AssertTargetedExpected (nameof (WriteParameterListCallArgs), writer.ToString ()); - } - - [Test] - public void WriteParameterListCallArgsForInvoker () - { - var list = SupportTypeBuilder.CreateParameterList (options); - - generator.WriteParameterListCallArgs (list, string.Empty, true); - - AssertTargetedExpected (nameof (WriteParameterListCallArgsForInvoker), writer.ToString ()); - } - - [Test] - public void WritePropertyAbstractDeclaration () - { - var @class = SupportTypeBuilder.CreateClassWithProperty ("java.lang.Object", "com.mypackage.foo", "MyProperty", "int", options); - - generator.WritePropertyAbstractDeclaration (@class.Properties.First (), string.Empty, @class); - - AssertOriginalExpected (nameof (WritePropertyAbstractDeclaration), writer.ToString ()); - } - - [Test] - public void WritePropertyCallbacks () - { - var @class = SupportTypeBuilder.CreateClassWithProperty ("java.lang.Object", "com.mypackage.foo", "MyProperty", "int", options); - - generator.WritePropertyCallbacks (@class.Properties.First (), string.Empty, @class); - - AssertOriginalExpected (nameof (WritePropertyCallbacks), writer.ToString ()); - } - - [Test] - public void WritePropertyDeclaration () - { - var @class = SupportTypeBuilder.CreateClassWithProperty ("java.lang.Object", "com.mypackage.foo", "MyProperty", "int", options); - - generator.WritePropertyDeclaration (@class.Properties.First (), string.Empty, @class, "ObjectAdapter"); - - AssertOriginalExpected (nameof (WritePropertyDeclaration), writer.ToString ()); - } - - [Test] - public void WritePropertyStringVariant () - { - var @class = SupportTypeBuilder.CreateClassWithProperty ("java.lang.Object", "com.mypackage.foo", "MyProperty", "int", options); - - generator.WritePropertyStringVariant (@class.Properties.First (), string.Empty); - - AssertOriginalExpected (nameof (WritePropertyStringVariant), writer.ToString ()); - } - - [Test] - public void WritePropertyInvoker () - { - var @class = SupportTypeBuilder.CreateClassWithProperty ("java.lang.Object", "com.mypackage.foo", "MyProperty", "int", options); - - generator.Context.ContextTypes.Push (@class); - generator.WritePropertyInvoker (@class.Properties.First (), string.Empty, @class); - generator.Context.ContextTypes.Pop (); - - AssertOriginalExpected (nameof (WritePropertyInvoker), writer.ToString ()); - } - [Test] public void WritePropertyExplicitInterfaceParameterName () { diff --git a/tests/generator-Tests/Unit-Tests/EnumGeneratorExpectedResults/WriteBasicEnum.txt b/tests/generator-Tests/Unit-Tests/EnumGeneratorExpectedResults/WriteBasicEnum.txt index 61405949e..7ec7750b8 100644 --- a/tests/generator-Tests/Unit-Tests/EnumGeneratorExpectedResults/WriteBasicEnum.txt +++ b/tests/generator-Tests/Unit-Tests/EnumGeneratorExpectedResults/WriteBasicEnum.txt @@ -1,8 +1,13 @@ -namespace Android.App { - public enum RecentTaskFlags { - [global::Android.Runtime.IntDefinition (null, JniField = "android/app/ActivityManager.RECENT_IGNORE_UNAVAILABLE")] - WithExcluded = 1, - [global::Android.Runtime.IntDefinition (null, JniField = "android/app/ActivityManager.RECENT_WITH_EXCLUDED")] - IgnoreUnavailable = 2, - } +namespace Android.App +{ +public enum RecentTaskFlags +{ + [global::Android.Runtime.IntDefinition (null, JniField = "android/app/ActivityManager.RECENT_IGNORE_UNAVAILABLE")] + [global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android30.0")] + WithExcluded = 1, + + [global::Android.Runtime.IntDefinition (null, JniField = "android/app/ActivityManager.RECENT_WITH_EXCLUDED")] + IgnoreUnavailable = 2, + +} } diff --git a/tests/generator-Tests/Unit-Tests/EnumGeneratorExpectedResults/WriteEnumWithGens.txt b/tests/generator-Tests/Unit-Tests/EnumGeneratorExpectedResults/WriteEnumWithGens.txt index 3981363fb..5d437326f 100644 --- a/tests/generator-Tests/Unit-Tests/EnumGeneratorExpectedResults/WriteEnumWithGens.txt +++ b/tests/generator-Tests/Unit-Tests/EnumGeneratorExpectedResults/WriteEnumWithGens.txt @@ -1,8 +1,13 @@ -namespace Android.App { - public enum RecentTaskFlags { - [global::Android.Runtime.IntDefinition ("android.app.ActivityManager.RECENT_IGNORE_UNAVAILABLE", JniField = "android/app/ActivityManager.RECENT_IGNORE_UNAVAILABLE")] - WithExcluded = 1, - [global::Android.Runtime.IntDefinition (null, JniField = "android/app/ActivityManager.RECENT_WITH_EXCLUDED")] - IgnoreUnavailable = 2, - } +namespace Android.App +{ +public enum RecentTaskFlags +{ + [global::Android.Runtime.IntDefinition ("android.app.ActivityManager.RECENT_IGNORE_UNAVAILABLE", JniField = "android/app/ActivityManager.RECENT_IGNORE_UNAVAILABLE")] + [global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android30.0")] + WithExcluded = 1, + + [global::Android.Runtime.IntDefinition (null, JniField = "android/app/ActivityManager.RECENT_WITH_EXCLUDED")] + IgnoreUnavailable = 2, + +} } diff --git a/tests/generator-Tests/Unit-Tests/EnumGeneratorExpectedResults/WriteFlagsEnum.txt b/tests/generator-Tests/Unit-Tests/EnumGeneratorExpectedResults/WriteFlagsEnum.txt index cab0c3822..6f6bbc154 100644 --- a/tests/generator-Tests/Unit-Tests/EnumGeneratorExpectedResults/WriteFlagsEnum.txt +++ b/tests/generator-Tests/Unit-Tests/EnumGeneratorExpectedResults/WriteFlagsEnum.txt @@ -1,9 +1,14 @@ -namespace Android.App { - [System.Flags] - public enum RecentTaskFlags { - [global::Android.Runtime.IntDefinition (null, JniField = "android/app/ActivityManager.RECENT_IGNORE_UNAVAILABLE")] - WithExcluded = 1, - [global::Android.Runtime.IntDefinition (null, JniField = "android/app/ActivityManager.RECENT_WITH_EXCLUDED")] - IgnoreUnavailable = 2, - } +namespace Android.App +{ +[System.Flags] +public enum RecentTaskFlags +{ + [global::Android.Runtime.IntDefinition (null, JniField = "android/app/ActivityManager.RECENT_IGNORE_UNAVAILABLE")] + [global::System.Runtime.Versioning.SupportedOSPlatformAttribute ("android30.0")] + WithExcluded = 1, + + [global::Android.Runtime.IntDefinition (null, JniField = "android/app/ActivityManager.RECENT_WITH_EXCLUDED")] + IgnoreUnavailable = 2, + +} } diff --git a/tests/generator-Tests/Unit-Tests/InterfaceConstantsTests.cs b/tests/generator-Tests/Unit-Tests/InterfaceConstantsTests.cs index c03a818dd..0b3124b31 100644 --- a/tests/generator-Tests/Unit-Tests/InterfaceConstantsTests.cs +++ b/tests/generator-Tests/Unit-Tests/InterfaceConstantsTests.cs @@ -10,30 +10,6 @@ class XAJavaInteropInterfaceConstantsTests : InterfaceConstantsTests protected override Xamarin.Android.Binder.CodeGenerationTarget Target => Xamarin.Android.Binder.CodeGenerationTarget.XAJavaInterop1; } - [TestFixture] - class XamarinAndroidInterfaceConstantsTests : InterfaceConstantsTests - { - protected override Xamarin.Android.Binder.CodeGenerationTarget Target => Xamarin.Android.Binder.CodeGenerationTarget.XamarinAndroid; - - [Test] - public void WriteInterfaceFields () - { - // This is an interface that has both fields and method declarations - var iface = SupportTypeBuilder.CreateEmptyInterface ("java.code.IMyInterface"); - - iface.Fields.Add (new TestField ("int", "MyConstantField").SetConstant ().SetValue ("7")); - iface.Methods.Add (new TestMethod (iface, "DoSomething").SetAbstract ()); - - iface.Validate (options, new GenericParameterDefinitionList (), new CodeGeneratorContext ()); - - generator.Context.ContextTypes.Push (iface); - generator.WriteInterfaceDeclaration (iface, string.Empty, new GenerationInfo (null, null, null)); - generator.Context.ContextTypes.Pop (); - - Assert.AreEqual (GetTargetedExpected (nameof (WriteInterfaceFields)), writer.ToString ().NormalizeLineEndings ()); - } - } - abstract class InterfaceConstantsTests : CodeGeneratorTestBase { protected override CodeGenerationOptions CreateOptions () @@ -71,7 +47,7 @@ public void WriteConstSugarInterfaceFields () iface.Validate (options, new GenericParameterDefinitionList (), new CodeGeneratorContext ()); generator.Context.ContextTypes.Push (iface); - generator.WriteInterfaceDeclaration (iface, string.Empty, new GenerationInfo (null, null, null)); + generator.WriteType (iface, string.Empty, new GenerationInfo (null, null, null)); generator.Context.ContextTypes.Pop (); Assert.AreEqual (GetTargetedExpected (nameof (WriteConstSugarInterfaceFields)), writer.ToString ().NormalizeLineEndings ()); diff --git a/tests/generator-Tests/Unit-Tests/SourceWriters/PeerMembersFieldTests.cs b/tests/generator-Tests/Unit-Tests/SourceWriters/PeerMembersFieldTests.cs index d194f4963..947ae59be 100644 --- a/tests/generator-Tests/Unit-Tests/SourceWriters/PeerMembersFieldTests.cs +++ b/tests/generator-Tests/Unit-Tests/SourceWriters/PeerMembersFieldTests.cs @@ -11,7 +11,7 @@ public class PeerMembersFieldTests : SourceWritersTestBase [Test] public void PeerMembersField_Class () { - var field = new PeerMembersField (new CodeGenerationOptions (), "B", "MyJavaType", false); + var field = new PeerMembersField (new CodeGenerationOptions { CodeGenerationTarget = CodeGenerationTarget.JavaInterop1 }, "B", "MyJavaType", false); Assert.AreEqual ("static readonly JniPeerMembers _members = new JniPeerMembers (\"B\", typeof (MyJavaType));", GetOutput (field).Trim ()); } diff --git a/tests/generator-Tests/expected/AccessModifiers/AccessModifiers.xml b/tests/generator-Tests/expected.ji/AccessModifiers/AccessModifiers.xml similarity index 100% rename from tests/generator-Tests/expected/AccessModifiers/AccessModifiers.xml rename to tests/generator-Tests/expected.ji/AccessModifiers/AccessModifiers.xml diff --git a/tests/generator-Tests/expected/Adapters/Adapters.xml b/tests/generator-Tests/expected.ji/Adapters/Adapters.xml similarity index 100% rename from tests/generator-Tests/expected/Adapters/Adapters.xml rename to tests/generator-Tests/expected.ji/Adapters/Adapters.xml diff --git a/tests/generator-Tests/expected/Adapters/SupportFiles/AdapterView.cs b/tests/generator-Tests/expected.ji/Adapters/SupportFiles/AdapterView.cs similarity index 100% rename from tests/generator-Tests/expected/Adapters/SupportFiles/AdapterView.cs rename to tests/generator-Tests/expected.ji/Adapters/SupportFiles/AdapterView.cs diff --git a/tests/generator-Tests/expected/Android.Graphics.Color/Android.Graphics.Color.xml b/tests/generator-Tests/expected.ji/Android.Graphics.Color/Android.Graphics.Color.xml similarity index 100% rename from tests/generator-Tests/expected/Android.Graphics.Color/Android.Graphics.Color.xml rename to tests/generator-Tests/expected.ji/Android.Graphics.Color/Android.Graphics.Color.xml diff --git a/tests/generator-Tests/expected/Arrays/Arrays.xml b/tests/generator-Tests/expected.ji/Arrays/Arrays.xml similarity index 100% rename from tests/generator-Tests/expected/Arrays/Arrays.xml rename to tests/generator-Tests/expected.ji/Arrays/Arrays.xml diff --git a/tests/generator-Tests/expected.ji/CSharpKeywords/CSharpKeywords.xml b/tests/generator-Tests/expected.ji/CSharpKeywords/CSharpKeywords.xml index 52d6f43cd..9ceb7d5b7 100644 --- a/tests/generator-Tests/expected.ji/CSharpKeywords/CSharpKeywords.xml +++ b/tests/generator-Tests/expected.ji/CSharpKeywords/CSharpKeywords.xml @@ -9,10 +9,12 @@ - + - - + + + + diff --git a/tests/generator-Tests/expected/Constructors/Constructors.xml b/tests/generator-Tests/expected.ji/Constructors/Constructors.xml similarity index 100% rename from tests/generator-Tests/expected/Constructors/Constructors.xml rename to tests/generator-Tests/expected.ji/Constructors/Constructors.xml diff --git a/tests/generator-Tests/expected/Core_ClassParse/api.xml b/tests/generator-Tests/expected.ji/Core_ClassParse/api.xml similarity index 100% rename from tests/generator-Tests/expected/Core_ClassParse/api.xml rename to tests/generator-Tests/expected.ji/Core_ClassParse/api.xml diff --git a/tests/generator-Tests/expected/Core_ClassParse/metadata.xml b/tests/generator-Tests/expected.ji/Core_ClassParse/metadata.xml similarity index 100% rename from tests/generator-Tests/expected/Core_ClassParse/metadata.xml rename to tests/generator-Tests/expected.ji/Core_ClassParse/metadata.xml diff --git a/tests/generator-Tests/expected/Core_Jar2Xml/api.xml b/tests/generator-Tests/expected.ji/Core_Jar2Xml/api.xml similarity index 100% rename from tests/generator-Tests/expected/Core_Jar2Xml/api.xml rename to tests/generator-Tests/expected.ji/Core_Jar2Xml/api.xml diff --git a/tests/generator-Tests/expected/Core_Jar2Xml/fields.xml b/tests/generator-Tests/expected.ji/Core_Jar2Xml/fields.xml similarity index 100% rename from tests/generator-Tests/expected/Core_Jar2Xml/fields.xml rename to tests/generator-Tests/expected.ji/Core_Jar2Xml/fields.xml diff --git a/tests/generator-Tests/expected/Core_Jar2Xml/methods.xml b/tests/generator-Tests/expected.ji/Core_Jar2Xml/methods.xml similarity index 100% rename from tests/generator-Tests/expected/Core_Jar2Xml/methods.xml rename to tests/generator-Tests/expected.ji/Core_Jar2Xml/methods.xml diff --git a/tests/generator-Tests/expected.ji/InterfaceMethodsConflict/InterfaceMethodsConflict.xml b/tests/generator-Tests/expected.ji/InterfaceMethodsConflict/InterfaceMethodsConflict.xml index 703f91b24..e83a6e37a 100644 --- a/tests/generator-Tests/expected.ji/InterfaceMethodsConflict/InterfaceMethodsConflict.xml +++ b/tests/generator-Tests/expected.ji/InterfaceMethodsConflict/InterfaceMethodsConflict.xml @@ -1,9 +1,9 @@  - - + + - + @@ -13,10 +13,20 @@ - + + + + + + + + + diff --git a/tests/generator-Tests/expected/NestedTypes/NestedTypes.xml b/tests/generator-Tests/expected.ji/NestedTypes/NestedTypes.xml similarity index 100% rename from tests/generator-Tests/expected/NestedTypes/NestedTypes.xml rename to tests/generator-Tests/expected.ji/NestedTypes/NestedTypes.xml diff --git a/tests/generator-Tests/expected/NonStaticFields/NonStaticField.xml b/tests/generator-Tests/expected.ji/NonStaticFields/NonStaticField.xml similarity index 100% rename from tests/generator-Tests/expected/NonStaticFields/NonStaticField.xml rename to tests/generator-Tests/expected.ji/NonStaticFields/NonStaticField.xml diff --git a/tests/generator-Tests/expected/NormalMethods/NormalMethods.xml b/tests/generator-Tests/expected.ji/NormalMethods/NormalMethods.xml similarity index 100% rename from tests/generator-Tests/expected/NormalMethods/NormalMethods.xml rename to tests/generator-Tests/expected.ji/NormalMethods/NormalMethods.xml diff --git a/tests/generator-Tests/expected/NormalProperties/NormalProperties.xml b/tests/generator-Tests/expected.ji/NormalProperties/NormalProperties.xml similarity index 100% rename from tests/generator-Tests/expected/NormalProperties/NormalProperties.xml rename to tests/generator-Tests/expected.ji/NormalProperties/NormalProperties.xml diff --git a/tests/generator-Tests/expected/ParameterXPath/ParameterXPath.xml b/tests/generator-Tests/expected.ji/ParameterXPath/ParameterXPath.xml similarity index 100% rename from tests/generator-Tests/expected/ParameterXPath/ParameterXPath.xml rename to tests/generator-Tests/expected.ji/ParameterXPath/ParameterXPath.xml diff --git a/tests/generator-Tests/expected/StaticFields/StaticField.xml b/tests/generator-Tests/expected.ji/StaticFields/StaticField.xml similarity index 100% rename from tests/generator-Tests/expected/StaticFields/StaticField.xml rename to tests/generator-Tests/expected.ji/StaticFields/StaticField.xml diff --git a/tests/generator-Tests/expected/StaticMethods/StaticMethod.xml b/tests/generator-Tests/expected.ji/StaticMethods/StaticMethod.xml similarity index 100% rename from tests/generator-Tests/expected/StaticMethods/StaticMethod.xml rename to tests/generator-Tests/expected.ji/StaticMethods/StaticMethod.xml diff --git a/tests/generator-Tests/expected/StaticProperties/StaticProperties.xml b/tests/generator-Tests/expected.ji/StaticProperties/StaticProperties.xml similarity index 100% rename from tests/generator-Tests/expected/StaticProperties/StaticProperties.xml rename to tests/generator-Tests/expected.ji/StaticProperties/StaticProperties.xml diff --git a/tests/generator-Tests/expected/Streams/Streams.xml b/tests/generator-Tests/expected.ji/Streams/Streams.xml similarity index 100% rename from tests/generator-Tests/expected/Streams/Streams.xml rename to tests/generator-Tests/expected.ji/Streams/Streams.xml diff --git a/tests/generator-Tests/expected/Streams/SupportFiles/InputStreamAdapter.cs b/tests/generator-Tests/expected.ji/Streams/SupportFiles/InputStreamAdapter.cs similarity index 100% rename from tests/generator-Tests/expected/Streams/SupportFiles/InputStreamAdapter.cs rename to tests/generator-Tests/expected.ji/Streams/SupportFiles/InputStreamAdapter.cs diff --git a/tests/generator-Tests/expected/Streams/SupportFiles/InputStreamInvoker.cs b/tests/generator-Tests/expected.ji/Streams/SupportFiles/InputStreamInvoker.cs similarity index 100% rename from tests/generator-Tests/expected/Streams/SupportFiles/InputStreamInvoker.cs rename to tests/generator-Tests/expected.ji/Streams/SupportFiles/InputStreamInvoker.cs diff --git a/tests/generator-Tests/expected/Streams/SupportFiles/OutputStreamAdapter.cs b/tests/generator-Tests/expected.ji/Streams/SupportFiles/OutputStreamAdapter.cs similarity index 100% rename from tests/generator-Tests/expected/Streams/SupportFiles/OutputStreamAdapter.cs rename to tests/generator-Tests/expected.ji/Streams/SupportFiles/OutputStreamAdapter.cs diff --git a/tests/generator-Tests/expected/Streams/SupportFiles/OutputStreamInvoker.cs b/tests/generator-Tests/expected.ji/Streams/SupportFiles/OutputStreamInvoker.cs similarity index 100% rename from tests/generator-Tests/expected/Streams/SupportFiles/OutputStreamInvoker.cs rename to tests/generator-Tests/expected.ji/Streams/SupportFiles/OutputStreamInvoker.cs diff --git a/tests/generator-Tests/expected/TestInterface/TestInterface.xml b/tests/generator-Tests/expected.ji/TestInterface/TestInterface.xml similarity index 100% rename from tests/generator-Tests/expected/TestInterface/TestInterface.xml rename to tests/generator-Tests/expected.ji/TestInterface/TestInterface.xml diff --git a/tests/generator-Tests/expected/java.lang.Enum/Java.Lang.Enum.xml b/tests/generator-Tests/expected.ji/java.lang.Enum/Java.Lang.Enum.xml similarity index 100% rename from tests/generator-Tests/expected/java.lang.Enum/Java.Lang.Enum.xml rename to tests/generator-Tests/expected.ji/java.lang.Enum/Java.Lang.Enum.xml diff --git a/tests/generator-Tests/expected/java.lang.Object/java.lang.Object.xml b/tests/generator-Tests/expected.ji/java.lang.Object/java.lang.Object.xml similarity index 100% rename from tests/generator-Tests/expected/java.lang.Object/java.lang.Object.xml rename to tests/generator-Tests/expected.ji/java.lang.Object/java.lang.Object.xml diff --git a/tests/generator-Tests/expected/java.util.List/java.util.List.xml b/tests/generator-Tests/expected.ji/java.util.List/java.util.List.xml similarity index 100% rename from tests/generator-Tests/expected/java.util.List/java.util.List.xml rename to tests/generator-Tests/expected.ji/java.util.List/java.util.List.xml diff --git a/tests/generator-Tests/expected/AccessModifiers/Mono.Android.projitems b/tests/generator-Tests/expected/AccessModifiers/Mono.Android.projitems deleted file mode 100644 index 8202bce47..000000000 --- a/tests/generator-Tests/expected/AccessModifiers/Mono.Android.projitems +++ /dev/null @@ -1,20 +0,0 @@ - - - - $(DefineConstants);ANDROID_1;ANDROID_2;ANDROID_3;ANDROID_4 - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/generator-Tests/expected/AccessModifiers/Xamarin.Test.BasePublicClass.cs b/tests/generator-Tests/expected/AccessModifiers/Xamarin.Test.BasePublicClass.cs deleted file mode 100644 index 59cd62440..000000000 --- a/tests/generator-Tests/expected/AccessModifiers/Xamarin.Test.BasePublicClass.cs +++ /dev/null @@ -1,72 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Xamarin.Test { - - // Metadata.xml XPath class reference: path="/api/package[@name='xamarin.test']/class[@name='BasePublicClass']" - [global::Android.Runtime.Register ("xamarin/test/BasePublicClass", DoNotGenerateAcw=true)] - public partial class BasePublicClass : global::Java.Lang.Object { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("xamarin/test/BasePublicClass", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (BasePublicClass); } - } - - protected BasePublicClass (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static Delegate cb_baseMethod; -#pragma warning disable 0169 - static Delegate GetBaseMethodHandler () - { - if (cb_baseMethod == null) - cb_baseMethod = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_V) n_BaseMethod); - return cb_baseMethod; - } - - static void n_BaseMethod (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.BaseMethod (); - } -#pragma warning restore 0169 - - static IntPtr id_baseMethod; - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='BasePublicClass']/method[@name='baseMethod' and count(parameter)=0]" - [Register ("baseMethod", "()V", "GetBaseMethodHandler")] - public virtual unsafe void BaseMethod () - { - if (id_baseMethod == IntPtr.Zero) - id_baseMethod = JNIEnv.GetMethodID (class_ref, "baseMethod", "()V"); - try { - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_baseMethod); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "baseMethod", "()V")); - } finally { - } - } - - } -} diff --git a/tests/generator-Tests/expected/AccessModifiers/Xamarin.Test.ExtendPublicClass.cs b/tests/generator-Tests/expected/AccessModifiers/Xamarin.Test.ExtendPublicClass.cs deleted file mode 100644 index 51133e38b..000000000 --- a/tests/generator-Tests/expected/AccessModifiers/Xamarin.Test.ExtendPublicClass.cs +++ /dev/null @@ -1,100 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Xamarin.Test { - - // Metadata.xml XPath class reference: path="/api/package[@name='xamarin.test']/class[@name='ExtendPublicClass']" - [global::Android.Runtime.Register ("xamarin/test/ExtendPublicClass", DoNotGenerateAcw=true)] - public partial class ExtendPublicClass : global::Java.Lang.Object { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("xamarin/test/ExtendPublicClass", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (ExtendPublicClass); } - } - - protected ExtendPublicClass (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static IntPtr id_ctor; - // Metadata.xml XPath constructor reference: path="/api/package[@name='xamarin.test']/class[@name='ExtendPublicClass']/constructor[@name='ExtendPublicClass' and count(parameter)=0]" - [Register (".ctor", "()V", "")] - public unsafe ExtendPublicClass () - : base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer) - { - if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero) - return; - - try { - if (((object) this).GetType () != typeof (ExtendPublicClass)) { - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (((object) this).GetType (), "()V"), - JniHandleOwnership.TransferLocalRef); - global::Android.Runtime.JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, "()V"); - return; - } - - if (id_ctor == IntPtr.Zero) - id_ctor = JNIEnv.GetMethodID (class_ref, "", "()V"); - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (class_ref, id_ctor), - JniHandleOwnership.TransferLocalRef); - JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, class_ref, id_ctor); - } finally { - } - } - - static Delegate cb_foo; -#pragma warning disable 0169 - static Delegate GetFooHandler () - { - if (cb_foo == null) - cb_foo = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_V) n_Foo); - return cb_foo; - } - - static void n_Foo (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.Foo (); - } -#pragma warning restore 0169 - - static IntPtr id_foo; - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='ExtendPublicClass']/method[@name='foo' and count(parameter)=0]" - [Register ("foo", "()V", "GetFooHandler")] - public virtual unsafe void Foo () - { - if (id_foo == IntPtr.Zero) - id_foo = JNIEnv.GetMethodID (class_ref, "foo", "()V"); - try { - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_foo); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "foo", "()V")); - } finally { - } - } - - } -} diff --git a/tests/generator-Tests/expected/AccessModifiers/Xamarin.Test.IExtendedInterface.cs b/tests/generator-Tests/expected/AccessModifiers/Xamarin.Test.IExtendedInterface.cs deleted file mode 100644 index 404c7be9b..000000000 --- a/tests/generator-Tests/expected/AccessModifiers/Xamarin.Test.IExtendedInterface.cs +++ /dev/null @@ -1,114 +0,0 @@ -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Xamarin.Test { - - // Metadata.xml XPath interface reference: path="/api/package[@name='xamarin.test']/interface[@name='ExtendedInterface']" - [Register ("xamarin/test/ExtendedInterface", "", "Xamarin.Test.IExtendedInterfaceInvoker")] - public partial interface IExtendedInterface : IJavaObject { - - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/interface[@name='ExtendedInterface']/method[@name='extendedMethod' and count(parameter)=0]" - [Register ("extendedMethod", "()V", "GetExtendedMethodHandler:Xamarin.Test.IExtendedInterfaceInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")] - void ExtendedMethod (); - - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/interface[@name='BaseInterface']/method[@name='baseMethod' and count(parameter)=0]" - [Register ("baseMethod", "()V", "GetBaseMethodHandler:Xamarin.Test.IExtendedInterfaceInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")] - void BaseMethod (); - - } - - [global::Android.Runtime.Register ("xamarin/test/ExtendedInterface", DoNotGenerateAcw=true)] - internal partial class IExtendedInterfaceInvoker : global::Java.Lang.Object, IExtendedInterface { - - static IntPtr java_class_ref = JNIEnv.FindClass ("xamarin/test/ExtendedInterface"); - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (IExtendedInterfaceInvoker); } - } - - new IntPtr class_ref; - - public static IExtendedInterface GetObject (IntPtr handle, JniHandleOwnership transfer) - { - return global::Java.Lang.Object.GetObject (handle, transfer); - } - - static IntPtr Validate (IntPtr handle) - { - if (!JNIEnv.IsInstanceOf (handle, java_class_ref)) - throw new InvalidCastException (string.Format ("Unable to convert instance of type '{0}' to type '{1}'.", - JNIEnv.GetClassNameFromInstance (handle), "xamarin.test.ExtendedInterface")); - return handle; - } - - protected override void Dispose (bool disposing) - { - if (this.class_ref != IntPtr.Zero) - JNIEnv.DeleteGlobalRef (this.class_ref); - this.class_ref = IntPtr.Zero; - base.Dispose (disposing); - } - - public IExtendedInterfaceInvoker (IntPtr handle, JniHandleOwnership transfer) : base (Validate (handle), transfer) - { - IntPtr local_ref = JNIEnv.GetObjectClass (((global::Java.Lang.Object) this).Handle); - this.class_ref = JNIEnv.NewGlobalRef (local_ref); - JNIEnv.DeleteLocalRef (local_ref); - } - - static Delegate cb_extendedMethod; -#pragma warning disable 0169 - static Delegate GetExtendedMethodHandler () - { - if (cb_extendedMethod == null) - cb_extendedMethod = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_V) n_ExtendedMethod); - return cb_extendedMethod; - } - - static void n_ExtendedMethod (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.ExtendedMethod (); - } -#pragma warning restore 0169 - - IntPtr id_extendedMethod; - public unsafe void ExtendedMethod () - { - if (id_extendedMethod == IntPtr.Zero) - id_extendedMethod = JNIEnv.GetMethodID (class_ref, "extendedMethod", "()V"); - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_extendedMethod); - } - - static Delegate cb_baseMethod; -#pragma warning disable 0169 - static Delegate GetBaseMethodHandler () - { - if (cb_baseMethod == null) - cb_baseMethod = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_V) n_BaseMethod); - return cb_baseMethod; - } - - static void n_BaseMethod (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.BaseMethod (); - } -#pragma warning restore 0169 - - IntPtr id_baseMethod; - public unsafe void BaseMethod () - { - if (id_baseMethod == IntPtr.Zero) - id_baseMethod = JNIEnv.GetMethodID (class_ref, "baseMethod", "()V"); - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_baseMethod); - } - - } - -} diff --git a/tests/generator-Tests/expected/AccessModifiers/Xamarin.Test.PublicClass.cs b/tests/generator-Tests/expected/AccessModifiers/Xamarin.Test.PublicClass.cs deleted file mode 100644 index 75ce4d378..000000000 --- a/tests/generator-Tests/expected/AccessModifiers/Xamarin.Test.PublicClass.cs +++ /dev/null @@ -1,180 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Xamarin.Test { - - // Metadata.xml XPath class reference: path="/api/package[@name='xamarin.test']/class[@name='PublicClass']" - [global::Android.Runtime.Register ("xamarin/test/PublicClass", DoNotGenerateAcw=true)] - public partial class PublicClass : global::Java.Lang.Object { - - // Metadata.xml XPath interface reference: path="/api/package[@name='xamarin.test']/interface[@name='PublicClass.ProtectedInterface']" - [Register ("xamarin/test/PublicClass$ProtectedInterface", "", "Xamarin.Test.PublicClass/IProtectedInterfaceInvoker")] - protected internal partial interface IProtectedInterface : IJavaObject { - - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/interface[@name='PublicClass.ProtectedInterface']/method[@name='foo' and count(parameter)=0]" - [Register ("foo", "()V", "GetFooHandler:Xamarin.Test.PublicClass/IProtectedInterfaceInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")] - void Foo (); - - } - - [global::Android.Runtime.Register ("xamarin/test/PublicClass$ProtectedInterface", DoNotGenerateAcw=true)] - internal partial class IProtectedInterfaceInvoker : global::Java.Lang.Object, IProtectedInterface { - - static IntPtr java_class_ref = JNIEnv.FindClass ("xamarin/test/PublicClass$ProtectedInterface"); - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (IProtectedInterfaceInvoker); } - } - - new IntPtr class_ref; - - public static IProtectedInterface GetObject (IntPtr handle, JniHandleOwnership transfer) - { - return global::Java.Lang.Object.GetObject (handle, transfer); - } - - static IntPtr Validate (IntPtr handle) - { - if (!JNIEnv.IsInstanceOf (handle, java_class_ref)) - throw new InvalidCastException (string.Format ("Unable to convert instance of type '{0}' to type '{1}'.", - JNIEnv.GetClassNameFromInstance (handle), "xamarin.test.PublicClass.ProtectedInterface")); - return handle; - } - - protected override void Dispose (bool disposing) - { - if (this.class_ref != IntPtr.Zero) - JNIEnv.DeleteGlobalRef (this.class_ref); - this.class_ref = IntPtr.Zero; - base.Dispose (disposing); - } - - public IProtectedInterfaceInvoker (IntPtr handle, JniHandleOwnership transfer) : base (Validate (handle), transfer) - { - IntPtr local_ref = JNIEnv.GetObjectClass (((global::Java.Lang.Object) this).Handle); - this.class_ref = JNIEnv.NewGlobalRef (local_ref); - JNIEnv.DeleteLocalRef (local_ref); - } - - static Delegate cb_foo; -#pragma warning disable 0169 - static Delegate GetFooHandler () - { - if (cb_foo == null) - cb_foo = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_V) n_Foo); - return cb_foo; - } - - static void n_Foo (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.Foo (); - } -#pragma warning restore 0169 - - IntPtr id_foo; - public unsafe void Foo () - { - if (id_foo == IntPtr.Zero) - id_foo = JNIEnv.GetMethodID (class_ref, "foo", "()V"); - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_foo); - } - - } - - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("xamarin/test/PublicClass", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (PublicClass); } - } - - protected PublicClass (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static IntPtr id_ctor; - // Metadata.xml XPath constructor reference: path="/api/package[@name='xamarin.test']/class[@name='PublicClass']/constructor[@name='PublicClass' and count(parameter)=0]" - [Register (".ctor", "()V", "")] - public unsafe PublicClass () - : base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer) - { - if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero) - return; - - try { - if (((object) this).GetType () != typeof (PublicClass)) { - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (((object) this).GetType (), "()V"), - JniHandleOwnership.TransferLocalRef); - global::Android.Runtime.JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, "()V"); - return; - } - - if (id_ctor == IntPtr.Zero) - id_ctor = JNIEnv.GetMethodID (class_ref, "", "()V"); - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (class_ref, id_ctor), - JniHandleOwnership.TransferLocalRef); - JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, class_ref, id_ctor); - } finally { - } - } - - static Delegate cb_foo; -#pragma warning disable 0169 - static Delegate GetFooHandler () - { - if (cb_foo == null) - cb_foo = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_V) n_Foo); - return cb_foo; - } - - static void n_Foo (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.Foo (); - } -#pragma warning restore 0169 - - static IntPtr id_foo; - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='PublicClass']/method[@name='foo' and count(parameter)=0]" - [Register ("foo", "()V", "GetFooHandler")] - public virtual unsafe void Foo () - { - if (id_foo == IntPtr.Zero) - id_foo = JNIEnv.GetMethodID (class_ref, "foo", "()V"); - try { - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_foo); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "foo", "()V")); - } finally { - } - } - - } -} diff --git a/tests/generator-Tests/expected/AccessModifiers/Xamarin.Test.PublicFinalClass.cs b/tests/generator-Tests/expected/AccessModifiers/Xamarin.Test.PublicFinalClass.cs deleted file mode 100644 index 9e89768d5..000000000 --- a/tests/generator-Tests/expected/AccessModifiers/Xamarin.Test.PublicFinalClass.cs +++ /dev/null @@ -1,78 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Xamarin.Test { - - // Metadata.xml XPath class reference: path="/api/package[@name='xamarin.test']/class[@name='PublicFinalClass']" - [global::Android.Runtime.Register ("xamarin/test/PublicFinalClass", DoNotGenerateAcw=true)] - public sealed partial class PublicFinalClass : global::Xamarin.Test.BasePublicClass { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("xamarin/test/PublicFinalClass", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (PublicFinalClass); } - } - - internal PublicFinalClass (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static IntPtr id_publicMethod; - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='PublicFinalClass']/method[@name='publicMethod' and count(parameter)=0]" - [Register ("publicMethod", "()V", "")] - public unsafe void PublicMethod () - { - if (id_publicMethod == IntPtr.Zero) - id_publicMethod = JNIEnv.GetMethodID (class_ref, "publicMethod", "()V"); - try { - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_publicMethod); - } finally { - } - } - - static IntPtr id_packageMethodB; - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='PublicFinalClass']/method[@name='packageMethodB' and count(parameter)=0]" - [Register ("packageMethodB", "()V", "")] - public unsafe void PackageMethodB () - { - if (id_packageMethodB == IntPtr.Zero) - id_packageMethodB = JNIEnv.GetMethodID (class_ref, "packageMethodB", "()V"); - try { - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_packageMethodB); - } finally { - } - } - - static IntPtr id_packageMethodA; - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='PublicFinalClass']/method[@name='packageMethodA' and count(parameter)=0]" - [Register ("packageMethodA", "()V", "")] - public unsafe void PackageMethodA () - { - if (id_packageMethodA == IntPtr.Zero) - id_packageMethodA = JNIEnv.GetMethodID (class_ref, "packageMethodA", "()V"); - try { - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_packageMethodA); - } finally { - } - } - - } -} diff --git a/tests/generator-Tests/expected/AccessModifiers/Xamarin.Test.TestClass.cs b/tests/generator-Tests/expected/AccessModifiers/Xamarin.Test.TestClass.cs deleted file mode 100644 index f86a9a12d..000000000 --- a/tests/generator-Tests/expected/AccessModifiers/Xamarin.Test.TestClass.cs +++ /dev/null @@ -1,100 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Xamarin.Test { - - // Metadata.xml XPath class reference: path="/api/package[@name='xamarin.test']/class[@name='TestClass']" - [global::Android.Runtime.Register ("xamarin/test/TestClass", DoNotGenerateAcw=true)] - public partial class TestClass : global::Java.Lang.Object { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("xamarin/test/TestClass", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (TestClass); } - } - - protected TestClass (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static IntPtr id_ctor; - // Metadata.xml XPath constructor reference: path="/api/package[@name='xamarin.test']/class[@name='TestClass']/constructor[@name='TestClass' and count(parameter)=0]" - [Register (".ctor", "()V", "")] - public unsafe TestClass () - : base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer) - { - if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero) - return; - - try { - if (((object) this).GetType () != typeof (TestClass)) { - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (((object) this).GetType (), "()V"), - JniHandleOwnership.TransferLocalRef); - global::Android.Runtime.JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, "()V"); - return; - } - - if (id_ctor == IntPtr.Zero) - id_ctor = JNIEnv.GetMethodID (class_ref, "", "()V"); - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (class_ref, id_ctor), - JniHandleOwnership.TransferLocalRef); - JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, class_ref, id_ctor); - } finally { - } - } - - static Delegate cb_baseMethod; -#pragma warning disable 0169 - static Delegate GetBaseMethodHandler () - { - if (cb_baseMethod == null) - cb_baseMethod = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_V) n_BaseMethod); - return cb_baseMethod; - } - - static void n_BaseMethod (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.BaseMethod (); - } -#pragma warning restore 0169 - - static IntPtr id_baseMethod; - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='TestClass']/method[@name='baseMethod' and count(parameter)=0]" - [Register ("baseMethod", "()V", "GetBaseMethodHandler")] - public virtual unsafe void BaseMethod () - { - if (id_baseMethod == IntPtr.Zero) - id_baseMethod = JNIEnv.GetMethodID (class_ref, "baseMethod", "()V"); - try { - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_baseMethod); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "baseMethod", "()V")); - } finally { - } - } - - } -} diff --git a/tests/generator-Tests/expected/Adapters/Mono.Android.projitems b/tests/generator-Tests/expected/Adapters/Mono.Android.projitems deleted file mode 100644 index 4e6987503..000000000 --- a/tests/generator-Tests/expected/Adapters/Mono.Android.projitems +++ /dev/null @@ -1,19 +0,0 @@ - - - - $(DefineConstants);ANDROID_1;ANDROID_2;ANDROID_3;ANDROID_4 - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/generator-Tests/expected/Adapters/Xamarin.Test.AbsSpinner.cs b/tests/generator-Tests/expected/Adapters/Xamarin.Test.AbsSpinner.cs deleted file mode 100644 index 5f7fc9ad0..000000000 --- a/tests/generator-Tests/expected/Adapters/Xamarin.Test.AbsSpinner.cs +++ /dev/null @@ -1,148 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Xamarin.Test { - - // Metadata.xml XPath class reference: path="/api/package[@name='xamarin.test']/class[@name='AbsSpinner']" - [global::Android.Runtime.Register ("xamarin/test/AbsSpinner", DoNotGenerateAcw=true)] - public abstract partial class AbsSpinner : Xamarin.Test.AdapterView { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("xamarin/test/AbsSpinner", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (AbsSpinner); } - } - - protected AbsSpinner (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static Delegate cb_getAdapter; -#pragma warning disable 0169 - static Delegate GetGetAdapterHandler () - { - if (cb_getAdapter == null) - cb_getAdapter = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_L) n_GetAdapter); - return cb_getAdapter; - } - - static IntPtr n_GetAdapter (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return JNIEnv.ToLocalJniHandle (__this.Adapter); - } -#pragma warning restore 0169 - - static Delegate cb_setAdapter_Lxamarin_test_SpinnerAdapter_; -#pragma warning disable 0169 - static Delegate GetSetAdapter_Lxamarin_test_SpinnerAdapter_Handler () - { - if (cb_setAdapter_Lxamarin_test_SpinnerAdapter_ == null) - cb_setAdapter_Lxamarin_test_SpinnerAdapter_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_V) n_SetAdapter_Lxamarin_test_SpinnerAdapter_); - return cb_setAdapter_Lxamarin_test_SpinnerAdapter_; - } - - static void n_SetAdapter_Lxamarin_test_SpinnerAdapter_ (IntPtr jnienv, IntPtr native__this, IntPtr native_adapter) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var adapter = (global::Xamarin.Test.ISpinnerAdapter)global::Java.Lang.Object.GetObject (native_adapter, JniHandleOwnership.DoNotTransfer); - __this.Adapter = adapter; - } -#pragma warning restore 0169 - - static IntPtr id_getAdapter; - static IntPtr id_setAdapter_Lxamarin_test_SpinnerAdapter_; - public override unsafe global::Xamarin.Test.ISpinnerAdapter Adapter { - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='AbsSpinner']/method[@name='getAdapter' and count(parameter)=0]" - [Register ("getAdapter", "()Lxamarin/test/SpinnerAdapter;", "GetGetAdapterHandler")] - get { - if (id_getAdapter == IntPtr.Zero) - id_getAdapter = JNIEnv.GetMethodID (class_ref, "getAdapter", "()Lxamarin/test/SpinnerAdapter;"); - try { - - if (((object) this).GetType () == ThresholdType) - return global::Java.Lang.Object.GetObject (JNIEnv.CallObjectMethod (((global::Java.Lang.Object) this).Handle, id_getAdapter), JniHandleOwnership.TransferLocalRef); - else - return global::Java.Lang.Object.GetObject (JNIEnv.CallNonvirtualObjectMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "getAdapter", "()Lxamarin/test/SpinnerAdapter;")), JniHandleOwnership.TransferLocalRef); - } finally { - } - } - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='AbsSpinner']/method[@name='setAdapter' and count(parameter)=1 and parameter[1][@type='xamarin.test.SpinnerAdapter']]" - [Register ("setAdapter", "(Lxamarin/test/SpinnerAdapter;)V", "GetSetAdapter_Lxamarin_test_SpinnerAdapter_Handler")] - set { - if (id_setAdapter_Lxamarin_test_SpinnerAdapter_ == IntPtr.Zero) - id_setAdapter_Lxamarin_test_SpinnerAdapter_ = JNIEnv.GetMethodID (class_ref, "setAdapter", "(Lxamarin/test/SpinnerAdapter;)V"); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (value); - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_setAdapter_Lxamarin_test_SpinnerAdapter_, __args); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "setAdapter", "(Lxamarin/test/SpinnerAdapter;)V"), __args); - } finally { - } - } - } - - } - - [global::Android.Runtime.Register ("xamarin/test/AbsSpinner", DoNotGenerateAcw=true)] - internal partial class AbsSpinnerInvoker : AbsSpinner { - - public AbsSpinnerInvoker (IntPtr handle, JniHandleOwnership transfer) : base (handle, transfer) {} - - protected override global::System.Type ThresholdType { - get { return typeof (AbsSpinnerInvoker); } - } - - static IntPtr id_getAdapter; - static IntPtr id_setAdapter_Lxamarin_test_Adapter_; - protected override unsafe global::Java.Lang.Object RawAdapter { - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='AdapterView']/method[@name='getAdapter' and count(parameter)=0]" - [Register ("getAdapter", "()Lxamarin/test/Adapter;", "GetGetAdapterHandler")] - get { - if (id_getAdapter == IntPtr.Zero) - id_getAdapter = JNIEnv.GetMethodID (class_ref, "getAdapter", "()Lxamarin/test/Adapter;"); - try { - return (global::Java.Lang.Object) global::Java.Lang.Object.GetObject (JNIEnv.CallObjectMethod (((global::Java.Lang.Object) this).Handle, id_getAdapter), JniHandleOwnership.TransferLocalRef); - } finally { - } - } - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='AdapterView']/method[@name='setAdapter' and count(parameter)=1 and parameter[1][@type='T']]" - [Register ("setAdapter", "(Lxamarin/test/Adapter;)V", "GetSetAdapter_Lxamarin_test_Adapter_Handler")] - set { - if (id_setAdapter_Lxamarin_test_Adapter_ == IntPtr.Zero) - id_setAdapter_Lxamarin_test_Adapter_ = JNIEnv.GetMethodID (class_ref, "setAdapter", "(Lxamarin/test/Adapter;)V"); - IntPtr native_value = JNIEnv.ToLocalJniHandle (value); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_value); - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_setAdapter_Lxamarin_test_Adapter_, __args); - } finally { - JNIEnv.DeleteLocalRef (native_value); - } - } - } - - } - -} diff --git a/tests/generator-Tests/expected/Adapters/Xamarin.Test.AdapterView.cs b/tests/generator-Tests/expected/Adapters/Xamarin.Test.AdapterView.cs deleted file mode 100644 index bede35ee7..000000000 --- a/tests/generator-Tests/expected/Adapters/Xamarin.Test.AdapterView.cs +++ /dev/null @@ -1,121 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Xamarin.Test { - - // Metadata.xml XPath class reference: path="/api/package[@name='xamarin.test']/class[@name='AdapterView']" - [global::Android.Runtime.Register ("xamarin/test/AdapterView", DoNotGenerateAcw=true)] - [global::Java.Interop.JavaTypeParameters (new string [] {"T extends xamarin.test.Adapter"})] - public abstract partial class AdapterView : global::Java.Lang.Object { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("xamarin/test/AdapterView", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (AdapterView); } - } - - protected AdapterView (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static Delegate cb_getAdapter; -#pragma warning disable 0169 - static Delegate GetGetAdapterHandler () - { - if (cb_getAdapter == null) - cb_getAdapter = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_L) n_GetAdapter); - return cb_getAdapter; - } - - static IntPtr n_GetAdapter (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return JNIEnv.ToLocalJniHandle (__this.RawAdapter); - } -#pragma warning restore 0169 - - static Delegate cb_setAdapter_Lxamarin_test_Adapter_; -#pragma warning disable 0169 - static Delegate GetSetAdapter_Lxamarin_test_Adapter_Handler () - { - if (cb_setAdapter_Lxamarin_test_Adapter_ == null) - cb_setAdapter_Lxamarin_test_Adapter_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_V) n_SetAdapter_Lxamarin_test_Adapter_); - return cb_setAdapter_Lxamarin_test_Adapter_; - } - - static void n_SetAdapter_Lxamarin_test_Adapter_ (IntPtr jnienv, IntPtr native__this, IntPtr native_adapter) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var adapter = global::Java.Lang.Object.GetObject (native_adapter, JniHandleOwnership.DoNotTransfer); - __this.RawAdapter = adapter; - } -#pragma warning restore 0169 - - protected abstract global::Java.Lang.Object RawAdapter { - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='AdapterView']/method[@name='getAdapter' and count(parameter)=0]" - [Register ("getAdapter", "()Lxamarin/test/Adapter;", "GetGetAdapterHandler")] get; - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='AdapterView']/method[@name='setAdapter' and count(parameter)=1 and parameter[1][@type='T']]" - [Register ("setAdapter", "(Lxamarin/test/Adapter;)V", "GetSetAdapter_Lxamarin_test_Adapter_Handler")] set; - } - - } - - [global::Android.Runtime.Register ("xamarin/test/AdapterView", DoNotGenerateAcw=true)] - internal partial class AdapterViewInvoker : AdapterView { - - public AdapterViewInvoker (IntPtr handle, JniHandleOwnership transfer) : base (handle, transfer) {} - - protected override global::System.Type ThresholdType { - get { return typeof (AdapterViewInvoker); } - } - - static IntPtr id_getAdapter; - static IntPtr id_setAdapter_Lxamarin_test_Adapter_; - protected override unsafe global::Java.Lang.Object RawAdapter { - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='AdapterView']/method[@name='getAdapter' and count(parameter)=0]" - [Register ("getAdapter", "()Lxamarin/test/Adapter;", "GetGetAdapterHandler")] - get { - if (id_getAdapter == IntPtr.Zero) - id_getAdapter = JNIEnv.GetMethodID (class_ref, "getAdapter", "()Lxamarin/test/Adapter;"); - try { - return (global::Java.Lang.Object) global::Java.Lang.Object.GetObject (JNIEnv.CallObjectMethod (((global::Java.Lang.Object) this).Handle, id_getAdapter), JniHandleOwnership.TransferLocalRef); - } finally { - } - } - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='AdapterView']/method[@name='setAdapter' and count(parameter)=1 and parameter[1][@type='T']]" - [Register ("setAdapter", "(Lxamarin/test/Adapter;)V", "GetSetAdapter_Lxamarin_test_Adapter_Handler")] - set { - if (id_setAdapter_Lxamarin_test_Adapter_ == IntPtr.Zero) - id_setAdapter_Lxamarin_test_Adapter_ = JNIEnv.GetMethodID (class_ref, "setAdapter", "(Lxamarin/test/Adapter;)V"); - IntPtr native_value = JNIEnv.ToLocalJniHandle (value); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_value); - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_setAdapter_Lxamarin_test_Adapter_, __args); - } finally { - JNIEnv.DeleteLocalRef (native_value); - } - } - } - - } - -} diff --git a/tests/generator-Tests/expected/Adapters/Xamarin.Test.GenericReturnObject.cs b/tests/generator-Tests/expected/Adapters/Xamarin.Test.GenericReturnObject.cs deleted file mode 100644 index 60d2863f6..000000000 --- a/tests/generator-Tests/expected/Adapters/Xamarin.Test.GenericReturnObject.cs +++ /dev/null @@ -1,72 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Xamarin.Test { - - // Metadata.xml XPath class reference: path="/api/package[@name='xamarin.test']/class[@name='GenericReturnObject']" - [global::Android.Runtime.Register ("xamarin/test/GenericReturnObject", DoNotGenerateAcw=true)] - public partial class GenericReturnObject : global::Java.Lang.Object { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("xamarin/test/GenericReturnObject", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (GenericReturnObject); } - } - - protected GenericReturnObject (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static Delegate cb_GenericReturn; -#pragma warning disable 0169 - static Delegate GetGenericReturnHandler () - { - if (cb_GenericReturn == null) - cb_GenericReturn = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_L) n_GenericReturn); - return cb_GenericReturn; - } - - static IntPtr n_GenericReturn (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return JNIEnv.ToLocalJniHandle (__this.GenericReturn ()); - } -#pragma warning restore 0169 - - static IntPtr id_GenericReturn; - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='GenericReturnObject']/method[@name='GenericReturn' and count(parameter)=0]" - [Register ("GenericReturn", "()Lxamarin/test/AdapterView;", "GetGenericReturnHandler")] - public virtual unsafe global::Xamarin.Test.AdapterView GenericReturn () - { - if (id_GenericReturn == IntPtr.Zero) - id_GenericReturn = JNIEnv.GetMethodID (class_ref, "GenericReturn", "()Lxamarin/test/AdapterView;"); - try { - - if (((object) this).GetType () == ThresholdType) - return global::Java.Lang.Object.GetObject (JNIEnv.CallObjectMethod (((global::Java.Lang.Object) this).Handle, id_GenericReturn), JniHandleOwnership.TransferLocalRef); - else - return global::Java.Lang.Object.GetObject (JNIEnv.CallNonvirtualObjectMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "GenericReturn", "()Lxamarin/test/AdapterView;")), JniHandleOwnership.TransferLocalRef); - } finally { - } - } - - } -} diff --git a/tests/generator-Tests/expected/Adapters/Xamarin.Test.IAdapter.cs b/tests/generator-Tests/expected/Adapters/Xamarin.Test.IAdapter.cs deleted file mode 100644 index b1ad7cfba..000000000 --- a/tests/generator-Tests/expected/Adapters/Xamarin.Test.IAdapter.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Xamarin.Test { - - // Metadata.xml XPath interface reference: path="/api/package[@name='xamarin.test']/interface[@name='Adapter']" - [Register ("xamarin/test/Adapter", "", "Xamarin.Test.IAdapterInvoker")] - public partial interface IAdapter : IJavaObject { - - } - - [global::Android.Runtime.Register ("xamarin/test/Adapter", DoNotGenerateAcw=true)] - internal partial class IAdapterInvoker : global::Java.Lang.Object, IAdapter { - - static IntPtr java_class_ref = JNIEnv.FindClass ("xamarin/test/Adapter"); - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (IAdapterInvoker); } - } - - new IntPtr class_ref; - - public static IAdapter GetObject (IntPtr handle, JniHandleOwnership transfer) - { - return global::Java.Lang.Object.GetObject (handle, transfer); - } - - static IntPtr Validate (IntPtr handle) - { - if (!JNIEnv.IsInstanceOf (handle, java_class_ref)) - throw new InvalidCastException (string.Format ("Unable to convert instance of type '{0}' to type '{1}'.", - JNIEnv.GetClassNameFromInstance (handle), "xamarin.test.Adapter")); - return handle; - } - - protected override void Dispose (bool disposing) - { - if (this.class_ref != IntPtr.Zero) - JNIEnv.DeleteGlobalRef (this.class_ref); - this.class_ref = IntPtr.Zero; - base.Dispose (disposing); - } - - public IAdapterInvoker (IntPtr handle, JniHandleOwnership transfer) : base (Validate (handle), transfer) - { - IntPtr local_ref = JNIEnv.GetObjectClass (((global::Java.Lang.Object) this).Handle); - this.class_ref = JNIEnv.NewGlobalRef (local_ref); - JNIEnv.DeleteLocalRef (local_ref); - } - - } - -} diff --git a/tests/generator-Tests/expected/Adapters/Xamarin.Test.ISpinnerAdapter.cs b/tests/generator-Tests/expected/Adapters/Xamarin.Test.ISpinnerAdapter.cs deleted file mode 100644 index dace2f2bc..000000000 --- a/tests/generator-Tests/expected/Adapters/Xamarin.Test.ISpinnerAdapter.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Xamarin.Test { - - // Metadata.xml XPath interface reference: path="/api/package[@name='xamarin.test']/interface[@name='SpinnerAdapter']" - [Register ("xamarin/test/SpinnerAdapter", "", "Xamarin.Test.ISpinnerAdapterInvoker")] - public partial interface ISpinnerAdapter : global::Xamarin.Test.IAdapter { - - } - - [global::Android.Runtime.Register ("xamarin/test/SpinnerAdapter", DoNotGenerateAcw=true)] - internal partial class ISpinnerAdapterInvoker : global::Java.Lang.Object, ISpinnerAdapter { - - static IntPtr java_class_ref = JNIEnv.FindClass ("xamarin/test/SpinnerAdapter"); - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (ISpinnerAdapterInvoker); } - } - - new IntPtr class_ref; - - public static ISpinnerAdapter GetObject (IntPtr handle, JniHandleOwnership transfer) - { - return global::Java.Lang.Object.GetObject (handle, transfer); - } - - static IntPtr Validate (IntPtr handle) - { - if (!JNIEnv.IsInstanceOf (handle, java_class_ref)) - throw new InvalidCastException (string.Format ("Unable to convert instance of type '{0}' to type '{1}'.", - JNIEnv.GetClassNameFromInstance (handle), "xamarin.test.SpinnerAdapter")); - return handle; - } - - protected override void Dispose (bool disposing) - { - if (this.class_ref != IntPtr.Zero) - JNIEnv.DeleteGlobalRef (this.class_ref); - this.class_ref = IntPtr.Zero; - base.Dispose (disposing); - } - - public ISpinnerAdapterInvoker (IntPtr handle, JniHandleOwnership transfer) : base (Validate (handle), transfer) - { - IntPtr local_ref = JNIEnv.GetObjectClass (((global::Java.Lang.Object) this).Handle); - this.class_ref = JNIEnv.NewGlobalRef (local_ref); - JNIEnv.DeleteLocalRef (local_ref); - } - - } - -} diff --git a/tests/generator-Tests/expected/Android.Graphics.Color/Mono.Android.projitems b/tests/generator-Tests/expected/Android.Graphics.Color/Mono.Android.projitems deleted file mode 100644 index 066be1dd1..000000000 --- a/tests/generator-Tests/expected/Android.Graphics.Color/Mono.Android.projitems +++ /dev/null @@ -1,15 +0,0 @@ - - - - $(DefineConstants);ANDROID_1;ANDROID_2;ANDROID_3;ANDROID_4 - - - - - - - - - - - \ No newline at end of file diff --git a/tests/generator-Tests/expected/Android.Graphics.Color/Xamarin.Test.SomeObject.cs b/tests/generator-Tests/expected/Android.Graphics.Color/Xamarin.Test.SomeObject.cs deleted file mode 100644 index 7b3131682..000000000 --- a/tests/generator-Tests/expected/Android.Graphics.Color/Xamarin.Test.SomeObject.cs +++ /dev/null @@ -1,139 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Xamarin.Test { - - // Metadata.xml XPath class reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']" - [global::Android.Runtime.Register ("xamarin/test/SomeObject", DoNotGenerateAcw=true)] - public abstract partial class SomeObject : global::Java.Lang.Object { - - - static IntPtr backColor_jfieldId; - - // Metadata.xml XPath field reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/field[@name='backColor']" - [Register ("backColor")] - public global::Android.Graphics.Color BackColor { - get { - if (backColor_jfieldId == IntPtr.Zero) - backColor_jfieldId = JNIEnv.GetFieldID (class_ref, "backColor", "I"); - int __ret = JNIEnv.GetIntField (((global::Java.Lang.Object) this).Handle, backColor_jfieldId); - return new global::Android.Graphics.Color (__ret); - } - set { - if (backColor_jfieldId == IntPtr.Zero) - backColor_jfieldId = JNIEnv.GetFieldID (class_ref, "backColor", "I"); - try { - JNIEnv.SetField (((global::Java.Lang.Object) this).Handle, backColor_jfieldId, value.ToArgb ()); - } finally { - } - } - } - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("xamarin/test/SomeObject", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (SomeObject); } - } - - protected SomeObject (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static Delegate cb_getSomeColor; -#pragma warning disable 0169 - static Delegate GetGetSomeColorHandler () - { - if (cb_getSomeColor == null) - cb_getSomeColor = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_I) n_GetSomeColor); - return cb_getSomeColor; - } - - static int n_GetSomeColor (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return __this.SomeColor.ToArgb (); - } -#pragma warning restore 0169 - - static Delegate cb_setSomeColor_I; -#pragma warning disable 0169 - static Delegate GetSetSomeColor_IHandler () - { - if (cb_setSomeColor_I == null) - cb_setSomeColor_I = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPI_V) n_SetSomeColor_I); - return cb_setSomeColor_I; - } - - static void n_SetSomeColor_I (IntPtr jnienv, IntPtr native__this, int native_newvalue) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var newvalue = new global::Android.Graphics.Color (native_newvalue); - __this.SomeColor = newvalue; - } -#pragma warning restore 0169 - - public abstract global::Android.Graphics.Color SomeColor { - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/method[@name='getSomeColor' and count(parameter)=0]" - [Register ("getSomeColor", "()I", "GetGetSomeColorHandler")] get; - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/method[@name='setSomeColor' and count(parameter)=1 and parameter[1][@type='Android.Graphics.Color']]" - [Register ("setSomeColor", "(I)V", "GetSetSomeColor_IHandler")] set; - } - - } - - [global::Android.Runtime.Register ("xamarin/test/SomeObject", DoNotGenerateAcw=true)] - internal partial class SomeObjectInvoker : SomeObject { - - public SomeObjectInvoker (IntPtr handle, JniHandleOwnership transfer) : base (handle, transfer) {} - - protected override global::System.Type ThresholdType { - get { return typeof (SomeObjectInvoker); } - } - - static IntPtr id_getSomeColor; - static IntPtr id_setSomeColor_I; - public override unsafe global::Android.Graphics.Color SomeColor { - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/method[@name='getSomeColor' and count(parameter)=0]" - [Register ("getSomeColor", "()I", "GetGetSomeColorHandler")] - get { - if (id_getSomeColor == IntPtr.Zero) - id_getSomeColor = JNIEnv.GetMethodID (class_ref, "getSomeColor", "()I"); - try { - return new global::Android.Graphics.Color (JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_getSomeColor)); - } finally { - } - } - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/method[@name='setSomeColor' and count(parameter)=1 and parameter[1][@type='Android.Graphics.Color']]" - [Register ("setSomeColor", "(I)V", "GetSetSomeColor_IHandler")] - set { - if (id_setSomeColor_I == IntPtr.Zero) - id_setSomeColor_I = JNIEnv.GetMethodID (class_ref, "setSomeColor", "(I)V"); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (value.ToArgb ()); - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_setSomeColor_I, __args); - } finally { - } - } - } - - } - -} diff --git a/tests/generator-Tests/expected/Arrays/Mono.Android.projitems b/tests/generator-Tests/expected/Arrays/Mono.Android.projitems deleted file mode 100644 index 066be1dd1..000000000 --- a/tests/generator-Tests/expected/Arrays/Mono.Android.projitems +++ /dev/null @@ -1,15 +0,0 @@ - - - - $(DefineConstants);ANDROID_1;ANDROID_2;ANDROID_3;ANDROID_4 - - - - - - - - - - - \ No newline at end of file diff --git a/tests/generator-Tests/expected/Arrays/Xamarin.Test.SomeObject.cs b/tests/generator-Tests/expected/Arrays/Xamarin.Test.SomeObject.cs deleted file mode 100644 index 4dd713069..000000000 --- a/tests/generator-Tests/expected/Arrays/Xamarin.Test.SomeObject.cs +++ /dev/null @@ -1,193 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Xamarin.Test { - - // Metadata.xml XPath class reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']" - [global::Android.Runtime.Register ("xamarin/test/SomeObject", DoNotGenerateAcw=true)] - public partial class SomeObject : global::Java.Lang.Object { - - - static IntPtr myStrings_jfieldId; - - // Metadata.xml XPath field reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/field[@name='myStrings']" - [Register ("myStrings")] - public IList MyStrings { - get { - if (myStrings_jfieldId == IntPtr.Zero) - myStrings_jfieldId = JNIEnv.GetFieldID (class_ref, "myStrings", "[Ljava/lang/String;"); - return global::Android.Runtime.JavaArray.FromJniHandle (JNIEnv.GetObjectField (((global::Java.Lang.Object) this).Handle, myStrings_jfieldId), JniHandleOwnership.TransferLocalRef); - } - set { - if (myStrings_jfieldId == IntPtr.Zero) - myStrings_jfieldId = JNIEnv.GetFieldID (class_ref, "myStrings", "[Ljava/lang/String;"); - IntPtr native_value = global::Android.Runtime.JavaArray.ToLocalJniHandle (value); - try { - JNIEnv.SetField (((global::Java.Lang.Object) this).Handle, myStrings_jfieldId, native_value); - } finally { - JNIEnv.DeleteLocalRef (native_value); - } - } - } - - static IntPtr myInts_jfieldId; - - // Metadata.xml XPath field reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/field[@name='myInts']" - [Register ("myInts")] - public IList MyInts { - get { - if (myInts_jfieldId == IntPtr.Zero) - myInts_jfieldId = JNIEnv.GetFieldID (class_ref, "myInts", "[I"); - return global::Android.Runtime.JavaArray.FromJniHandle (JNIEnv.GetObjectField (((global::Java.Lang.Object) this).Handle, myInts_jfieldId), JniHandleOwnership.TransferLocalRef); - } - set { - if (myInts_jfieldId == IntPtr.Zero) - myInts_jfieldId = JNIEnv.GetFieldID (class_ref, "myInts", "[I"); - IntPtr native_value = global::Android.Runtime.JavaArray.ToLocalJniHandle (value); - try { - JNIEnv.SetField (((global::Java.Lang.Object) this).Handle, myInts_jfieldId, native_value); - } finally { - JNIEnv.DeleteLocalRef (native_value); - } - } - } - - static IntPtr mybools_jfieldId; - - // Metadata.xml XPath field reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/field[@name='mybools']" - [Register ("mybools")] - public IList Mybools { - get { - if (mybools_jfieldId == IntPtr.Zero) - mybools_jfieldId = JNIEnv.GetFieldID (class_ref, "mybools", "[Z"); - return global::Android.Runtime.JavaArray.FromJniHandle (JNIEnv.GetObjectField (((global::Java.Lang.Object) this).Handle, mybools_jfieldId), JniHandleOwnership.TransferLocalRef); - } - set { - if (mybools_jfieldId == IntPtr.Zero) - mybools_jfieldId = JNIEnv.GetFieldID (class_ref, "mybools", "[Z"); - IntPtr native_value = global::Android.Runtime.JavaArray.ToLocalJniHandle (value); - try { - JNIEnv.SetField (((global::Java.Lang.Object) this).Handle, mybools_jfieldId, native_value); - } finally { - JNIEnv.DeleteLocalRef (native_value); - } - } - } - - static IntPtr myObjects_jfieldId; - - // Metadata.xml XPath field reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/field[@name='myObjects']" - [Register ("myObjects")] - public IList MyObjects { - get { - if (myObjects_jfieldId == IntPtr.Zero) - myObjects_jfieldId = JNIEnv.GetFieldID (class_ref, "myObjects", "[Ljava/lang/Object;"); - return global::Android.Runtime.JavaArray.FromJniHandle (JNIEnv.GetObjectField (((global::Java.Lang.Object) this).Handle, myObjects_jfieldId), JniHandleOwnership.TransferLocalRef); - } - set { - if (myObjects_jfieldId == IntPtr.Zero) - myObjects_jfieldId = JNIEnv.GetFieldID (class_ref, "myObjects", "[Ljava/lang/Object;"); - IntPtr native_value = global::Android.Runtime.JavaArray.ToLocalJniHandle (value); - try { - JNIEnv.SetField (((global::Java.Lang.Object) this).Handle, myObjects_jfieldId, native_value); - } finally { - JNIEnv.DeleteLocalRef (native_value); - } - } - } - - static IntPtr myfloats_jfieldId; - - // Metadata.xml XPath field reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/field[@name='myfloats']" - [Register ("myfloats")] - public IList Myfloats { - get { - if (myfloats_jfieldId == IntPtr.Zero) - myfloats_jfieldId = JNIEnv.GetFieldID (class_ref, "myfloats", "[F"); - return global::Android.Runtime.JavaArray.FromJniHandle (JNIEnv.GetObjectField (((global::Java.Lang.Object) this).Handle, myfloats_jfieldId), JniHandleOwnership.TransferLocalRef); - } - set { - if (myfloats_jfieldId == IntPtr.Zero) - myfloats_jfieldId = JNIEnv.GetFieldID (class_ref, "myfloats", "[F"); - IntPtr native_value = global::Android.Runtime.JavaArray.ToLocalJniHandle (value); - try { - JNIEnv.SetField (((global::Java.Lang.Object) this).Handle, myfloats_jfieldId, native_value); - } finally { - JNIEnv.DeleteLocalRef (native_value); - } - } - } - - static IntPtr mydoubles_jfieldId; - - // Metadata.xml XPath field reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/field[@name='mydoubles']" - [Register ("mydoubles")] - public IList Mydoubles { - get { - if (mydoubles_jfieldId == IntPtr.Zero) - mydoubles_jfieldId = JNIEnv.GetFieldID (class_ref, "mydoubles", "[D"); - return global::Android.Runtime.JavaArray.FromJniHandle (JNIEnv.GetObjectField (((global::Java.Lang.Object) this).Handle, mydoubles_jfieldId), JniHandleOwnership.TransferLocalRef); - } - set { - if (mydoubles_jfieldId == IntPtr.Zero) - mydoubles_jfieldId = JNIEnv.GetFieldID (class_ref, "mydoubles", "[D"); - IntPtr native_value = global::Android.Runtime.JavaArray.ToLocalJniHandle (value); - try { - JNIEnv.SetField (((global::Java.Lang.Object) this).Handle, mydoubles_jfieldId, native_value); - } finally { - JNIEnv.DeleteLocalRef (native_value); - } - } - } - - static IntPtr mylongs_jfieldId; - - // Metadata.xml XPath field reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/field[@name='mylongs']" - [Register ("mylongs")] - public IList Mylongs { - get { - if (mylongs_jfieldId == IntPtr.Zero) - mylongs_jfieldId = JNIEnv.GetFieldID (class_ref, "mylongs", "[J"); - return global::Android.Runtime.JavaArray.FromJniHandle (JNIEnv.GetObjectField (((global::Java.Lang.Object) this).Handle, mylongs_jfieldId), JniHandleOwnership.TransferLocalRef); - } - set { - if (mylongs_jfieldId == IntPtr.Zero) - mylongs_jfieldId = JNIEnv.GetFieldID (class_ref, "mylongs", "[J"); - IntPtr native_value = global::Android.Runtime.JavaArray.ToLocalJniHandle (value); - try { - JNIEnv.SetField (((global::Java.Lang.Object) this).Handle, mylongs_jfieldId, native_value); - } finally { - JNIEnv.DeleteLocalRef (native_value); - } - } - } - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("xamarin/test/SomeObject", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (SomeObject); } - } - - protected SomeObject (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - } -} diff --git a/tests/generator-Tests/expected/CSharpKeywords/CSharpKeywords.xml b/tests/generator-Tests/expected/CSharpKeywords/CSharpKeywords.xml deleted file mode 100644 index 9ceb7d5b7..000000000 --- a/tests/generator-Tests/expected/CSharpKeywords/CSharpKeywords.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/generator-Tests/expected/CSharpKeywords/Mono.Android.projitems b/tests/generator-Tests/expected/CSharpKeywords/Mono.Android.projitems deleted file mode 100644 index 1e80d027f..000000000 --- a/tests/generator-Tests/expected/CSharpKeywords/Mono.Android.projitems +++ /dev/null @@ -1,16 +0,0 @@ - - - - $(DefineConstants);ANDROID_1;ANDROID_2;ANDROID_3;ANDROID_4 - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/generator-Tests/expected/CSharpKeywords/Xamarin.Test.CSharpKeywords.cs b/tests/generator-Tests/expected/CSharpKeywords/Xamarin.Test.CSharpKeywords.cs deleted file mode 100644 index 00a561164..000000000 --- a/tests/generator-Tests/expected/CSharpKeywords/Xamarin.Test.CSharpKeywords.cs +++ /dev/null @@ -1,92 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Xamarin.Test { - - // Metadata.xml XPath class reference: path="/api/package[@name='xamarin.test']/class[@name='CSharpKeywords']" - [global::Android.Runtime.Register ("xamarin/test/CSharpKeywords", DoNotGenerateAcw=true)] - public partial class CSharpKeywords : global::Java.Lang.Object { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("xamarin/test/CSharpKeywords", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (CSharpKeywords); } - } - - protected CSharpKeywords (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static Delegate cb_usePartial_I; -#pragma warning disable 0169 - static Delegate GetUsePartial_IHandler () - { - if (cb_usePartial_I == null) - cb_usePartial_I = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPI_L) n_UsePartial_I); - return cb_usePartial_I; - } - - static IntPtr n_UsePartial_I (IntPtr jnienv, IntPtr native__this, int partial) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return JNIEnv.NewString (__this.UsePartial (partial)); - } -#pragma warning restore 0169 - - static IntPtr id_usePartial_I; - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='CSharpKeywords']/method[@name='usePartial' and count(parameter)=1 and parameter[1][@type='int']]" - [Register ("usePartial", "(I)Ljava/lang/String;", "GetUsePartial_IHandler")] - public virtual unsafe string UsePartial (int partial) - { - if (id_usePartial_I == IntPtr.Zero) - id_usePartial_I = JNIEnv.GetMethodID (class_ref, "usePartial", "(I)Ljava/lang/String;"); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (partial); - - if (((object) this).GetType () == ThresholdType) - return JNIEnv.GetString (JNIEnv.CallObjectMethod (((global::Java.Lang.Object) this).Handle, id_usePartial_I, __args), JniHandleOwnership.TransferLocalRef); - else - return JNIEnv.GetString (JNIEnv.CallNonvirtualObjectMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "usePartial", "(I)Ljava/lang/String;"), __args), JniHandleOwnership.TransferLocalRef); - } finally { - } - } - - static IntPtr id_useThis_Ljava_lang_String_; - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='CSharpKeywords']/method[@name='useThis' and count(parameter)=1 and parameter[1][@type='java.lang.String']]" - [Register ("useThis", "(Ljava/lang/String;)Ljava/lang/String;", "")] - public static unsafe string UseThis (string this_) - { - if (id_useThis_Ljava_lang_String_ == IntPtr.Zero) - id_useThis_Ljava_lang_String_ = JNIEnv.GetStaticMethodID (class_ref, "useThis", "(Ljava/lang/String;)Ljava/lang/String;"); - IntPtr native_this = JNIEnv.NewString ((string)this_); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_this); - string __ret = JNIEnv.GetString (JNIEnv.CallStaticObjectMethod (class_ref, id_useThis_Ljava_lang_String_, __args), JniHandleOwnership.TransferLocalRef); - return __ret; - } finally { - JNIEnv.DeleteLocalRef (native_this); - } - } - - } -} diff --git a/tests/generator-Tests/expected/Constructors/Mono.Android.projitems b/tests/generator-Tests/expected/Constructors/Mono.Android.projitems deleted file mode 100644 index 82192a590..000000000 --- a/tests/generator-Tests/expected/Constructors/Mono.Android.projitems +++ /dev/null @@ -1,16 +0,0 @@ - - - - $(DefineConstants);ANDROID_1;ANDROID_2;ANDROID_3;ANDROID_4 - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/generator-Tests/expected/Constructors/Xamarin.Test.SomeObject.cs b/tests/generator-Tests/expected/Constructors/Xamarin.Test.SomeObject.cs deleted file mode 100644 index 662bb2a3e..000000000 --- a/tests/generator-Tests/expected/Constructors/Xamarin.Test.SomeObject.cs +++ /dev/null @@ -1,98 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Xamarin.Test { - - // Metadata.xml XPath class reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']" - [global::Android.Runtime.Register ("xamarin/test/SomeObject", DoNotGenerateAcw=true)] - public partial class SomeObject : global::Java.Lang.Object { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("xamarin/test/SomeObject", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (SomeObject); } - } - - protected SomeObject (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static IntPtr id_ctor; - // Metadata.xml XPath constructor reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/constructor[@name='SomeObject' and count(parameter)=0]" - [Register (".ctor", "()V", "")] - [Obsolete (@"deprecated")] - public unsafe SomeObject () - : base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer) - { - if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero) - return; - - try { - if (((object) this).GetType () != typeof (SomeObject)) { - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (((object) this).GetType (), "()V"), - JniHandleOwnership.TransferLocalRef); - global::Android.Runtime.JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, "()V"); - return; - } - - if (id_ctor == IntPtr.Zero) - id_ctor = JNIEnv.GetMethodID (class_ref, "", "()V"); - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (class_ref, id_ctor), - JniHandleOwnership.TransferLocalRef); - JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, class_ref, id_ctor); - } finally { - } - } - - static IntPtr id_ctor_I; - // Metadata.xml XPath constructor reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/constructor[@name='SomeObject' and count(parameter)=1 and parameter[1][@type='int']]" - [Register (".ctor", "(I)V", "")] - public unsafe SomeObject (int aint) - : base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer) - { - if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero) - return; - - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (aint); - if (((object) this).GetType () != typeof (SomeObject)) { - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (((object) this).GetType (), "(I)V", __args), - JniHandleOwnership.TransferLocalRef); - global::Android.Runtime.JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, "(I)V", __args); - return; - } - - if (id_ctor_I == IntPtr.Zero) - id_ctor_I = JNIEnv.GetMethodID (class_ref, "", "(I)V"); - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (class_ref, id_ctor_I, __args), - JniHandleOwnership.TransferLocalRef); - JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, class_ref, id_ctor_I, __args); - } finally { - } - } - - } -} diff --git a/tests/generator-Tests/expected/Constructors/Xamarin.Test.SomeObject2.cs b/tests/generator-Tests/expected/Constructors/Xamarin.Test.SomeObject2.cs deleted file mode 100644 index 8ab008553..000000000 --- a/tests/generator-Tests/expected/Constructors/Xamarin.Test.SomeObject2.cs +++ /dev/null @@ -1,69 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Xamarin.Test { - - // Metadata.xml XPath class reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject2']" - [global::Android.Runtime.Register ("xamarin/test/SomeObject2", DoNotGenerateAcw=true)] - public sealed partial class SomeObject2 : global::Java.Lang.Object { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("xamarin/test/SomeObject2", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (SomeObject2); } - } - - internal SomeObject2 (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static IntPtr id_ctor_I; - // Metadata.xml XPath constructor reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject2']/constructor[@name='SomeObject2' and count(parameter)=1 and parameter[1][@type='int']]" - [Register (".ctor", "(I)V", "")] - public unsafe SomeObject2 (int aint) - : base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer) - { - if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero) - return; - - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (aint); - if (((object) this).GetType () != typeof (SomeObject2)) { - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (((object) this).GetType (), "(I)V", __args), - JniHandleOwnership.TransferLocalRef); - global::Android.Runtime.JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, "(I)V", __args); - return; - } - - if (id_ctor_I == IntPtr.Zero) - id_ctor_I = JNIEnv.GetMethodID (class_ref, "", "(I)V"); - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (class_ref, id_ctor_I, __args), - JniHandleOwnership.TransferLocalRef); - JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, class_ref, id_ctor_I, __args); - } finally { - } - } - - } -} diff --git a/tests/generator-Tests/expected/Core_ClassParse/Java.Lang.Object.cs b/tests/generator-Tests/expected/Core_ClassParse/Java.Lang.Object.cs deleted file mode 100644 index dd027b081..000000000 --- a/tests/generator-Tests/expected/Core_ClassParse/Java.Lang.Object.cs +++ /dev/null @@ -1,29 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Java.Lang { - - // Metadata.xml XPath class reference: path="/api/package[@name='java.lang']/class[@name='Object']" - [global::Android.Runtime.Register ("java/lang/Object", DoNotGenerateAcw=true)] - public partial class Object { - - internal static IntPtr java_class_handle; - internal static IntPtr class_ref { - get { - return JNIEnv.FindClass ("java/lang/Object", ref java_class_handle); - } - } - - } -} diff --git a/tests/generator-Tests/expected/Core_ClassParse/Java.Lang.String.cs b/tests/generator-Tests/expected/Core_ClassParse/Java.Lang.String.cs deleted file mode 100644 index 87e3da3d0..000000000 --- a/tests/generator-Tests/expected/Core_ClassParse/Java.Lang.String.cs +++ /dev/null @@ -1,39 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Java.Lang { - - // Metadata.xml XPath class reference: path="/api/package[@name='java.lang']/class[@name='String']" - [global::Android.Runtime.Register ("java/lang/String", DoNotGenerateAcw=true)] - public partial class String : global::Java.Lang.Object { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("java/lang/String", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (String); } - } - - protected String (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - } -} diff --git a/tests/generator-Tests/expected/Core_ClassParse/Mono.Android.projitems b/tests/generator-Tests/expected/Core_ClassParse/Mono.Android.projitems deleted file mode 100644 index 5a1d5a97e..000000000 --- a/tests/generator-Tests/expected/Core_ClassParse/Mono.Android.projitems +++ /dev/null @@ -1,18 +0,0 @@ - - - - $(DefineConstants);ANDROID_1;ANDROID_2;ANDROID_3;ANDROID_4 - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/generator-Tests/expected/Core_ClassParse/Xamarin.Google.Composable.MyClass.cs b/tests/generator-Tests/expected/Core_ClassParse/Xamarin.Google.Composable.MyClass.cs deleted file mode 100644 index 3b842c55f..000000000 --- a/tests/generator-Tests/expected/Core_ClassParse/Xamarin.Google.Composable.MyClass.cs +++ /dev/null @@ -1,39 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Xamarin.Google.Composable { - - // Metadata.xml XPath class reference: path="/api/package[@name='com.com.google.compose']/class[@name='MyClass']" - [global::Android.Runtime.Register ("com/com/google/compose/MyClass", DoNotGenerateAcw=true)] - public partial class MyClass : global::Java.Lang.Object { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("com/com/google/compose/MyClass", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (MyClass); } - } - - protected MyClass (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - } -} diff --git a/tests/generator-Tests/expected/Core_ClassParse/Xamarin.Test.Invalidnames.In.cs b/tests/generator-Tests/expected/Core_ClassParse/Xamarin.Test.Invalidnames.In.cs deleted file mode 100644 index 660d64872..000000000 --- a/tests/generator-Tests/expected/Core_ClassParse/Xamarin.Test.Invalidnames.In.cs +++ /dev/null @@ -1,39 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Xamarin.Test.Invalidnames { - - // Metadata.xml XPath class reference: path="/api/package[@name='xamarin.test.invalidnames']/class[@name='in']" - [global::Android.Runtime.Register ("xamarin/test/invalidnames/in", DoNotGenerateAcw=true)] - public partial class In : global::Java.Lang.Object { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("xamarin/test/invalidnames/in", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (In); } - } - - protected In (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - } -} diff --git a/tests/generator-Tests/expected/Core_ClassParse/Xamarin.Test.Invalidnames.InvalidNameMembers.cs b/tests/generator-Tests/expected/Core_ClassParse/Xamarin.Test.Invalidnames.InvalidNameMembers.cs deleted file mode 100644 index 7717c3d05..000000000 --- a/tests/generator-Tests/expected/Core_ClassParse/Xamarin.Test.Invalidnames.InvalidNameMembers.cs +++ /dev/null @@ -1,39 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Xamarin.Test.Invalidnames { - - // Metadata.xml XPath class reference: path="/api/package[@name='xamarin.test.invalidnames']/class[@name='InvalidNameMembers']" - [global::Android.Runtime.Register ("xamarin/test/invalidnames/InvalidNameMembers", DoNotGenerateAcw=true)] - public partial class InvalidNameMembers : global::Java.Lang.Object { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("xamarin/test/invalidnames/InvalidNameMembers", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (InvalidNameMembers); } - } - - protected InvalidNameMembers (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - } -} diff --git a/tests/generator-Tests/expected/Core_Jar2Xml/Android.Text.ISpannable.cs b/tests/generator-Tests/expected/Core_Jar2Xml/Android.Text.ISpannable.cs deleted file mode 100644 index 2dfa1dd7d..000000000 --- a/tests/generator-Tests/expected/Core_Jar2Xml/Android.Text.ISpannable.cs +++ /dev/null @@ -1,87 +0,0 @@ -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Android.Text { - - // Metadata.xml XPath interface reference: path="/api/package[@name='android.text']/interface[@name='Spannable']" - [Register ("android/text/Spannable", "", "Android.Text.ISpannableInvoker")] - public partial interface ISpannable : global::Android.Text.ISpanned { - - } - - [global::Android.Runtime.Register ("android/text/Spannable", DoNotGenerateAcw=true)] - internal partial class ISpannableInvoker : global::Java.Lang.Object, ISpannable { - - static IntPtr java_class_ref = JNIEnv.FindClass ("android/text/Spannable"); - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (ISpannableInvoker); } - } - - new IntPtr class_ref; - - public static ISpannable GetObject (IntPtr handle, JniHandleOwnership transfer) - { - return global::Java.Lang.Object.GetObject (handle, transfer); - } - - static IntPtr Validate (IntPtr handle) - { - if (!JNIEnv.IsInstanceOf (handle, java_class_ref)) - throw new InvalidCastException (string.Format ("Unable to convert instance of type '{0}' to type '{1}'.", - JNIEnv.GetClassNameFromInstance (handle), "android.text.Spannable")); - return handle; - } - - protected override void Dispose (bool disposing) - { - if (this.class_ref != IntPtr.Zero) - JNIEnv.DeleteGlobalRef (this.class_ref); - this.class_ref = IntPtr.Zero; - base.Dispose (disposing); - } - - public ISpannableInvoker (IntPtr handle, JniHandleOwnership transfer) : base (Validate (handle), transfer) - { - IntPtr local_ref = JNIEnv.GetObjectClass (((global::Java.Lang.Object) this).Handle); - this.class_ref = JNIEnv.NewGlobalRef (local_ref); - JNIEnv.DeleteLocalRef (local_ref); - } - - static Delegate cb_getSpanFlags_Ljava_lang_Object_; -#pragma warning disable 0169 - static Delegate GetGetSpanFlags_Ljava_lang_Object_Handler () - { - if (cb_getSpanFlags_Ljava_lang_Object_ == null) - cb_getSpanFlags_Ljava_lang_Object_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_I) n_GetSpanFlags_Ljava_lang_Object_); - return cb_getSpanFlags_Ljava_lang_Object_; - } - - static int n_GetSpanFlags_Ljava_lang_Object_ (IntPtr jnienv, IntPtr native__this, IntPtr native_tag) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var tag = global::Java.Lang.Object.GetObject (native_tag, JniHandleOwnership.DoNotTransfer); - int __ret = (int) __this.GetSpanFlags (tag); - return __ret; - } -#pragma warning restore 0169 - - IntPtr id_getSpanFlags_Ljava_lang_Object_; - public unsafe global::Android.Text.SpanTypes GetSpanFlags (global::Java.Lang.Object tag) - { - if (id_getSpanFlags_Ljava_lang_Object_ == IntPtr.Zero) - id_getSpanFlags_Ljava_lang_Object_ = JNIEnv.GetMethodID (class_ref, "getSpanFlags", "(Ljava/lang/Object;)I"); - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (tag); - var __ret = (global::Android.Text.SpanTypes) JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_getSpanFlags_Ljava_lang_Object_, __args); - return __ret; - } - - } - -} diff --git a/tests/generator-Tests/expected/Core_Jar2Xml/Android.Text.ISpanned.cs b/tests/generator-Tests/expected/Core_Jar2Xml/Android.Text.ISpanned.cs deleted file mode 100644 index 99a2ea8e2..000000000 --- a/tests/generator-Tests/expected/Core_Jar2Xml/Android.Text.ISpanned.cs +++ /dev/null @@ -1,92 +0,0 @@ -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Android.Text { - - // Metadata.xml XPath interface reference: path="/api/package[@name='android.text']/interface[@name='Spanned']" - [Register ("android/text/Spanned", "", "Android.Text.ISpannedInvoker")] - public partial interface ISpanned : IJavaObject { - - // Metadata.xml XPath method reference: path="/api/package[@name='android.text']/interface[@name='Spanned']/method[@name='getSpanFlags' and count(parameter)=1 and parameter[1][@type='java.lang.Object']]" - [return:global::Android.Runtime.GeneratedEnum] - [Register ("getSpanFlags", "(Ljava/lang/Object;)I", "GetGetSpanFlags_Ljava_lang_Object_Handler:Android.Text.ISpannedInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")] - global::Android.Text.SpanTypes GetSpanFlags (global::Java.Lang.Object tag); - - } - - [global::Android.Runtime.Register ("android/text/Spanned", DoNotGenerateAcw=true)] - internal partial class ISpannedInvoker : global::Java.Lang.Object, ISpanned { - - static IntPtr java_class_ref = JNIEnv.FindClass ("android/text/Spanned"); - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (ISpannedInvoker); } - } - - new IntPtr class_ref; - - public static ISpanned GetObject (IntPtr handle, JniHandleOwnership transfer) - { - return global::Java.Lang.Object.GetObject (handle, transfer); - } - - static IntPtr Validate (IntPtr handle) - { - if (!JNIEnv.IsInstanceOf (handle, java_class_ref)) - throw new InvalidCastException (string.Format ("Unable to convert instance of type '{0}' to type '{1}'.", - JNIEnv.GetClassNameFromInstance (handle), "android.text.Spanned")); - return handle; - } - - protected override void Dispose (bool disposing) - { - if (this.class_ref != IntPtr.Zero) - JNIEnv.DeleteGlobalRef (this.class_ref); - this.class_ref = IntPtr.Zero; - base.Dispose (disposing); - } - - public ISpannedInvoker (IntPtr handle, JniHandleOwnership transfer) : base (Validate (handle), transfer) - { - IntPtr local_ref = JNIEnv.GetObjectClass (((global::Java.Lang.Object) this).Handle); - this.class_ref = JNIEnv.NewGlobalRef (local_ref); - JNIEnv.DeleteLocalRef (local_ref); - } - - static Delegate cb_getSpanFlags_Ljava_lang_Object_; -#pragma warning disable 0169 - static Delegate GetGetSpanFlags_Ljava_lang_Object_Handler () - { - if (cb_getSpanFlags_Ljava_lang_Object_ == null) - cb_getSpanFlags_Ljava_lang_Object_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_I) n_GetSpanFlags_Ljava_lang_Object_); - return cb_getSpanFlags_Ljava_lang_Object_; - } - - static int n_GetSpanFlags_Ljava_lang_Object_ (IntPtr jnienv, IntPtr native__this, IntPtr native_tag) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var tag = global::Java.Lang.Object.GetObject (native_tag, JniHandleOwnership.DoNotTransfer); - int __ret = (int) __this.GetSpanFlags (tag); - return __ret; - } -#pragma warning restore 0169 - - IntPtr id_getSpanFlags_Ljava_lang_Object_; - public unsafe global::Android.Text.SpanTypes GetSpanFlags (global::Java.Lang.Object tag) - { - if (id_getSpanFlags_Ljava_lang_Object_ == IntPtr.Zero) - id_getSpanFlags_Ljava_lang_Object_ = JNIEnv.GetMethodID (class_ref, "getSpanFlags", "(Ljava/lang/Object;)I"); - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (tag); - var __ret = (global::Android.Text.SpanTypes) JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_getSpanFlags_Ljava_lang_Object_, __args); - return __ret; - } - - } - -} diff --git a/tests/generator-Tests/expected/Core_Jar2Xml/Android.Text.SpannableString.cs b/tests/generator-Tests/expected/Core_Jar2Xml/Android.Text.SpannableString.cs deleted file mode 100644 index ffc5743de..000000000 --- a/tests/generator-Tests/expected/Core_Jar2Xml/Android.Text.SpannableString.cs +++ /dev/null @@ -1,140 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Android.Text { - - // Metadata.xml XPath class reference: path="/api/package[@name='android.text']/class[@name='SpannableString']" - [global::Android.Runtime.Register ("android/text/SpannableString", DoNotGenerateAcw=true)] - public partial class SpannableString : global::Android.Text.SpannableStringInternal, global::Android.Text.ISpannable { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("android/text/SpannableString", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (SpannableString); } - } - - protected SpannableString (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static IntPtr id_ctor_Ljava_lang_CharSequence_; - // Metadata.xml XPath constructor reference: path="/api/package[@name='android.text']/class[@name='SpannableString']/constructor[@name='SpannableString' and count(parameter)=1 and parameter[1][@type='java.lang.CharSequence']]" - [Register (".ctor", "(Ljava/lang/CharSequence;)V", "")] - public unsafe SpannableString (global::Java.Lang.ICharSequence source) - : base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer) - { - if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero) - return; - - IntPtr native_source = CharSequence.ToLocalJniHandle (source); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_source); - if (((object) this).GetType () != typeof (SpannableString)) { - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (((object) this).GetType (), "(Ljava/lang/CharSequence;)V", __args), - JniHandleOwnership.TransferLocalRef); - global::Android.Runtime.JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, "(Ljava/lang/CharSequence;)V", __args); - return; - } - - if (id_ctor_Ljava_lang_CharSequence_ == IntPtr.Zero) - id_ctor_Ljava_lang_CharSequence_ = JNIEnv.GetMethodID (class_ref, "", "(Ljava/lang/CharSequence;)V"); - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (class_ref, id_ctor_Ljava_lang_CharSequence_, __args), - JniHandleOwnership.TransferLocalRef); - JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, class_ref, id_ctor_Ljava_lang_CharSequence_, __args); - } finally { - JNIEnv.DeleteLocalRef (native_source); - } - } - - [Register (".ctor", "(Ljava/lang/CharSequence;)V", "")] - public unsafe SpannableString (string source) - : base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer) - { - if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero) - return; - - IntPtr native_source = CharSequence.ToLocalJniHandle (source); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_source); - if (((object) this).GetType () != typeof (SpannableString)) { - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (((object) this).GetType (), "(Ljava/lang/CharSequence;)V", __args), - JniHandleOwnership.TransferLocalRef); - global::Android.Runtime.JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, "(Ljava/lang/CharSequence;)V", __args); - return; - } - - if (id_ctor_Ljava_lang_CharSequence_ == IntPtr.Zero) - id_ctor_Ljava_lang_CharSequence_ = JNIEnv.GetMethodID (class_ref, "", "(Ljava/lang/CharSequence;)V"); - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (class_ref, id_ctor_Ljava_lang_CharSequence_, __args), - JniHandleOwnership.TransferLocalRef); - JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, class_ref, id_ctor_Ljava_lang_CharSequence_, __args); - } finally { - JNIEnv.DeleteLocalRef (native_source); - } - } - - static Delegate cb_getSpanFlags_Ljava_lang_Object_; -#pragma warning disable 0169 - static Delegate GetGetSpanFlags_Ljava_lang_Object_Handler () - { - if (cb_getSpanFlags_Ljava_lang_Object_ == null) - cb_getSpanFlags_Ljava_lang_Object_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_I) n_GetSpanFlags_Ljava_lang_Object_); - return cb_getSpanFlags_Ljava_lang_Object_; - } - - static int n_GetSpanFlags_Ljava_lang_Object_ (IntPtr jnienv, IntPtr native__this, IntPtr native_what) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var what = global::Java.Lang.Object.GetObject (native_what, JniHandleOwnership.DoNotTransfer); - int __ret = (int) __this.GetSpanFlags (what); - return __ret; - } -#pragma warning restore 0169 - - static IntPtr id_getSpanFlags_Ljava_lang_Object_; - // Metadata.xml XPath method reference: path="/api/package[@name='android.text']/class[@name='SpannableString']/method[@name='getSpanFlags' and count(parameter)=1 and parameter[1][@type='java.lang.Object']]" - [Register ("getSpanFlags", "(Ljava/lang/Object;)I", "GetGetSpanFlags_Ljava_lang_Object_Handler")] - public override unsafe global::Android.Text.SpanTypes GetSpanFlags (global::Java.Lang.Object what) - { - if (id_getSpanFlags_Ljava_lang_Object_ == IntPtr.Zero) - id_getSpanFlags_Ljava_lang_Object_ = JNIEnv.GetMethodID (class_ref, "getSpanFlags", "(Ljava/lang/Object;)I"); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (what); - - global::Android.Text.SpanTypes __ret; - if (((object) this).GetType () == ThresholdType) - __ret = (global::Android.Text.SpanTypes) JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_getSpanFlags_Ljava_lang_Object_, __args); - else - __ret = (global::Android.Text.SpanTypes) JNIEnv.CallNonvirtualIntMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "getSpanFlags", "(Ljava/lang/Object;)I"), __args); - return __ret; - } finally { - } - } - - } -} diff --git a/tests/generator-Tests/expected/Core_Jar2Xml/Android.Text.SpannableStringInternal.cs b/tests/generator-Tests/expected/Core_Jar2Xml/Android.Text.SpannableStringInternal.cs deleted file mode 100644 index e9cc92aac..000000000 --- a/tests/generator-Tests/expected/Core_Jar2Xml/Android.Text.SpannableStringInternal.cs +++ /dev/null @@ -1,91 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Android.Text { - - // Metadata.xml XPath class reference: path="/api/package[@name='android.text']/class[@name='SpannableStringInternal']" - [global::Android.Runtime.Register ("android/text/SpannableStringInternal", DoNotGenerateAcw=true)] - public abstract partial class SpannableStringInternal : global::Java.Lang.Object { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("android/text/SpannableStringInternal", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (SpannableStringInternal); } - } - - protected SpannableStringInternal (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static Delegate cb_getSpanFlags_Ljava_lang_Object_; -#pragma warning disable 0169 - static Delegate GetGetSpanFlags_Ljava_lang_Object_Handler () - { - if (cb_getSpanFlags_Ljava_lang_Object_ == null) - cb_getSpanFlags_Ljava_lang_Object_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_I) n_GetSpanFlags_Ljava_lang_Object_); - return cb_getSpanFlags_Ljava_lang_Object_; - } - - static int n_GetSpanFlags_Ljava_lang_Object_ (IntPtr jnienv, IntPtr native__this, IntPtr native_p0) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var p0 = global::Java.Lang.Object.GetObject (native_p0, JniHandleOwnership.DoNotTransfer); - int __ret = (int) __this.GetSpanFlags (p0); - return __ret; - } -#pragma warning restore 0169 - - static IntPtr id_getSpanFlags_Ljava_lang_Object_; - // Metadata.xml XPath method reference: path="/api/package[@name='android.text']/class[@name='SpannableStringInternal']/method[@name='getSpanFlags' and count(parameter)=1 and parameter[1][@type='java.lang.Object']]" - [return:global::Android.Runtime.GeneratedEnum] - [Register ("getSpanFlags", "(Ljava/lang/Object;)I", "GetGetSpanFlags_Ljava_lang_Object_Handler")] - public virtual unsafe global::Android.Text.SpanTypes GetSpanFlags (global::Java.Lang.Object p0) - { - if (id_getSpanFlags_Ljava_lang_Object_ == IntPtr.Zero) - id_getSpanFlags_Ljava_lang_Object_ = JNIEnv.GetMethodID (class_ref, "getSpanFlags", "(Ljava/lang/Object;)I"); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (p0); - - global::Android.Text.SpanTypes __ret; - if (((object) this).GetType () == ThresholdType) - __ret = (global::Android.Text.SpanTypes) JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_getSpanFlags_Ljava_lang_Object_, __args); - else - __ret = (global::Android.Text.SpanTypes) JNIEnv.CallNonvirtualIntMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "getSpanFlags", "(Ljava/lang/Object;)I"), __args); - return __ret; - } finally { - } - } - - } - - [global::Android.Runtime.Register ("android/text/SpannableStringInternal", DoNotGenerateAcw=true)] - internal partial class SpannableStringInternalInvoker : SpannableStringInternal { - - public SpannableStringInternalInvoker (IntPtr handle, JniHandleOwnership transfer) : base (handle, transfer) {} - - protected override global::System.Type ThresholdType { - get { return typeof (SpannableStringInternalInvoker); } - } - - } - -} diff --git a/tests/generator-Tests/expected/Core_Jar2Xml/Android.Views.View.cs b/tests/generator-Tests/expected/Core_Jar2Xml/Android.Views.View.cs deleted file mode 100644 index 2396b7a88..000000000 --- a/tests/generator-Tests/expected/Core_Jar2Xml/Android.Views.View.cs +++ /dev/null @@ -1,285 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Android.Views { - - // Metadata.xml XPath class reference: path="/api/package[@name='android.view']/class[@name='View']" - [global::Android.Runtime.Register ("android/view/View", DoNotGenerateAcw=true)] - public partial class View : global::Java.Lang.Object { - - // Metadata.xml XPath interface reference: path="/api/package[@name='android.view']/interface[@name='View.OnClickListener']" - [Register ("android/view/View$OnClickListener", "", "Android.Views.View/IOnClickListenerInvoker")] - public partial interface IOnClickListener : IJavaObject { - - // Metadata.xml XPath method reference: path="/api/package[@name='android.view']/interface[@name='View.OnClickListener']/method[@name='onClick' and count(parameter)=1 and parameter[1][@type='android.view.View']]" - [Register ("onClick", "(Landroid/view/View;)V", "GetOnClick_Landroid_view_View_Handler:Android.Views.View/IOnClickListenerInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")] - void OnClick (global::Android.Views.View v); - - } - - [global::Android.Runtime.Register ("android/view/View$OnClickListener", DoNotGenerateAcw=true)] - internal partial class IOnClickListenerInvoker : global::Java.Lang.Object, IOnClickListener { - - static IntPtr java_class_ref = JNIEnv.FindClass ("android/view/View$OnClickListener"); - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (IOnClickListenerInvoker); } - } - - new IntPtr class_ref; - - public static IOnClickListener GetObject (IntPtr handle, JniHandleOwnership transfer) - { - return global::Java.Lang.Object.GetObject (handle, transfer); - } - - static IntPtr Validate (IntPtr handle) - { - if (!JNIEnv.IsInstanceOf (handle, java_class_ref)) - throw new InvalidCastException (string.Format ("Unable to convert instance of type '{0}' to type '{1}'.", - JNIEnv.GetClassNameFromInstance (handle), "android.view.View.OnClickListener")); - return handle; - } - - protected override void Dispose (bool disposing) - { - if (this.class_ref != IntPtr.Zero) - JNIEnv.DeleteGlobalRef (this.class_ref); - this.class_ref = IntPtr.Zero; - base.Dispose (disposing); - } - - public IOnClickListenerInvoker (IntPtr handle, JniHandleOwnership transfer) : base (Validate (handle), transfer) - { - IntPtr local_ref = JNIEnv.GetObjectClass (((global::Java.Lang.Object) this).Handle); - this.class_ref = JNIEnv.NewGlobalRef (local_ref); - JNIEnv.DeleteLocalRef (local_ref); - } - - static Delegate cb_onClick_Landroid_view_View_; -#pragma warning disable 0169 - static Delegate GetOnClick_Landroid_view_View_Handler () - { - if (cb_onClick_Landroid_view_View_ == null) - cb_onClick_Landroid_view_View_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_V) n_OnClick_Landroid_view_View_); - return cb_onClick_Landroid_view_View_; - } - - static void n_OnClick_Landroid_view_View_ (IntPtr jnienv, IntPtr native__this, IntPtr native_v) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var v = global::Java.Lang.Object.GetObject (native_v, JniHandleOwnership.DoNotTransfer); - __this.OnClick (v); - } -#pragma warning restore 0169 - - IntPtr id_onClick_Landroid_view_View_; - public unsafe void OnClick (global::Android.Views.View v) - { - if (id_onClick_Landroid_view_View_ == IntPtr.Zero) - id_onClick_Landroid_view_View_ = JNIEnv.GetMethodID (class_ref, "onClick", "(Landroid/view/View;)V"); - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (v); - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_onClick_Landroid_view_View_, __args); - } - - } - - [global::Android.Runtime.Register ("mono/android/view/View_OnClickListenerImplementor")] - internal sealed partial class IOnClickListenerImplementor : global::Java.Lang.Object, IOnClickListener { - - public IOnClickListenerImplementor () - : base ( - global::Android.Runtime.JNIEnv.StartCreateInstance ("mono/android/view/View_OnClickListenerImplementor", "()V"), - JniHandleOwnership.TransferLocalRef) - { - global::Android.Runtime.JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, "()V"); - } - -#pragma warning disable 0649 - public EventHandler Handler; -#pragma warning restore 0649 - - public void OnClick (global::Android.Views.View v) - { - var __h = Handler; - if (__h != null) - __h (v, new EventArgs ()); - } - - internal static bool __IsEmpty (IOnClickListenerImplementor value) - { - return value.Handler == null; - } - } - - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("android/view/View", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (View); } - } - - protected View (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static Delegate cb_setOnClickListener_Landroid_view_View_OnClickListener_; -#pragma warning disable 0169 - static Delegate GetSetOnClickListener_Landroid_view_View_OnClickListener_Handler () - { - if (cb_setOnClickListener_Landroid_view_View_OnClickListener_ == null) - cb_setOnClickListener_Landroid_view_View_OnClickListener_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_V) n_SetOnClickListener_Landroid_view_View_OnClickListener_); - return cb_setOnClickListener_Landroid_view_View_OnClickListener_; - } - - static void n_SetOnClickListener_Landroid_view_View_OnClickListener_ (IntPtr jnienv, IntPtr native__this, IntPtr native_l) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var l = (global::Android.Views.View.IOnClickListener)global::Java.Lang.Object.GetObject (native_l, JniHandleOwnership.DoNotTransfer); - __this.SetOnClickListener (l); - } -#pragma warning restore 0169 - - static IntPtr id_setOnClickListener_Landroid_view_View_OnClickListener_; - // Metadata.xml XPath method reference: path="/api/package[@name='android.view']/class[@name='View']/method[@name='setOnClickListener' and count(parameter)=1 and parameter[1][@type='android.view.View.OnClickListener']]" - [Register ("setOnClickListener", "(Landroid/view/View$OnClickListener;)V", "GetSetOnClickListener_Landroid_view_View_OnClickListener_Handler")] - public virtual unsafe void SetOnClickListener (global::Android.Views.View.IOnClickListener l) - { - if (id_setOnClickListener_Landroid_view_View_OnClickListener_ == IntPtr.Zero) - id_setOnClickListener_Landroid_view_View_OnClickListener_ = JNIEnv.GetMethodID (class_ref, "setOnClickListener", "(Landroid/view/View$OnClickListener;)V"); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (l); - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_setOnClickListener_Landroid_view_View_OnClickListener_, __args); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "setOnClickListener", "(Landroid/view/View$OnClickListener;)V"), __args); - } finally { - } - } - - static Delegate cb_setOn123Listener_Landroid_view_View_OnClickListener_; -#pragma warning disable 0169 - static Delegate GetSetOn123Listener_Landroid_view_View_OnClickListener_Handler () - { - if (cb_setOn123Listener_Landroid_view_View_OnClickListener_ == null) - cb_setOn123Listener_Landroid_view_View_OnClickListener_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_V) n_SetOn123Listener_Landroid_view_View_OnClickListener_); - return cb_setOn123Listener_Landroid_view_View_OnClickListener_; - } - - static void n_SetOn123Listener_Landroid_view_View_OnClickListener_ (IntPtr jnienv, IntPtr native__this, IntPtr native_l) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var l = (global::Android.Views.View.IOnClickListener)global::Java.Lang.Object.GetObject (native_l, JniHandleOwnership.DoNotTransfer); - __this.SetOn123Listener (l); - } -#pragma warning restore 0169 - - static IntPtr id_setOn123Listener_Landroid_view_View_OnClickListener_; - // Metadata.xml XPath method reference: path="/api/package[@name='android.view']/class[@name='View']/method[@name='setOn123Listener' and count(parameter)=1 and parameter[1][@type='android.view.View.OnClickListener']]" - [Register ("setOn123Listener", "(Landroid/view/View$OnClickListener;)V", "GetSetOn123Listener_Landroid_view_View_OnClickListener_Handler")] - public virtual unsafe void SetOn123Listener (global::Android.Views.View.IOnClickListener l) - { - if (id_setOn123Listener_Landroid_view_View_OnClickListener_ == IntPtr.Zero) - id_setOn123Listener_Landroid_view_View_OnClickListener_ = JNIEnv.GetMethodID (class_ref, "setOn123Listener", "(Landroid/view/View$OnClickListener;)V"); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (l); - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_setOn123Listener_Landroid_view_View_OnClickListener_, __args); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "setOn123Listener", "(Landroid/view/View$OnClickListener;)V"), __args); - } finally { - } - } - - static Delegate cb_addTouchables_Ljava_util_ArrayList_; -#pragma warning disable 0169 - static Delegate GetAddTouchables_Ljava_util_ArrayList_Handler () - { - if (cb_addTouchables_Ljava_util_ArrayList_ == null) - cb_addTouchables_Ljava_util_ArrayList_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_V) n_AddTouchables_Ljava_util_ArrayList_); - return cb_addTouchables_Ljava_util_ArrayList_; - } - - static void n_AddTouchables_Ljava_util_ArrayList_ (IntPtr jnienv, IntPtr native__this, IntPtr native_views) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var views = global::Android.Runtime.JavaList.FromJniHandle (native_views, JniHandleOwnership.DoNotTransfer); - __this.AddTouchables (views); - } -#pragma warning restore 0169 - - static IntPtr id_addTouchables_Ljava_util_ArrayList_; - // Metadata.xml XPath method reference: path="/api/package[@name='android.view']/class[@name='View']/method[@name='addTouchables' and count(parameter)=1 and parameter[1][@type='java.util.ArrayList<android.view.View>']]" - [Register ("addTouchables", "(Ljava/util/ArrayList;)V", "GetAddTouchables_Ljava_util_ArrayList_Handler")] - public virtual unsafe void AddTouchables (global::System.Collections.Generic.IList views) - { - if (id_addTouchables_Ljava_util_ArrayList_ == IntPtr.Zero) - id_addTouchables_Ljava_util_ArrayList_ = JNIEnv.GetMethodID (class_ref, "addTouchables", "(Ljava/util/ArrayList;)V"); - IntPtr native_views = global::Android.Runtime.JavaList.ToLocalJniHandle (views); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_views); - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_addTouchables_Ljava_util_ArrayList_, __args); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "addTouchables", "(Ljava/util/ArrayList;)V"), __args); - } finally { - JNIEnv.DeleteLocalRef (native_views); - } - } - -#region "Event implementation for Android.Views.View.IOnClickListener" - public event EventHandler Click { - add { - global::Java.Interop.EventHelper.AddEventHandler( - ref weak_implementor_SetOnClickListener, - __CreateIOnClickListenerImplementor, - SetOnClickListener, - __h => __h.Handler += value); - } - remove { - global::Java.Interop.EventHelper.RemoveEventHandler( - ref weak_implementor_SetOnClickListener, - global::Android.Views.View.IOnClickListenerImplementor.__IsEmpty, - __v => SetOnClickListener (null), - __h => __h.Handler -= value); - } - } - - WeakReference weak_implementor_SetOnClickListener; - - global::Android.Views.View.IOnClickListenerImplementor __CreateIOnClickListenerImplementor () - { - return new global::Android.Views.View.IOnClickListenerImplementor (); - } -#endregion - } -} diff --git a/tests/generator-Tests/expected/Core_Jar2Xml/Java.Lang.Object.cs b/tests/generator-Tests/expected/Core_Jar2Xml/Java.Lang.Object.cs deleted file mode 100644 index dd027b081..000000000 --- a/tests/generator-Tests/expected/Core_Jar2Xml/Java.Lang.Object.cs +++ /dev/null @@ -1,29 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Java.Lang { - - // Metadata.xml XPath class reference: path="/api/package[@name='java.lang']/class[@name='Object']" - [global::Android.Runtime.Register ("java/lang/Object", DoNotGenerateAcw=true)] - public partial class Object { - - internal static IntPtr java_class_handle; - internal static IntPtr class_ref { - get { - return JNIEnv.FindClass ("java/lang/Object", ref java_class_handle); - } - } - - } -} diff --git a/tests/generator-Tests/expected/Core_Jar2Xml/Mono.Android.projitems b/tests/generator-Tests/expected/Core_Jar2Xml/Mono.Android.projitems deleted file mode 100644 index 0b239b193..000000000 --- a/tests/generator-Tests/expected/Core_Jar2Xml/Mono.Android.projitems +++ /dev/null @@ -1,21 +0,0 @@ - - - - $(DefineConstants);ANDROID_1;ANDROID_2;ANDROID_3;ANDROID_4 - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/generator-Tests/expected/EnumerationFixup/EnumerationFixup.xml b/tests/generator-Tests/expected/EnumerationFixup/EnumerationFixup.xml deleted file mode 100644 index 758f2bec3..000000000 --- a/tests/generator-Tests/expected/EnumerationFixup/EnumerationFixup.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/generator-Tests/expected/EnumerationFixup/EnumerationFixupMap.xml b/tests/generator-Tests/expected/EnumerationFixup/EnumerationFixupMap.xml deleted file mode 100644 index 10a23fd05..000000000 --- a/tests/generator-Tests/expected/EnumerationFixup/EnumerationFixupMap.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/tests/generator-Tests/expected/EnumerationFixup/Java.Interop.__TypeRegistrations.cs b/tests/generator-Tests/expected/EnumerationFixup/Java.Interop.__TypeRegistrations.cs deleted file mode 100644 index 0131993a1..000000000 --- a/tests/generator-Tests/expected/EnumerationFixup/Java.Interop.__TypeRegistrations.cs +++ /dev/null @@ -1,47 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Java.Interop { - - partial class __TypeRegistrations { - - public static void RegisterPackages () - { -#if MONODROID_TIMING - var start = DateTime.Now; - Android.Util.Log.Info ("MonoDroid-Timing", "RegisterPackages start: " + (start - new DateTime (1970, 1, 1)).TotalMilliseconds); -#endif // def MONODROID_TIMING - Java.Interop.TypeManager.RegisterPackages ( - new string[]{ - }, - new Converter[]{ - }); -#if MONODROID_TIMING - var end = DateTime.Now; - Android.Util.Log.Info ("MonoDroid-Timing", "RegisterPackages time: " + (end - new DateTime (1970, 1, 1)).TotalMilliseconds + " [elapsed: " + (end - start).TotalMilliseconds + " ms]"); -#endif // def MONODROID_TIMING - } - -#if NET5_0_OR_GREATER - [System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage ("Trimming", "IL2057")] -#endif - static Type Lookup (string[] mappings, string javaType) - { - var managedType = Java.Interop.TypeManager.LookupTypeMapping (mappings, javaType); - if (managedType == null) - return null; - return Type.GetType (managedType); - } - } -} diff --git a/tests/generator-Tests/expected/EnumerationFixup/Java.Lang.Object.cs b/tests/generator-Tests/expected/EnumerationFixup/Java.Lang.Object.cs deleted file mode 100644 index dd027b081..000000000 --- a/tests/generator-Tests/expected/EnumerationFixup/Java.Lang.Object.cs +++ /dev/null @@ -1,29 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Java.Lang { - - // Metadata.xml XPath class reference: path="/api/package[@name='java.lang']/class[@name='Object']" - [global::Android.Runtime.Register ("java/lang/Object", DoNotGenerateAcw=true)] - public partial class Object { - - internal static IntPtr java_class_handle; - internal static IntPtr class_ref { - get { - return JNIEnv.FindClass ("java/lang/Object", ref java_class_handle); - } - } - - } -} diff --git a/tests/generator-Tests/expected/EnumerationFixup/Mono.Android.projitems b/tests/generator-Tests/expected/EnumerationFixup/Mono.Android.projitems deleted file mode 100644 index 439ba2d49..000000000 --- a/tests/generator-Tests/expected/EnumerationFixup/Mono.Android.projitems +++ /dev/null @@ -1,19 +0,0 @@ - - - - $(DefineConstants);ANDROID_1;ANDROID_2;ANDROID_3;ANDROID_4 - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/generator-Tests/expected/EnumerationFixup/Xamarin.Test.DeprecatedItems.cs b/tests/generator-Tests/expected/EnumerationFixup/Xamarin.Test.DeprecatedItems.cs deleted file mode 100644 index f14c6a109..000000000 --- a/tests/generator-Tests/expected/EnumerationFixup/Xamarin.Test.DeprecatedItems.cs +++ /dev/null @@ -1,44 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Xamarin.Test { - - // Metadata.xml XPath class reference: path="/api/package[@name='xamarin.test']/class[@name='DeprecatedItems']" - [global::Android.Runtime.Register ("xamarin/test/DeprecatedItems", DoNotGenerateAcw=true)] - public partial class DeprecatedItems : global::Java.Lang.Object { - - - // Metadata.xml XPath field reference: path="/api/package[@name='xamarin.test']/class[@name='DeprecatedItems']/field[@name='My_Test_Field']" - [Register ("My_Test_Field")] - [Obsolete ("Field is deprecated", error: true)] - public const int MyTestField = (int) 1; - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("xamarin/test/DeprecatedItems", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (DeprecatedItems); } - } - - protected DeprecatedItems (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - } -} diff --git a/tests/generator-Tests/expected/EnumerationFixup/Xamarin.Test.SomeObject.cs b/tests/generator-Tests/expected/EnumerationFixup/Xamarin.Test.SomeObject.cs deleted file mode 100644 index 1b3b3fd43..000000000 --- a/tests/generator-Tests/expected/EnumerationFixup/Xamarin.Test.SomeObject.cs +++ /dev/null @@ -1,107 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Xamarin.Test { - - // Metadata.xml XPath class reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']" - [global::Android.Runtime.Register ("xamarin/test/SomeObject", DoNotGenerateAcw=true)] - public partial class SomeObject : global::Java.Lang.Object { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("xamarin/test/SomeObject", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (SomeObject); } - } - - protected SomeObject (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static Delegate cb_getSomeObjectProperty; -#pragma warning disable 0169 - static Delegate GetGetSomeObjectPropertyHandler () - { - if (cb_getSomeObjectProperty == null) - cb_getSomeObjectProperty = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_I) n_GetSomeObjectProperty); - return cb_getSomeObjectProperty; - } - - static int n_GetSomeObjectProperty (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return (int) __this.SomeObjectProperty; - } -#pragma warning restore 0169 - - static Delegate cb_setSomeObjectProperty_I; -#pragma warning disable 0169 - static Delegate GetSetSomeObjectProperty_IHandler () - { - if (cb_setSomeObjectProperty_I == null) - cb_setSomeObjectProperty_I = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPI_V) n_SetSomeObjectProperty_I); - return cb_setSomeObjectProperty_I; - } - - static void n_SetSomeObjectProperty_I (IntPtr jnienv, IntPtr native__this, int native_newvalue) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var newvalue = (global::Xamarin.Test.SomeValues) native_newvalue; - __this.SomeObjectProperty = newvalue; - } -#pragma warning restore 0169 - - static IntPtr id_getSomeObjectProperty; - static IntPtr id_setSomeObjectProperty_I; - public virtual unsafe global::Xamarin.Test.SomeValues SomeObjectProperty { - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/method[@name='getSomeObjectProperty' and count(parameter)=0]" - [Register ("getSomeObjectProperty", "()I", "GetGetSomeObjectPropertyHandler")] - get { - if (id_getSomeObjectProperty == IntPtr.Zero) - id_getSomeObjectProperty = JNIEnv.GetMethodID (class_ref, "getSomeObjectProperty", "()I"); - try { - - if (((object) this).GetType () == ThresholdType) - return (global::Xamarin.Test.SomeValues) JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_getSomeObjectProperty); - else - return (global::Xamarin.Test.SomeValues) JNIEnv.CallNonvirtualIntMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "getSomeObjectProperty", "()I")); - } finally { - } - } - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/method[@name='setSomeObjectProperty' and count(parameter)=1 and parameter[1][@type='int']]" - [Register ("setSomeObjectProperty", "(I)V", "GetSetSomeObjectProperty_IHandler")] - set { - if (id_setSomeObjectProperty_I == IntPtr.Zero) - id_setSomeObjectProperty_I = JNIEnv.GetMethodID (class_ref, "setSomeObjectProperty", "(I)V"); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue ((int) value); - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_setSomeObjectProperty_I, __args); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "setSomeObjectProperty", "(I)V"), __args); - } finally { - } - } - } - - } -} diff --git a/tests/generator-Tests/expected/EnumerationFixup/Xamarin.Test.SomeObject2.cs b/tests/generator-Tests/expected/EnumerationFixup/Xamarin.Test.SomeObject2.cs deleted file mode 100644 index dd82f5665..000000000 --- a/tests/generator-Tests/expected/EnumerationFixup/Xamarin.Test.SomeObject2.cs +++ /dev/null @@ -1,184 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Xamarin.Test { - - // Metadata.xml XPath class reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject2']" - [global::Android.Runtime.Register ("xamarin/test/SomeObject2", DoNotGenerateAcw=true)] - public partial class SomeObject2 : global::Xamarin.Test.SomeObject { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("xamarin/test/SomeObject2", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (SomeObject2); } - } - - protected SomeObject2 (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static Delegate cb_getSomeObjectProperty; -#pragma warning disable 0169 - static Delegate GetGetSomeObjectPropertyHandler () - { - if (cb_getSomeObjectProperty == null) - cb_getSomeObjectProperty = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_I) n_GetSomeObjectProperty); - return cb_getSomeObjectProperty; - } - - static int n_GetSomeObjectProperty (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return (int) __this.SomeObjectProperty; - } -#pragma warning restore 0169 - - static Delegate cb_setSomeObjectProperty_I; -#pragma warning disable 0169 - static Delegate GetSetSomeObjectProperty_IHandler () - { - if (cb_setSomeObjectProperty_I == null) - cb_setSomeObjectProperty_I = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPI_V) n_SetSomeObjectProperty_I); - return cb_setSomeObjectProperty_I; - } - - static void n_SetSomeObjectProperty_I (IntPtr jnienv, IntPtr native__this, int native_newvalue) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var newvalue = (global::Xamarin.Test.SomeValues) native_newvalue; - __this.SomeObjectProperty = newvalue; - } -#pragma warning restore 0169 - - static IntPtr id_getSomeObjectProperty; - static IntPtr id_setSomeObjectProperty_I; - public override unsafe global::Xamarin.Test.SomeValues SomeObjectProperty { - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject2']/method[@name='getSomeObjectProperty' and count(parameter)=0]" - [Register ("getSomeObjectProperty", "()I", "GetGetSomeObjectPropertyHandler")] - get { - if (id_getSomeObjectProperty == IntPtr.Zero) - id_getSomeObjectProperty = JNIEnv.GetMethodID (class_ref, "getSomeObjectProperty", "()I"); - try { - - if (((object) this).GetType () == ThresholdType) - return (global::Xamarin.Test.SomeValues) JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_getSomeObjectProperty); - else - return (global::Xamarin.Test.SomeValues) JNIEnv.CallNonvirtualIntMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "getSomeObjectProperty", "()I")); - } finally { - } - } - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject2']/method[@name='setSomeObjectProperty' and count(parameter)=1 and parameter[1][@type='int']]" - [Register ("setSomeObjectProperty", "(I)V", "GetSetSomeObjectProperty_IHandler")] - set { - if (id_setSomeObjectProperty_I == IntPtr.Zero) - id_setSomeObjectProperty_I = JNIEnv.GetMethodID (class_ref, "setSomeObjectProperty", "(I)V"); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue ((int) value); - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_setSomeObjectProperty_I, __args); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "setSomeObjectProperty", "(I)V"), __args); - } finally { - } - } - } - - static Delegate cb_getSomeObjectPropertyArray; -#pragma warning disable 0169 - static Delegate GetGetSomeObjectPropertyArrayHandler () - { - if (cb_getSomeObjectPropertyArray == null) - cb_getSomeObjectPropertyArray = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_L) n_GetSomeObjectPropertyArray); - return cb_getSomeObjectPropertyArray; - } - - static IntPtr n_GetSomeObjectPropertyArray (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return JNIEnv.NewArray (__this.GetSomeObjectPropertyArray ()); - } -#pragma warning restore 0169 - - static IntPtr id_getSomeObjectPropertyArray; - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject2']/method[@name='getSomeObjectPropertyArray' and count(parameter)=0]" - [return:global::Android.Runtime.GeneratedEnum] - [Register ("getSomeObjectPropertyArray", "()[I", "GetGetSomeObjectPropertyArrayHandler")] - public virtual unsafe global::Xamarin.Test.SomeValues[] GetSomeObjectPropertyArray () - { - if (id_getSomeObjectPropertyArray == IntPtr.Zero) - id_getSomeObjectPropertyArray = JNIEnv.GetMethodID (class_ref, "getSomeObjectPropertyArray", "()[I"); - try { - - if (((object) this).GetType () == ThresholdType) - return (global::Xamarin.Test.SomeValues[]) JNIEnv.GetArray (JNIEnv.CallObjectMethod (((global::Java.Lang.Object) this).Handle, id_getSomeObjectPropertyArray), JniHandleOwnership.TransferLocalRef, typeof (global::Xamarin.Test.SomeValues)); - else - return (global::Xamarin.Test.SomeValues[]) JNIEnv.GetArray (JNIEnv.CallNonvirtualObjectMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "getSomeObjectPropertyArray", "()[I")), JniHandleOwnership.TransferLocalRef, typeof (global::Xamarin.Test.SomeValues)); - } finally { - } - } - - static Delegate cb_setSomeObjectPropertyArray_arrayI; -#pragma warning disable 0169 - static Delegate GetSetSomeObjectPropertyArray_arrayIHandler () - { - if (cb_setSomeObjectPropertyArray_arrayI == null) - cb_setSomeObjectPropertyArray_arrayI = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_V) n_SetSomeObjectPropertyArray_arrayI); - return cb_setSomeObjectPropertyArray_arrayI; - } - - static void n_SetSomeObjectPropertyArray_arrayI (IntPtr jnienv, IntPtr native__this, IntPtr native_newvalue) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var newvalue = (global::Xamarin.Test.SomeValues[]) JNIEnv.GetArray (native_newvalue, JniHandleOwnership.DoNotTransfer, typeof (global::Xamarin.Test.SomeValues)); - __this.SetSomeObjectPropertyArray (newvalue); - if (newvalue != null) - JNIEnv.CopyArray (newvalue, native_newvalue); - } -#pragma warning restore 0169 - - static IntPtr id_setSomeObjectPropertyArray_arrayI; - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject2']/method[@name='setSomeObjectPropertyArray' and count(parameter)=1 and parameter[1][@type='int[]']]" - [Register ("setSomeObjectPropertyArray", "([I)V", "GetSetSomeObjectPropertyArray_arrayIHandler")] - public virtual unsafe void SetSomeObjectPropertyArray ([global::Android.Runtime.GeneratedEnum] global::Xamarin.Test.SomeValues[] newvalue) - { - if (id_setSomeObjectPropertyArray_arrayI == IntPtr.Zero) - id_setSomeObjectPropertyArray_arrayI = JNIEnv.GetMethodID (class_ref, "setSomeObjectPropertyArray", "([I)V"); - IntPtr native_newvalue = JNIEnv.NewArray (newvalue); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_newvalue); - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_setSomeObjectPropertyArray_arrayI, __args); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "setSomeObjectPropertyArray", "([I)V"), __args); - } finally { - if (newvalue != null) { - JNIEnv.CopyArray (native_newvalue, newvalue); - JNIEnv.DeleteLocalRef (native_newvalue); - } - } - } - - } -} diff --git a/tests/generator-Tests/expected/EnumerationFixup/Xamarin.Test.SomeValues.cs b/tests/generator-Tests/expected/EnumerationFixup/Xamarin.Test.SomeValues.cs deleted file mode 100644 index 83a61799d..000000000 --- a/tests/generator-Tests/expected/EnumerationFixup/Xamarin.Test.SomeValues.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Xamarin.Test { - public enum SomeValues { - [global::Android.Runtime.IntDefinition (null, JniField = "xamarin/test/SomeObject.SOME_VALUE")] - SomeValue = 0, - [global::Android.Runtime.IntDefinition (null, JniField = "xamarin/test/SomeObject.SOME_VALUE2")] - SomeValue2 = 1, - } -} diff --git a/tests/generator-Tests/expected/EnumerationFixup/__NamespaceMapping__.cs b/tests/generator-Tests/expected/EnumerationFixup/__NamespaceMapping__.cs deleted file mode 100644 index 223b17256..000000000 --- a/tests/generator-Tests/expected/EnumerationFixup/__NamespaceMapping__.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; - -[assembly:global::Android.Runtime.NamespaceMapping (Java = "java.lang", Managed="Java.Lang")] -[assembly:global::Android.Runtime.NamespaceMapping (Java = "xamarin.test", Managed="Xamarin.Test")] - -delegate int _JniMarshal_PP_I (IntPtr jnienv, IntPtr klass); -delegate IntPtr _JniMarshal_PP_L (IntPtr jnienv, IntPtr klass); -delegate void _JniMarshal_PPI_V (IntPtr jnienv, IntPtr klass, int p0); -delegate void _JniMarshal_PPL_V (IntPtr jnienv, IntPtr klass, IntPtr p0); diff --git a/tests/generator-Tests/expected/EnumerationFixup/enumlist b/tests/generator-Tests/expected/EnumerationFixup/enumlist deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/generator-Tests/expected/GenericArguments/Com.Google.Android.Exoplayer.Drm.FrameworkMediaDrm.cs b/tests/generator-Tests/expected/GenericArguments/Com.Google.Android.Exoplayer.Drm.FrameworkMediaDrm.cs deleted file mode 100644 index 6dea321d0..000000000 --- a/tests/generator-Tests/expected/GenericArguments/Com.Google.Android.Exoplayer.Drm.FrameworkMediaDrm.cs +++ /dev/null @@ -1,88 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Com.Google.Android.Exoplayer.Drm { - - // Metadata.xml XPath class reference: path="/api/package[@name='com.google.android.exoplayer.drm']/class[@name='FrameworkMediaDrm']" - [global::Android.Runtime.Register ("com/google/android/exoplayer/drm/FrameworkMediaDrm", DoNotGenerateAcw=true)] - public sealed partial class FrameworkMediaDrm : global::Java.Lang.Object, global::Com.Google.Android.Exoplayer.Drm.IExoMediaDrm { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("com/google/android/exoplayer/drm/FrameworkMediaDrm", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (FrameworkMediaDrm); } - } - - internal FrameworkMediaDrm (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static IntPtr id_ctor; - // Metadata.xml XPath constructor reference: path="/api/package[@name='com.google.android.exoplayer.drm']/class[@name='FrameworkMediaDrm']/constructor[@name='FrameworkMediaDrm' and count(parameter)=0]" - [Register (".ctor", "()V", "")] - public unsafe FrameworkMediaDrm () - : base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer) - { - if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero) - return; - - try { - if (((object) this).GetType () != typeof (FrameworkMediaDrm)) { - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (((object) this).GetType (), "()V"), - JniHandleOwnership.TransferLocalRef); - global::Android.Runtime.JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, "()V"); - return; - } - - if (id_ctor == IntPtr.Zero) - id_ctor = JNIEnv.GetMethodID (class_ref, "", "()V"); - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (class_ref, id_ctor), - JniHandleOwnership.TransferLocalRef); - JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, class_ref, id_ctor); - } finally { - } - } - - static IntPtr id_setOnEventListener_Lcom_google_android_exoplayer_drm_ExoMediaDrm_OnEventListener_; - // Metadata.xml XPath method reference: path="/api/package[@name='com.google.android.exoplayer.drm']/class[@name='FrameworkMediaDrm']/method[@name='setOnEventListener' and count(parameter)=1 and parameter[1][@type='com.google.android.exoplayer.drm.ExoMediaDrm.OnEventListener<com.google.android.exoplayer.drm.FrameworkMediaCrypto>']]" - [Register ("setOnEventListener", "(Lcom/google/android/exoplayer/drm/ExoMediaDrm$OnEventListener;)V", "")] - public unsafe void SetOnEventListener (global::Com.Google.Android.Exoplayer.Drm.IExoMediaDrmOnEventListener p0) - { - if (id_setOnEventListener_Lcom_google_android_exoplayer_drm_ExoMediaDrm_OnEventListener_ == IntPtr.Zero) - id_setOnEventListener_Lcom_google_android_exoplayer_drm_ExoMediaDrm_OnEventListener_ = JNIEnv.GetMethodID (class_ref, "setOnEventListener", "(Lcom/google/android/exoplayer/drm/ExoMediaDrm$OnEventListener;)V"); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (p0); - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_setOnEventListener_Lcom_google_android_exoplayer_drm_ExoMediaDrm_OnEventListener_, __args); - } finally { - } - } - - // This method is explicitly implemented as a member of an instantiated Com.Google.Android.Exoplayer.Drm.IExoMediaDrm - void global::Com.Google.Android.Exoplayer.Drm.IExoMediaDrm.SetOnEventListener (global::Com.Google.Android.Exoplayer.Drm.IExoMediaDrmOnEventListener p0) - { - SetOnEventListener (global::Java.Interop.JavaObjectExtensions.JavaCast(p0)); - } - - } -} diff --git a/tests/generator-Tests/expected/GenericArguments/Com.Google.Android.Exoplayer.Drm.IExoMediaDrm.cs b/tests/generator-Tests/expected/GenericArguments/Com.Google.Android.Exoplayer.Drm.IExoMediaDrm.cs deleted file mode 100644 index aea9f861e..000000000 --- a/tests/generator-Tests/expected/GenericArguments/Com.Google.Android.Exoplayer.Drm.IExoMediaDrm.cs +++ /dev/null @@ -1,263 +0,0 @@ -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Com.Google.Android.Exoplayer.Drm { - - // Metadata.xml XPath interface reference: path="/api/package[@name='com.google.android.exoplayer.drm']/interface[@name='ExoMediaDrm.OnEventListener']" - [Register ("com/google/android/exoplayer/drm/ExoMediaDrm$OnEventListener", "", "Com.Google.Android.Exoplayer.Drm.IExoMediaDrmOnEventListenerInvoker")] - [global::Java.Interop.JavaTypeParameters (new string [] {"T extends com.google.android.exoplayer.drm.ExoMediaCrypto"})] - public partial interface IExoMediaDrmOnEventListener : IJavaObject { - - // Metadata.xml XPath method reference: path="/api/package[@name='com.google.android.exoplayer.drm']/interface[@name='ExoMediaDrm.OnEventListener']/method[@name='onEvent' and count(parameter)=5 and parameter[1][@type='com.google.android.exoplayer.drm.ExoMediaDrm<T>'] and parameter[2][@type='byte[]'] and parameter[3][@type='int'] and parameter[4][@type='int'] and parameter[5][@type='byte[]']]" - [Register ("onEvent", "(Lcom/google/android/exoplayer/drm/ExoMediaDrm;[BII[B)V", "GetOnEvent_Lcom_google_android_exoplayer_drm_ExoMediaDrm_arrayBIIarrayBHandler:Com.Google.Android.Exoplayer.Drm.IExoMediaDrmOnEventListenerInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")] - void OnEvent (global::Com.Google.Android.Exoplayer.Drm.IExoMediaDrm p0, byte[] p1, int p2, int p3, byte[] p4); - - } - - [global::Android.Runtime.Register ("com/google/android/exoplayer/drm/ExoMediaDrm$OnEventListener", DoNotGenerateAcw=true)] - internal partial class IExoMediaDrmOnEventListenerInvoker : global::Java.Lang.Object, IExoMediaDrmOnEventListener { - - static IntPtr java_class_ref = JNIEnv.FindClass ("com/google/android/exoplayer/drm/ExoMediaDrm$OnEventListener"); - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (IExoMediaDrmOnEventListenerInvoker); } - } - - new IntPtr class_ref; - - public static IExoMediaDrmOnEventListener GetObject (IntPtr handle, JniHandleOwnership transfer) - { - return global::Java.Lang.Object.GetObject (handle, transfer); - } - - static IntPtr Validate (IntPtr handle) - { - if (!JNIEnv.IsInstanceOf (handle, java_class_ref)) - throw new InvalidCastException (string.Format ("Unable to convert instance of type '{0}' to type '{1}'.", - JNIEnv.GetClassNameFromInstance (handle), "com.google.android.exoplayer.drm.ExoMediaDrm.OnEventListener")); - return handle; - } - - protected override void Dispose (bool disposing) - { - if (this.class_ref != IntPtr.Zero) - JNIEnv.DeleteGlobalRef (this.class_ref); - this.class_ref = IntPtr.Zero; - base.Dispose (disposing); - } - - public IExoMediaDrmOnEventListenerInvoker (IntPtr handle, JniHandleOwnership transfer) : base (Validate (handle), transfer) - { - IntPtr local_ref = JNIEnv.GetObjectClass (((global::Java.Lang.Object) this).Handle); - this.class_ref = JNIEnv.NewGlobalRef (local_ref); - JNIEnv.DeleteLocalRef (local_ref); - } - - static Delegate cb_onEvent_Lcom_google_android_exoplayer_drm_ExoMediaDrm_arrayBIIarrayB; -#pragma warning disable 0169 - static Delegate GetOnEvent_Lcom_google_android_exoplayer_drm_ExoMediaDrm_arrayBIIarrayBHandler () - { - if (cb_onEvent_Lcom_google_android_exoplayer_drm_ExoMediaDrm_arrayBIIarrayB == null) - cb_onEvent_Lcom_google_android_exoplayer_drm_ExoMediaDrm_arrayBIIarrayB = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPLLIIL_V) n_OnEvent_Lcom_google_android_exoplayer_drm_ExoMediaDrm_arrayBIIarrayB); - return cb_onEvent_Lcom_google_android_exoplayer_drm_ExoMediaDrm_arrayBIIarrayB; - } - - static void n_OnEvent_Lcom_google_android_exoplayer_drm_ExoMediaDrm_arrayBIIarrayB (IntPtr jnienv, IntPtr native__this, IntPtr native_p0, IntPtr native_p1, int p2, int p3, IntPtr native_p4) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var p0 = (global::Com.Google.Android.Exoplayer.Drm.IExoMediaDrm)global::Java.Lang.Object.GetObject (native_p0, JniHandleOwnership.DoNotTransfer); - var p1 = (byte[]) JNIEnv.GetArray (native_p1, JniHandleOwnership.DoNotTransfer, typeof (byte)); - var p4 = (byte[]) JNIEnv.GetArray (native_p4, JniHandleOwnership.DoNotTransfer, typeof (byte)); - __this.OnEvent (p0, p1, p2, p3, p4); - if (p1 != null) - JNIEnv.CopyArray (p1, native_p1); - if (p4 != null) - JNIEnv.CopyArray (p4, native_p4); - } -#pragma warning restore 0169 - - IntPtr id_onEvent_Lcom_google_android_exoplayer_drm_ExoMediaDrm_arrayBIIarrayB; - public unsafe void OnEvent (global::Com.Google.Android.Exoplayer.Drm.IExoMediaDrm p0, byte[] p1, int p2, int p3, byte[] p4) - { - if (id_onEvent_Lcom_google_android_exoplayer_drm_ExoMediaDrm_arrayBIIarrayB == IntPtr.Zero) - id_onEvent_Lcom_google_android_exoplayer_drm_ExoMediaDrm_arrayBIIarrayB = JNIEnv.GetMethodID (class_ref, "onEvent", "(Lcom/google/android/exoplayer/drm/ExoMediaDrm;[BII[B)V"); - IntPtr native_p1 = JNIEnv.NewArray (p1); - IntPtr native_p4 = JNIEnv.NewArray (p4); - JValue* __args = stackalloc JValue [5]; - __args [0] = new JValue (p0); - __args [1] = new JValue (native_p1); - __args [2] = new JValue (p2); - __args [3] = new JValue (p3); - __args [4] = new JValue (native_p4); - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_onEvent_Lcom_google_android_exoplayer_drm_ExoMediaDrm_arrayBIIarrayB, __args); - if (p1 != null) { - JNIEnv.CopyArray (native_p1, p1); - JNIEnv.DeleteLocalRef (native_p1); - } - if (p4 != null) { - JNIEnv.CopyArray (native_p4, p4); - JNIEnv.DeleteLocalRef (native_p4); - } - } - - } - - // event args for com.google.android.exoplayer.drm.ExoMediaDrm.OnEventListener.onEvent - public partial class ExoMediaDrmOnEventEventArgs : global::System.EventArgs { - - public ExoMediaDrmOnEventEventArgs (global::Com.Google.Android.Exoplayer.Drm.IExoMediaDrm p0, byte[] p1, int p2, int p3, byte[] p4) - { - this.p0 = p0; - this.p1 = p1; - this.p2 = p2; - this.p3 = p3; - this.p4 = p4; - } - - global::Com.Google.Android.Exoplayer.Drm.IExoMediaDrm p0; - public global::Com.Google.Android.Exoplayer.Drm.IExoMediaDrm P0 { - get { return p0; } - } - - byte[] p1; - public byte[] P1 { - get { return p1; } - } - - int p2; - public int P2 { - get { return p2; } - } - - int p3; - public int P3 { - get { return p3; } - } - - byte[] p4; - public byte[] P4 { - get { return p4; } - } - } - - [global::Android.Runtime.Register ("mono/com/google/android/exoplayer/drm/ExoMediaDrm_OnEventListenerImplementor")] - internal sealed partial class IExoMediaDrmOnEventListenerImplementor : global::Java.Lang.Object, IExoMediaDrmOnEventListener { - - object sender; - - public IExoMediaDrmOnEventListenerImplementor (object sender) - : base ( - global::Android.Runtime.JNIEnv.StartCreateInstance ("mono/com/google/android/exoplayer/drm/ExoMediaDrm_OnEventListenerImplementor", "()V"), - JniHandleOwnership.TransferLocalRef) - { - global::Android.Runtime.JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, "()V"); - this.sender = sender; - } - -#pragma warning disable 0649 - public EventHandler Handler; -#pragma warning restore 0649 - - public void OnEvent (global::Com.Google.Android.Exoplayer.Drm.IExoMediaDrm p0, byte[] p1, int p2, int p3, byte[] p4) - { - var __h = Handler; - if (__h != null) - __h (sender, new ExoMediaDrmOnEventEventArgs (p0, p1, p2, p3, p4)); - } - - internal static bool __IsEmpty (IExoMediaDrmOnEventListenerImplementor value) - { - return value.Handler == null; - } - } - - - // Metadata.xml XPath interface reference: path="/api/package[@name='com.google.android.exoplayer.drm']/interface[@name='ExoMediaDrm']" - [Register ("com/google/android/exoplayer/drm/ExoMediaDrm", "", "Com.Google.Android.Exoplayer.Drm.IExoMediaDrmInvoker")] - [global::Java.Interop.JavaTypeParameters (new string [] {"T extends com.google.android.exoplayer.drm.ExoMediaCrypto"})] - public partial interface IExoMediaDrm : IJavaObject { - - // Metadata.xml XPath method reference: path="/api/package[@name='com.google.android.exoplayer.drm']/interface[@name='ExoMediaDrm']/method[@name='setOnEventListener' and count(parameter)=1 and parameter[1][@type='com.google.android.exoplayer.drm.ExoMediaDrm.OnEventListener<T>']]" - [Register ("setOnEventListener", "(Lcom/google/android/exoplayer/drm/ExoMediaDrm$OnEventListener;)V", "GetSetOnEventListener_Lcom_google_android_exoplayer_drm_ExoMediaDrm_OnEventListener_Handler:Com.Google.Android.Exoplayer.Drm.IExoMediaDrmInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")] - void SetOnEventListener (global::Com.Google.Android.Exoplayer.Drm.IExoMediaDrmOnEventListener p0); - - } - - [global::Android.Runtime.Register ("com/google/android/exoplayer/drm/ExoMediaDrm", DoNotGenerateAcw=true)] - internal partial class IExoMediaDrmInvoker : global::Java.Lang.Object, IExoMediaDrm { - - static IntPtr java_class_ref = JNIEnv.FindClass ("com/google/android/exoplayer/drm/ExoMediaDrm"); - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (IExoMediaDrmInvoker); } - } - - new IntPtr class_ref; - - public static IExoMediaDrm GetObject (IntPtr handle, JniHandleOwnership transfer) - { - return global::Java.Lang.Object.GetObject (handle, transfer); - } - - static IntPtr Validate (IntPtr handle) - { - if (!JNIEnv.IsInstanceOf (handle, java_class_ref)) - throw new InvalidCastException (string.Format ("Unable to convert instance of type '{0}' to type '{1}'.", - JNIEnv.GetClassNameFromInstance (handle), "com.google.android.exoplayer.drm.ExoMediaDrm")); - return handle; - } - - protected override void Dispose (bool disposing) - { - if (this.class_ref != IntPtr.Zero) - JNIEnv.DeleteGlobalRef (this.class_ref); - this.class_ref = IntPtr.Zero; - base.Dispose (disposing); - } - - public IExoMediaDrmInvoker (IntPtr handle, JniHandleOwnership transfer) : base (Validate (handle), transfer) - { - IntPtr local_ref = JNIEnv.GetObjectClass (((global::Java.Lang.Object) this).Handle); - this.class_ref = JNIEnv.NewGlobalRef (local_ref); - JNIEnv.DeleteLocalRef (local_ref); - } - - static Delegate cb_setOnEventListener_Lcom_google_android_exoplayer_drm_ExoMediaDrm_OnEventListener_; -#pragma warning disable 0169 - static Delegate GetSetOnEventListener_Lcom_google_android_exoplayer_drm_ExoMediaDrm_OnEventListener_Handler () - { - if (cb_setOnEventListener_Lcom_google_android_exoplayer_drm_ExoMediaDrm_OnEventListener_ == null) - cb_setOnEventListener_Lcom_google_android_exoplayer_drm_ExoMediaDrm_OnEventListener_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_V) n_SetOnEventListener_Lcom_google_android_exoplayer_drm_ExoMediaDrm_OnEventListener_); - return cb_setOnEventListener_Lcom_google_android_exoplayer_drm_ExoMediaDrm_OnEventListener_; - } - - static void n_SetOnEventListener_Lcom_google_android_exoplayer_drm_ExoMediaDrm_OnEventListener_ (IntPtr jnienv, IntPtr native__this, IntPtr native_p0) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var p0 = (global::Com.Google.Android.Exoplayer.Drm.IExoMediaDrmOnEventListener)global::Java.Lang.Object.GetObject (native_p0, JniHandleOwnership.DoNotTransfer); - __this.SetOnEventListener (p0); - } -#pragma warning restore 0169 - - IntPtr id_setOnEventListener_Lcom_google_android_exoplayer_drm_ExoMediaDrm_OnEventListener_; - public unsafe void SetOnEventListener (global::Com.Google.Android.Exoplayer.Drm.IExoMediaDrmOnEventListener p0) - { - if (id_setOnEventListener_Lcom_google_android_exoplayer_drm_ExoMediaDrm_OnEventListener_ == IntPtr.Zero) - id_setOnEventListener_Lcom_google_android_exoplayer_drm_ExoMediaDrm_OnEventListener_ = JNIEnv.GetMethodID (class_ref, "setOnEventListener", "(Lcom/google/android/exoplayer/drm/ExoMediaDrm$OnEventListener;)V"); - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (p0); - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_setOnEventListener_Lcom_google_android_exoplayer_drm_ExoMediaDrm_OnEventListener_, __args); - } - - } - -} diff --git a/tests/generator-Tests/expected/GenericArguments/GenericArguments.xml b/tests/generator-Tests/expected/GenericArguments/GenericArguments.xml deleted file mode 100644 index f9387a080..000000000 --- a/tests/generator-Tests/expected/GenericArguments/GenericArguments.xml +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/generator-Tests/expected/GenericArguments/Java.Lang.Object.cs b/tests/generator-Tests/expected/GenericArguments/Java.Lang.Object.cs deleted file mode 100644 index dd027b081..000000000 --- a/tests/generator-Tests/expected/GenericArguments/Java.Lang.Object.cs +++ /dev/null @@ -1,29 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Java.Lang { - - // Metadata.xml XPath class reference: path="/api/package[@name='java.lang']/class[@name='Object']" - [global::Android.Runtime.Register ("java/lang/Object", DoNotGenerateAcw=true)] - public partial class Object { - - internal static IntPtr java_class_handle; - internal static IntPtr class_ref { - get { - return JNIEnv.FindClass ("java/lang/Object", ref java_class_handle); - } - } - - } -} diff --git a/tests/generator-Tests/expected/GenericArguments/Mono.Android.projitems b/tests/generator-Tests/expected/GenericArguments/Mono.Android.projitems deleted file mode 100644 index ce2c2b1c9..000000000 --- a/tests/generator-Tests/expected/GenericArguments/Mono.Android.projitems +++ /dev/null @@ -1,18 +0,0 @@ - - - - $(DefineConstants);ANDROID_1;ANDROID_2;ANDROID_3;ANDROID_4 - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/generator-Tests/expected/InterfaceMethodsConflict/InterfaceMethodsConflict.xml b/tests/generator-Tests/expected/InterfaceMethodsConflict/InterfaceMethodsConflict.xml deleted file mode 100644 index e83a6e37a..000000000 --- a/tests/generator-Tests/expected/InterfaceMethodsConflict/InterfaceMethodsConflict.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/generator-Tests/expected/InterfaceMethodsConflict/Java.Interop.__TypeRegistrations.cs b/tests/generator-Tests/expected/InterfaceMethodsConflict/Java.Interop.__TypeRegistrations.cs deleted file mode 100644 index 0131993a1..000000000 --- a/tests/generator-Tests/expected/InterfaceMethodsConflict/Java.Interop.__TypeRegistrations.cs +++ /dev/null @@ -1,47 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Java.Interop { - - partial class __TypeRegistrations { - - public static void RegisterPackages () - { -#if MONODROID_TIMING - var start = DateTime.Now; - Android.Util.Log.Info ("MonoDroid-Timing", "RegisterPackages start: " + (start - new DateTime (1970, 1, 1)).TotalMilliseconds); -#endif // def MONODROID_TIMING - Java.Interop.TypeManager.RegisterPackages ( - new string[]{ - }, - new Converter[]{ - }); -#if MONODROID_TIMING - var end = DateTime.Now; - Android.Util.Log.Info ("MonoDroid-Timing", "RegisterPackages time: " + (end - new DateTime (1970, 1, 1)).TotalMilliseconds + " [elapsed: " + (end - start).TotalMilliseconds + " ms]"); -#endif // def MONODROID_TIMING - } - -#if NET5_0_OR_GREATER - [System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage ("Trimming", "IL2057")] -#endif - static Type Lookup (string[] mappings, string javaType) - { - var managedType = Java.Interop.TypeManager.LookupTypeMapping (mappings, javaType); - if (managedType == null) - return null; - return Type.GetType (managedType); - } - } -} diff --git a/tests/generator-Tests/expected/InterfaceMethodsConflict/Mono.Android.projitems b/tests/generator-Tests/expected/InterfaceMethodsConflict/Mono.Android.projitems deleted file mode 100644 index 03c426cd6..000000000 --- a/tests/generator-Tests/expected/InterfaceMethodsConflict/Mono.Android.projitems +++ /dev/null @@ -1,18 +0,0 @@ - - - - $(DefineConstants);ANDROID_1;ANDROID_2;ANDROID_3;ANDROID_4 - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/generator-Tests/expected/InterfaceMethodsConflict/Xamarin.Test.II1.cs b/tests/generator-Tests/expected/InterfaceMethodsConflict/Xamarin.Test.II1.cs deleted file mode 100644 index 1949af7f2..000000000 --- a/tests/generator-Tests/expected/InterfaceMethodsConflict/Xamarin.Test.II1.cs +++ /dev/null @@ -1,86 +0,0 @@ -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Xamarin.Test { - - // Metadata.xml XPath interface reference: path="/api/package[@name='xamarin.test']/interface[@name='I1']" - [Register ("xamarin/test/I1", "", "Xamarin.Test.II1Invoker")] - public partial interface II1 : IJavaObject { - - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/interface[@name='I1']/method[@name='close' and count(parameter)=0]" - [Register ("close", "()V", "GetCloseHandler:Xamarin.Test.II1Invoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")] - void Close (); - - } - - [global::Android.Runtime.Register ("xamarin/test/I1", DoNotGenerateAcw=true)] - internal partial class II1Invoker : global::Java.Lang.Object, II1 { - - static IntPtr java_class_ref = JNIEnv.FindClass ("xamarin/test/I1"); - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (II1Invoker); } - } - - new IntPtr class_ref; - - public static II1 GetObject (IntPtr handle, JniHandleOwnership transfer) - { - return global::Java.Lang.Object.GetObject (handle, transfer); - } - - static IntPtr Validate (IntPtr handle) - { - if (!JNIEnv.IsInstanceOf (handle, java_class_ref)) - throw new InvalidCastException (string.Format ("Unable to convert instance of type '{0}' to type '{1}'.", - JNIEnv.GetClassNameFromInstance (handle), "xamarin.test.I1")); - return handle; - } - - protected override void Dispose (bool disposing) - { - if (this.class_ref != IntPtr.Zero) - JNIEnv.DeleteGlobalRef (this.class_ref); - this.class_ref = IntPtr.Zero; - base.Dispose (disposing); - } - - public II1Invoker (IntPtr handle, JniHandleOwnership transfer) : base (Validate (handle), transfer) - { - IntPtr local_ref = JNIEnv.GetObjectClass (((global::Java.Lang.Object) this).Handle); - this.class_ref = JNIEnv.NewGlobalRef (local_ref); - JNIEnv.DeleteLocalRef (local_ref); - } - - static Delegate cb_close; -#pragma warning disable 0169 - static Delegate GetCloseHandler () - { - if (cb_close == null) - cb_close = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_V) n_Close); - return cb_close; - } - - static void n_Close (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.Close (); - } -#pragma warning restore 0169 - - IntPtr id_close; - public unsafe void Close () - { - if (id_close == IntPtr.Zero) - id_close = JNIEnv.GetMethodID (class_ref, "close", "()V"); - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_close); - } - - } - -} diff --git a/tests/generator-Tests/expected/InterfaceMethodsConflict/Xamarin.Test.II2.cs b/tests/generator-Tests/expected/InterfaceMethodsConflict/Xamarin.Test.II2.cs deleted file mode 100644 index 1e544b89a..000000000 --- a/tests/generator-Tests/expected/InterfaceMethodsConflict/Xamarin.Test.II2.cs +++ /dev/null @@ -1,86 +0,0 @@ -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Xamarin.Test { - - // Metadata.xml XPath interface reference: path="/api/package[@name='xamarin.test']/interface[@name='I2']" - [Register ("xamarin/test/I2", "", "Xamarin.Test.II2Invoker")] - public partial interface II2 : IJavaObject { - - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/interface[@name='I2']/method[@name='close' and count(parameter)=0]" - [Register ("close", "()V", "GetCloseHandler:Xamarin.Test.II2Invoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")] - void Close (); - - } - - [global::Android.Runtime.Register ("xamarin/test/I2", DoNotGenerateAcw=true)] - internal partial class II2Invoker : global::Java.Lang.Object, II2 { - - static IntPtr java_class_ref = JNIEnv.FindClass ("xamarin/test/I2"); - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (II2Invoker); } - } - - new IntPtr class_ref; - - public static II2 GetObject (IntPtr handle, JniHandleOwnership transfer) - { - return global::Java.Lang.Object.GetObject (handle, transfer); - } - - static IntPtr Validate (IntPtr handle) - { - if (!JNIEnv.IsInstanceOf (handle, java_class_ref)) - throw new InvalidCastException (string.Format ("Unable to convert instance of type '{0}' to type '{1}'.", - JNIEnv.GetClassNameFromInstance (handle), "xamarin.test.I2")); - return handle; - } - - protected override void Dispose (bool disposing) - { - if (this.class_ref != IntPtr.Zero) - JNIEnv.DeleteGlobalRef (this.class_ref); - this.class_ref = IntPtr.Zero; - base.Dispose (disposing); - } - - public II2Invoker (IntPtr handle, JniHandleOwnership transfer) : base (Validate (handle), transfer) - { - IntPtr local_ref = JNIEnv.GetObjectClass (((global::Java.Lang.Object) this).Handle); - this.class_ref = JNIEnv.NewGlobalRef (local_ref); - JNIEnv.DeleteLocalRef (local_ref); - } - - static Delegate cb_close; -#pragma warning disable 0169 - static Delegate GetCloseHandler () - { - if (cb_close == null) - cb_close = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_V) n_Close); - return cb_close; - } - - static void n_Close (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.Close (); - } -#pragma warning restore 0169 - - IntPtr id_close; - public unsafe void Close () - { - if (id_close == IntPtr.Zero) - id_close = JNIEnv.GetMethodID (class_ref, "close", "()V"); - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_close); - } - - } - -} diff --git a/tests/generator-Tests/expected/InterfaceMethodsConflict/Xamarin.Test.SomeObject.cs b/tests/generator-Tests/expected/InterfaceMethodsConflict/Xamarin.Test.SomeObject.cs deleted file mode 100644 index 4c87567e2..000000000 --- a/tests/generator-Tests/expected/InterfaceMethodsConflict/Xamarin.Test.SomeObject.cs +++ /dev/null @@ -1,72 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Xamarin.Test { - - // Metadata.xml XPath class reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']" - [global::Android.Runtime.Register ("xamarin/test/SomeObject", DoNotGenerateAcw=true)] - public partial class SomeObject : global::Java.Lang.Object, global::Xamarin.Test.II1, global::Xamarin.Test.II2 { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("xamarin/test/SomeObject", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (SomeObject); } - } - - protected SomeObject (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static Delegate cb_close; -#pragma warning disable 0169 - static Delegate GetCloseHandler () - { - if (cb_close == null) - cb_close = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_V) n_Close); - return cb_close; - } - - static void n_Close (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.Close (); - } -#pragma warning restore 0169 - - static IntPtr id_close; - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/method[@name='close' and count(parameter)=0]" - [Register ("close", "()V", "GetCloseHandler")] - public virtual unsafe void Close () - { - if (id_close == IntPtr.Zero) - id_close = JNIEnv.GetMethodID (class_ref, "close", "()V"); - try { - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_close); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "close", "()V")); - } finally { - } - } - - } -} diff --git a/tests/generator-Tests/expected/InterfaceMethodsConflict/Xamarin.Test.SomeObject2.cs b/tests/generator-Tests/expected/InterfaceMethodsConflict/Xamarin.Test.SomeObject2.cs deleted file mode 100644 index 7db201146..000000000 --- a/tests/generator-Tests/expected/InterfaceMethodsConflict/Xamarin.Test.SomeObject2.cs +++ /dev/null @@ -1,117 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Xamarin.Test { - - // Metadata.xml XPath class reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject2']" - [global::Android.Runtime.Register ("xamarin/test/SomeObject2", DoNotGenerateAcw=true)] - public abstract partial class SomeObject2 : global::Java.Lang.Object, global::Xamarin.Test.II1, global::Xamarin.Test.II2 { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("xamarin/test/SomeObject2", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (SomeObject2); } - } - - protected SomeObject2 (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static Delegate cb_irrelevant; -#pragma warning disable 0169 - static Delegate GetIrrelevantHandler () - { - if (cb_irrelevant == null) - cb_irrelevant = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_V) n_Irrelevant); - return cb_irrelevant; - } - - static void n_Irrelevant (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.Irrelevant (); - } -#pragma warning restore 0169 - - static IntPtr id_irrelevant; - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject2']/method[@name='irrelevant' and count(parameter)=0]" - [Register ("irrelevant", "()V", "GetIrrelevantHandler")] - public virtual unsafe void Irrelevant () - { - if (id_irrelevant == IntPtr.Zero) - id_irrelevant = JNIEnv.GetMethodID (class_ref, "irrelevant", "()V"); - try { - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_irrelevant); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "irrelevant", "()V")); - } finally { - } - } - - static Delegate cb_close; -#pragma warning disable 0169 - static Delegate GetCloseHandler () - { - if (cb_close == null) - cb_close = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_V) n_Close); - return cb_close; - } - - static void n_Close (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.Close (); - } -#pragma warning restore 0169 - - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/interface[@name='I1']/method[@name='close' and count(parameter)=0]" - [Register ("close", "()V", "GetCloseHandler")] - public abstract void Close (); - - } - - [global::Android.Runtime.Register ("xamarin/test/SomeObject2", DoNotGenerateAcw=true)] - internal partial class SomeObject2Invoker : SomeObject2 { - - public SomeObject2Invoker (IntPtr handle, JniHandleOwnership transfer) : base (handle, transfer) {} - - protected override global::System.Type ThresholdType { - get { return typeof (SomeObject2Invoker); } - } - - static IntPtr id_close; - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/interface[@name='I1']/method[@name='close' and count(parameter)=0]" - [Register ("close", "()V", "GetCloseHandler")] - public override unsafe void Close () - { - if (id_close == IntPtr.Zero) - id_close = JNIEnv.GetMethodID (class_ref, "close", "()V"); - try { - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_close); - } finally { - } - } - - } - -} diff --git a/tests/generator-Tests/expected/InterfaceMethodsConflict/__NamespaceMapping__.cs b/tests/generator-Tests/expected/InterfaceMethodsConflict/__NamespaceMapping__.cs deleted file mode 100644 index 85c43009a..000000000 --- a/tests/generator-Tests/expected/InterfaceMethodsConflict/__NamespaceMapping__.cs +++ /dev/null @@ -1,6 +0,0 @@ -using System; - -[assembly:global::Android.Runtime.NamespaceMapping (Java = "java.lang", Managed="Java.Lang")] -[assembly:global::Android.Runtime.NamespaceMapping (Java = "xamarin.test", Managed="Xamarin.Test")] - -delegate void _JniMarshal_PP_V (IntPtr jnienv, IntPtr klass); diff --git a/tests/generator-Tests/expected/NestedTypes/Mono.Android.projitems b/tests/generator-Tests/expected/NestedTypes/Mono.Android.projitems deleted file mode 100644 index 5e66c0f7f..000000000 --- a/tests/generator-Tests/expected/NestedTypes/Mono.Android.projitems +++ /dev/null @@ -1,15 +0,0 @@ - - - - $(DefineConstants);ANDROID_1;ANDROID_2;ANDROID_3;ANDROID_4 - - - - - - - - - - - \ No newline at end of file diff --git a/tests/generator-Tests/expected/NestedTypes/Xamarin.Test.NotificationCompatBase.cs b/tests/generator-Tests/expected/NestedTypes/Xamarin.Test.NotificationCompatBase.cs deleted file mode 100644 index 313a15dfd..000000000 --- a/tests/generator-Tests/expected/NestedTypes/Xamarin.Test.NotificationCompatBase.cs +++ /dev/null @@ -1,221 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Xamarin.Test { - - // Metadata.xml XPath class reference: path="/api/package[@name='xamarin.test']/class[@name='NotificationCompatBase']" - [global::Android.Runtime.Register ("xamarin/test/NotificationCompatBase", DoNotGenerateAcw=true)] - public partial class NotificationCompatBase : global::Java.Lang.Object { - - // Metadata.xml XPath class reference: path="/api/package[@name='xamarin.test']/class[@name='NotificationCompatBase.Action']" - [global::Android.Runtime.Register ("xamarin/test/NotificationCompatBase$Action", DoNotGenerateAcw=true)] - public abstract partial class Action : global::Java.Lang.Object { - - // Metadata.xml XPath interface reference: path="/api/package[@name='xamarin.test']/interface[@name='NotificationCompatBase.Action.Factory']" - [Register ("xamarin/test/NotificationCompatBase$Action$Factory", "", "Xamarin.Test.NotificationCompatBase/Action/IFactoryInvoker")] - public partial interface IFactory : IJavaObject { - - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/interface[@name='NotificationCompatBase.Action.Factory']/method[@name='build' and count(parameter)=1 and parameter[1][@type='int']]" - [Register ("build", "(I)Lxamarin/test/NotificationCompatBase$Action;", "GetBuild_IHandler:Xamarin.Test.NotificationCompatBase/Action/IFactoryInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")] - global::Xamarin.Test.NotificationCompatBase.Action Build (int p0); - - } - - [global::Android.Runtime.Register ("xamarin/test/NotificationCompatBase$Action$Factory", DoNotGenerateAcw=true)] - internal partial class IFactoryInvoker : global::Java.Lang.Object, IFactory { - - static IntPtr java_class_ref = JNIEnv.FindClass ("xamarin/test/NotificationCompatBase$Action$Factory"); - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (IFactoryInvoker); } - } - - new IntPtr class_ref; - - public static IFactory GetObject (IntPtr handle, JniHandleOwnership transfer) - { - return global::Java.Lang.Object.GetObject (handle, transfer); - } - - static IntPtr Validate (IntPtr handle) - { - if (!JNIEnv.IsInstanceOf (handle, java_class_ref)) - throw new InvalidCastException (string.Format ("Unable to convert instance of type '{0}' to type '{1}'.", - JNIEnv.GetClassNameFromInstance (handle), "xamarin.test.NotificationCompatBase.Action.Factory")); - return handle; - } - - protected override void Dispose (bool disposing) - { - if (this.class_ref != IntPtr.Zero) - JNIEnv.DeleteGlobalRef (this.class_ref); - this.class_ref = IntPtr.Zero; - base.Dispose (disposing); - } - - public IFactoryInvoker (IntPtr handle, JniHandleOwnership transfer) : base (Validate (handle), transfer) - { - IntPtr local_ref = JNIEnv.GetObjectClass (((global::Java.Lang.Object) this).Handle); - this.class_ref = JNIEnv.NewGlobalRef (local_ref); - JNIEnv.DeleteLocalRef (local_ref); - } - - static Delegate cb_build_I; -#pragma warning disable 0169 - static Delegate GetBuild_IHandler () - { - if (cb_build_I == null) - cb_build_I = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPI_L) n_Build_I); - return cb_build_I; - } - - static IntPtr n_Build_I (IntPtr jnienv, IntPtr native__this, int p0) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return JNIEnv.ToLocalJniHandle (__this.Build (p0)); - } -#pragma warning restore 0169 - - IntPtr id_build_I; - public unsafe global::Xamarin.Test.NotificationCompatBase.Action Build (int p0) - { - if (id_build_I == IntPtr.Zero) - id_build_I = JNIEnv.GetMethodID (class_ref, "build", "(I)Lxamarin/test/NotificationCompatBase$Action;"); - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (p0); - return global::Java.Lang.Object.GetObject (JNIEnv.CallObjectMethod (((global::Java.Lang.Object) this).Handle, id_build_I, __args), JniHandleOwnership.TransferLocalRef); - } - - } - - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("xamarin/test/NotificationCompatBase$Action", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (Action); } - } - - protected Action (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - } - - [global::Android.Runtime.Register ("xamarin/test/NotificationCompatBase$Action", DoNotGenerateAcw=true)] - internal partial class ActionInvoker : Action { - - public ActionInvoker (IntPtr handle, JniHandleOwnership transfer) : base (handle, transfer) {} - - protected override global::System.Type ThresholdType { - get { return typeof (ActionInvoker); } - } - - } - - - // Metadata.xml XPath class reference: path="/api/package[@name='xamarin.test']/class[@name='NotificationCompatBase.InstanceInner']" - [global::Android.Runtime.Register ("xamarin/test/NotificationCompatBase$InstanceInner", DoNotGenerateAcw=true)] - public abstract partial class InstanceInner : global::Java.Lang.Object { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("xamarin/test/NotificationCompatBase$InstanceInner", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (InstanceInner); } - } - - protected InstanceInner (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static IntPtr id_ctor_Lxamarin_test_NotificationCompatBase_; - // Metadata.xml XPath constructor reference: path="/api/package[@name='xamarin.test']/class[@name='NotificationCompatBase.InstanceInner']/constructor[@name='NotificationCompatBase.InstanceInner' and count(parameter)=1 and parameter[1][@type='xamarin.test.NotificationCompatBase']]" - [Register (".ctor", "(Lxamarin/test/NotificationCompatBase;)V", "")] - public unsafe InstanceInner (global::Xamarin.Test.NotificationCompatBase __self) - : base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer) - { - if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero) - return; - - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (__self); - if (((object) this).GetType () != typeof (InstanceInner)) { - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (((object) this).GetType (), "(L" + global::Android.Runtime.JNIEnv.GetJniName (GetType ().DeclaringType) + ";)V", __args), - JniHandleOwnership.TransferLocalRef); - global::Android.Runtime.JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, "(L" + global::Android.Runtime.JNIEnv.GetJniName (GetType ().DeclaringType) + ";)V", __args); - return; - } - - if (id_ctor_Lxamarin_test_NotificationCompatBase_ == IntPtr.Zero) - id_ctor_Lxamarin_test_NotificationCompatBase_ = JNIEnv.GetMethodID (class_ref, "", "(Lxamarin/test/NotificationCompatBase;)V"); - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (class_ref, id_ctor_Lxamarin_test_NotificationCompatBase_, __args), - JniHandleOwnership.TransferLocalRef); - JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, class_ref, id_ctor_Lxamarin_test_NotificationCompatBase_, __args); - } finally { - } - } - - } - - [global::Android.Runtime.Register ("xamarin/test/NotificationCompatBase$InstanceInner", DoNotGenerateAcw=true)] - internal partial class InstanceInnerInvoker : InstanceInner { - - public InstanceInnerInvoker (IntPtr handle, JniHandleOwnership transfer) : base (handle, transfer) {} - - protected override global::System.Type ThresholdType { - get { return typeof (InstanceInnerInvoker); } - } - - } - - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("xamarin/test/NotificationCompatBase", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (NotificationCompatBase); } - } - - protected NotificationCompatBase (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - } -} diff --git a/tests/generator-Tests/expected/NonStaticFields/Mono.Android.projitems b/tests/generator-Tests/expected/NonStaticFields/Mono.Android.projitems deleted file mode 100644 index 066be1dd1..000000000 --- a/tests/generator-Tests/expected/NonStaticFields/Mono.Android.projitems +++ /dev/null @@ -1,15 +0,0 @@ - - - - $(DefineConstants);ANDROID_1;ANDROID_2;ANDROID_3;ANDROID_4 - - - - - - - - - - - \ No newline at end of file diff --git a/tests/generator-Tests/expected/NonStaticFields/Xamarin.Test.SomeObject.cs b/tests/generator-Tests/expected/NonStaticFields/Xamarin.Test.SomeObject.cs deleted file mode 100644 index db0051860..000000000 --- a/tests/generator-Tests/expected/NonStaticFields/Xamarin.Test.SomeObject.cs +++ /dev/null @@ -1,59 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Xamarin.Test { - - // Metadata.xml XPath class reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']" - [global::Android.Runtime.Register ("xamarin/test/SomeObject", DoNotGenerateAcw=true)] - public partial class SomeObject : global::Java.Lang.Object { - - - static IntPtr Value_jfieldId; - - // Metadata.xml XPath field reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/field[@name='Value']" - [Register ("Value")] - public int Value { - get { - if (Value_jfieldId == IntPtr.Zero) - Value_jfieldId = JNIEnv.GetFieldID (class_ref, "Value", "I"); - return JNIEnv.GetIntField (((global::Java.Lang.Object) this).Handle, Value_jfieldId); - } - set { - if (Value_jfieldId == IntPtr.Zero) - Value_jfieldId = JNIEnv.GetFieldID (class_ref, "Value", "I"); - try { - JNIEnv.SetField (((global::Java.Lang.Object) this).Handle, Value_jfieldId, value); - } finally { - } - } - } - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("xamarin/test/SomeObject", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (SomeObject); } - } - - protected SomeObject (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - } -} diff --git a/tests/generator-Tests/expected/NormalMethods/Java.Lang.Throwable.cs b/tests/generator-Tests/expected/NormalMethods/Java.Lang.Throwable.cs deleted file mode 100644 index b2305df63..000000000 --- a/tests/generator-Tests/expected/NormalMethods/Java.Lang.Throwable.cs +++ /dev/null @@ -1,29 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Java.Lang { - - // Metadata.xml XPath class reference: path="/api/package[@name='java.lang']/class[@name='Throwable']" - [global::Android.Runtime.Register ("java/lang/Throwable", DoNotGenerateAcw=true)] - public partial class Throwable { - - internal static IntPtr java_class_handle; - internal static IntPtr class_ref { - get { - return JNIEnv.FindClass ("java/lang/Throwable", ref java_class_handle); - } - } - - } -} diff --git a/tests/generator-Tests/expected/NormalMethods/Mono.Android.projitems b/tests/generator-Tests/expected/NormalMethods/Mono.Android.projitems deleted file mode 100644 index 98ca90f0d..000000000 --- a/tests/generator-Tests/expected/NormalMethods/Mono.Android.projitems +++ /dev/null @@ -1,20 +0,0 @@ - - - - $(DefineConstants);ANDROID_1;ANDROID_2;ANDROID_3;ANDROID_4 - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/generator-Tests/expected/NormalMethods/Xamarin.Test.A.cs b/tests/generator-Tests/expected/NormalMethods/Xamarin.Test.A.cs deleted file mode 100644 index a3b5fe125..000000000 --- a/tests/generator-Tests/expected/NormalMethods/Xamarin.Test.A.cs +++ /dev/null @@ -1,131 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Xamarin.Test { - - // Metadata.xml XPath class reference: path="/api/package[@name='xamarin.test']/class[@name='A']" - [global::Android.Runtime.Register ("xamarin/test/A", DoNotGenerateAcw=true)] - public partial class A : global::Java.Lang.Object { - - // Metadata.xml XPath class reference: path="/api/package[@name='xamarin.test']/class[@name='A.B']" - [global::Android.Runtime.Register ("xamarin/test/A$B", DoNotGenerateAcw=true)] - [global::Java.Interop.JavaTypeParameters (new string [] {"T extends xamarin.test.A.B"})] - public partial class B : global::Java.Lang.Object { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("xamarin/test/A$B", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (B); } - } - - protected B (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static Delegate cb_setCustomDimension_I; -#pragma warning disable 0169 - static Delegate GetSetCustomDimension_IHandler () - { - if (cb_setCustomDimension_I == null) - cb_setCustomDimension_I = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPI_L) n_SetCustomDimension_I); - return cb_setCustomDimension_I; - } - - static IntPtr n_SetCustomDimension_I (IntPtr jnienv, IntPtr native__this, int index) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return JNIEnv.ToLocalJniHandle (__this.SetCustomDimension (index)); - } -#pragma warning restore 0169 - - static IntPtr id_setCustomDimension_I; - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='A.B']/method[@name='setCustomDimension' and count(parameter)=1 and parameter[1][@type='int']]" - [Register ("setCustomDimension", "(I)Lxamarin/test/A$B;", "GetSetCustomDimension_IHandler")] - public virtual unsafe global::Java.Lang.Object SetCustomDimension (int index) - { - if (id_setCustomDimension_I == IntPtr.Zero) - id_setCustomDimension_I = JNIEnv.GetMethodID (class_ref, "setCustomDimension", "(I)Lxamarin/test/A$B;"); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (index); - - if (((object) this).GetType () == ThresholdType) - return (global::Java.Lang.Object) global::Java.Lang.Object.GetObject (JNIEnv.CallObjectMethod (((global::Java.Lang.Object) this).Handle, id_setCustomDimension_I, __args), JniHandleOwnership.TransferLocalRef); - else - return (global::Java.Lang.Object) global::Java.Lang.Object.GetObject (JNIEnv.CallNonvirtualObjectMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "setCustomDimension", "(I)Lxamarin/test/A$B;"), __args), JniHandleOwnership.TransferLocalRef); - } finally { - } - } - - } - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("xamarin/test/A", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (A); } - } - - protected A (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static Delegate cb_getHandle; -#pragma warning disable 0169 - static Delegate GetGetHandleHandler () - { - if (cb_getHandle == null) - cb_getHandle = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_I) n_GetHandle); - return cb_getHandle; - } - - static int n_GetHandle (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return __this.GetHandle (); - } -#pragma warning restore 0169 - - static IntPtr id_getHandle; - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='A']/method[@name='getHandle' and count(parameter)=0]" - [Register ("getHandle", "()I", "GetGetHandleHandler")] - public virtual unsafe int GetHandle () - { - if (id_getHandle == IntPtr.Zero) - id_getHandle = JNIEnv.GetMethodID (class_ref, "getHandle", "()I"); - try { - - if (((object) this).GetType () == ThresholdType) - return JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_getHandle); - else - return JNIEnv.CallNonvirtualIntMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "getHandle", "()I")); - } finally { - } - } - - } -} diff --git a/tests/generator-Tests/expected/NormalMethods/Xamarin.Test.C.cs b/tests/generator-Tests/expected/NormalMethods/Xamarin.Test.C.cs deleted file mode 100644 index 43d12c4ca..000000000 --- a/tests/generator-Tests/expected/NormalMethods/Xamarin.Test.C.cs +++ /dev/null @@ -1,75 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Xamarin.Test { - - // Metadata.xml XPath class reference: path="/api/package[@name='xamarin.test']/class[@name='C']" - [global::Android.Runtime.Register ("xamarin/test/C", DoNotGenerateAcw=true)] - [global::Java.Interop.JavaTypeParameters (new string [] {"T extends xamarin.test.C"})] - public partial class C : global::Java.Lang.Object { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("xamarin/test/C", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (C); } - } - - protected C (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static Delegate cb_setCustomDimension_I; -#pragma warning disable 0169 - static Delegate GetSetCustomDimension_IHandler () - { - if (cb_setCustomDimension_I == null) - cb_setCustomDimension_I = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPI_L) n_SetCustomDimension_I); - return cb_setCustomDimension_I; - } - - static IntPtr n_SetCustomDimension_I (IntPtr jnienv, IntPtr native__this, int index) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return JNIEnv.ToLocalJniHandle (__this.SetCustomDimension (index)); - } -#pragma warning restore 0169 - - static IntPtr id_setCustomDimension_I; - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='C']/method[@name='setCustomDimension' and count(parameter)=1 and parameter[1][@type='int']]" - [Register ("setCustomDimension", "(I)Lxamarin/test/C;", "GetSetCustomDimension_IHandler")] - public virtual unsafe global::Java.Lang.Object SetCustomDimension (int index) - { - if (id_setCustomDimension_I == IntPtr.Zero) - id_setCustomDimension_I = JNIEnv.GetMethodID (class_ref, "setCustomDimension", "(I)Lxamarin/test/C;"); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (index); - - if (((object) this).GetType () == ThresholdType) - return (global::Java.Lang.Object) global::Java.Lang.Object.GetObject (JNIEnv.CallObjectMethod (((global::Java.Lang.Object) this).Handle, id_setCustomDimension_I, __args), JniHandleOwnership.TransferLocalRef); - else - return (global::Java.Lang.Object) global::Java.Lang.Object.GetObject (JNIEnv.CallNonvirtualObjectMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "setCustomDimension", "(I)Lxamarin/test/C;"), __args), JniHandleOwnership.TransferLocalRef); - } finally { - } - } - - } -} diff --git a/tests/generator-Tests/expected/NormalMethods/Xamarin.Test.SomeObject.cs b/tests/generator-Tests/expected/NormalMethods/Xamarin.Test.SomeObject.cs deleted file mode 100644 index e56bf97c8..000000000 --- a/tests/generator-Tests/expected/NormalMethods/Xamarin.Test.SomeObject.cs +++ /dev/null @@ -1,390 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Xamarin.Test { - - // Metadata.xml XPath class reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']" - [global::Android.Runtime.Register ("xamarin/test/SomeObject", DoNotGenerateAcw=true)] - public partial class SomeObject : global::Java.Lang.Object { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("xamarin/test/SomeObject", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (SomeObject); } - } - - protected SomeObject (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static IntPtr id_ctor_Ljava_lang_Class_; - // Metadata.xml XPath constructor reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/constructor[@name='SomeObject' and count(parameter)=1 and parameter[1][@type='java.lang.Class<? extends xamarin.test.SomeObject>']]" - [Register (".ctor", "(Ljava/lang/Class;)V", "")] - public unsafe SomeObject (global::Java.Lang.Class c) - : base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer) - { - if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero) - return; - - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (c); - if (((object) this).GetType () != typeof (SomeObject)) { - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (((object) this).GetType (), "(Ljava/lang/Class;)V", __args), - JniHandleOwnership.TransferLocalRef); - global::Android.Runtime.JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, "(Ljava/lang/Class;)V", __args); - return; - } - - if (id_ctor_Ljava_lang_Class_ == IntPtr.Zero) - id_ctor_Ljava_lang_Class_ = JNIEnv.GetMethodID (class_ref, "", "(Ljava/lang/Class;)V"); - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (class_ref, id_ctor_Ljava_lang_Class_, __args), - JniHandleOwnership.TransferLocalRef); - JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, class_ref, id_ctor_Ljava_lang_Class_, __args); - } finally { - } - } - - static Delegate cb_getType; -#pragma warning disable 0169 - static Delegate GetGetTypeHandler () - { - if (cb_getType == null) - cb_getType = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_L) n_GetType); - return cb_getType; - } - - static IntPtr n_GetType (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return JNIEnv.NewArray (__this.GetType ()); - } -#pragma warning restore 0169 - - static IntPtr id_getType; - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/method[@name='getType' and count(parameter)=0]" - [Register ("getType", "()[I", "GetGetTypeHandler")] - public new virtual unsafe int[] GetType () - { - if (id_getType == IntPtr.Zero) - id_getType = JNIEnv.GetMethodID (class_ref, "getType", "()[I"); - try { - - if (((object) this).GetType () == ThresholdType) - return (int[]) JNIEnv.GetArray (JNIEnv.CallObjectMethod (((global::Java.Lang.Object) this).Handle, id_getType), JniHandleOwnership.TransferLocalRef, typeof (int)); - else - return (int[]) JNIEnv.GetArray (JNIEnv.CallNonvirtualObjectMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "getType", "()[I")), JniHandleOwnership.TransferLocalRef, typeof (int)); - } finally { - } - } - - static Delegate cb_handle_Ljava_lang_Object_Ljava_lang_Throwable_; -#pragma warning disable 0169 - static Delegate GetHandle_Ljava_lang_Object_Ljava_lang_Throwable_Handler () - { - if (cb_handle_Ljava_lang_Object_Ljava_lang_Throwable_ == null) - cb_handle_Ljava_lang_Object_Ljava_lang_Throwable_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPLL_I) n_Handle_Ljava_lang_Object_Ljava_lang_Throwable_); - return cb_handle_Ljava_lang_Object_Ljava_lang_Throwable_; - } - - static int n_Handle_Ljava_lang_Object_Ljava_lang_Throwable_ (IntPtr jnienv, IntPtr native__this, IntPtr native_o, IntPtr native_t) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var o = global::Java.Lang.Object.GetObject (native_o, JniHandleOwnership.DoNotTransfer); - var t = global::Java.Lang.Object.GetObject (native_t, JniHandleOwnership.DoNotTransfer); - int __ret = __this.Handle (o, t); - return __ret; - } -#pragma warning restore 0169 - - static IntPtr id_handle_Ljava_lang_Object_Ljava_lang_Throwable_; - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/method[@name='handle' and count(parameter)=2 and parameter[1][@type='java.lang.Object'] and parameter[2][@type='java.lang.Throwable']]" - [Register ("handle", "(Ljava/lang/Object;Ljava/lang/Throwable;)I", "GetHandle_Ljava_lang_Object_Ljava_lang_Throwable_Handler")] - public new virtual unsafe int Handle (global::Java.Lang.Object o, global::Java.Lang.Throwable t) - { - if (id_handle_Ljava_lang_Object_Ljava_lang_Throwable_ == IntPtr.Zero) - id_handle_Ljava_lang_Object_Ljava_lang_Throwable_ = JNIEnv.GetMethodID (class_ref, "handle", "(Ljava/lang/Object;Ljava/lang/Throwable;)I"); - try { - JValue* __args = stackalloc JValue [2]; - __args [0] = new JValue (o); - __args [1] = new JValue (t); - - int __ret; - if (((object) this).GetType () == ThresholdType) - __ret = JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_handle_Ljava_lang_Object_Ljava_lang_Throwable_, __args); - else - __ret = JNIEnv.CallNonvirtualIntMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "handle", "(Ljava/lang/Object;Ljava/lang/Throwable;)I"), __args); - return __ret; - } finally { - } - } - - static Delegate cb_IntegerMethod; -#pragma warning disable 0169 - static Delegate GetIntegerMethodHandler () - { - if (cb_IntegerMethod == null) - cb_IntegerMethod = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_I) n_IntegerMethod); - return cb_IntegerMethod; - } - - static int n_IntegerMethod (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return __this.IntegerMethod (); - } -#pragma warning restore 0169 - - static IntPtr id_IntegerMethod; - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/method[@name='IntegerMethod' and count(parameter)=0]" - [Register ("IntegerMethod", "()I", "GetIntegerMethodHandler")] - public virtual unsafe int IntegerMethod () - { - if (id_IntegerMethod == IntPtr.Zero) - id_IntegerMethod = JNIEnv.GetMethodID (class_ref, "IntegerMethod", "()I"); - try { - - if (((object) this).GetType () == ThresholdType) - return JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_IntegerMethod); - else - return JNIEnv.CallNonvirtualIntMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "IntegerMethod", "()I")); - } finally { - } - } - - static Delegate cb_VoidMethod; -#pragma warning disable 0169 - static Delegate GetVoidMethodHandler () - { - if (cb_VoidMethod == null) - cb_VoidMethod = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_V) n_VoidMethod); - return cb_VoidMethod; - } - - static void n_VoidMethod (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.VoidMethod (); - } -#pragma warning restore 0169 - - static IntPtr id_VoidMethod; - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/method[@name='VoidMethod' and count(parameter)=0]" - [Register ("VoidMethod", "()V", "GetVoidMethodHandler")] - public virtual unsafe void VoidMethod () - { - if (id_VoidMethod == IntPtr.Zero) - id_VoidMethod = JNIEnv.GetMethodID (class_ref, "VoidMethod", "()V"); - try { - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_VoidMethod); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "VoidMethod", "()V")); - } finally { - } - } - - static Delegate cb_StringMethod; -#pragma warning disable 0169 - static Delegate GetStringMethodHandler () - { - if (cb_StringMethod == null) - cb_StringMethod = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_L) n_StringMethod); - return cb_StringMethod; - } - - static IntPtr n_StringMethod (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return JNIEnv.NewString (__this.StringMethod ()); - } -#pragma warning restore 0169 - - static IntPtr id_StringMethod; - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/method[@name='StringMethod' and count(parameter)=0]" - [Register ("StringMethod", "()Ljava/lang/String;", "GetStringMethodHandler")] - public virtual unsafe string StringMethod () - { - if (id_StringMethod == IntPtr.Zero) - id_StringMethod = JNIEnv.GetMethodID (class_ref, "StringMethod", "()Ljava/lang/String;"); - try { - - if (((object) this).GetType () == ThresholdType) - return JNIEnv.GetString (JNIEnv.CallObjectMethod (((global::Java.Lang.Object) this).Handle, id_StringMethod), JniHandleOwnership.TransferLocalRef); - else - return JNIEnv.GetString (JNIEnv.CallNonvirtualObjectMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "StringMethod", "()Ljava/lang/String;")), JniHandleOwnership.TransferLocalRef); - } finally { - } - } - - static Delegate cb_ObjectMethod; -#pragma warning disable 0169 - static Delegate GetObjectMethodHandler () - { - if (cb_ObjectMethod == null) - cb_ObjectMethod = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_L) n_ObjectMethod); - return cb_ObjectMethod; - } - - static IntPtr n_ObjectMethod (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return JNIEnv.ToLocalJniHandle (__this.ObjectMethod ()); - } -#pragma warning restore 0169 - - static IntPtr id_ObjectMethod; - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/method[@name='ObjectMethod' and count(parameter)=0]" - [Register ("ObjectMethod", "()Ljava/lang/Object;", "GetObjectMethodHandler")] - public virtual unsafe global::Java.Lang.Object ObjectMethod () - { - if (id_ObjectMethod == IntPtr.Zero) - id_ObjectMethod = JNIEnv.GetMethodID (class_ref, "ObjectMethod", "()Ljava/lang/Object;"); - try { - - if (((object) this).GetType () == ThresholdType) - return global::Java.Lang.Object.GetObject (JNIEnv.CallObjectMethod (((global::Java.Lang.Object) this).Handle, id_ObjectMethod), JniHandleOwnership.TransferLocalRef); - else - return global::Java.Lang.Object.GetObject (JNIEnv.CallNonvirtualObjectMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "ObjectMethod", "()Ljava/lang/Object;")), JniHandleOwnership.TransferLocalRef); - } finally { - } - } - - static Delegate cb_VoidMethodWithParams_Ljava_lang_String_ILjava_lang_Object_; -#pragma warning disable 0169 - static Delegate GetVoidMethodWithParams_Ljava_lang_String_ILjava_lang_Object_Handler () - { - if (cb_VoidMethodWithParams_Ljava_lang_String_ILjava_lang_Object_ == null) - cb_VoidMethodWithParams_Ljava_lang_String_ILjava_lang_Object_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPLIL_V) n_VoidMethodWithParams_Ljava_lang_String_ILjava_lang_Object_); - return cb_VoidMethodWithParams_Ljava_lang_String_ILjava_lang_Object_; - } - - static void n_VoidMethodWithParams_Ljava_lang_String_ILjava_lang_Object_ (IntPtr jnienv, IntPtr native__this, IntPtr native_astring, int anint, IntPtr native_anObject) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var astring = JNIEnv.GetString (native_astring, JniHandleOwnership.DoNotTransfer); - var anObject = global::Java.Lang.Object.GetObject (native_anObject, JniHandleOwnership.DoNotTransfer); - __this.VoidMethodWithParams (astring, anint, anObject); - } -#pragma warning restore 0169 - - static IntPtr id_VoidMethodWithParams_Ljava_lang_String_ILjava_lang_Object_; - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/method[@name='VoidMethodWithParams' and count(parameter)=3 and parameter[1][@type='java.lang.String'] and parameter[2][@type='int'] and parameter[3][@type='java.lang.Object']]" - [Register ("VoidMethodWithParams", "(Ljava/lang/String;ILjava/lang/Object;)V", "GetVoidMethodWithParams_Ljava_lang_String_ILjava_lang_Object_Handler")] - public virtual unsafe void VoidMethodWithParams (string astring, int anint, global::Java.Lang.Object anObject) - { - if (id_VoidMethodWithParams_Ljava_lang_String_ILjava_lang_Object_ == IntPtr.Zero) - id_VoidMethodWithParams_Ljava_lang_String_ILjava_lang_Object_ = JNIEnv.GetMethodID (class_ref, "VoidMethodWithParams", "(Ljava/lang/String;ILjava/lang/Object;)V"); - IntPtr native_astring = JNIEnv.NewString ((string)astring); - try { - JValue* __args = stackalloc JValue [3]; - __args [0] = new JValue (native_astring); - __args [1] = new JValue (anint); - __args [2] = new JValue (anObject); - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_VoidMethodWithParams_Ljava_lang_String_ILjava_lang_Object_, __args); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "VoidMethodWithParams", "(Ljava/lang/String;ILjava/lang/Object;)V"), __args); - } finally { - JNIEnv.DeleteLocalRef (native_astring); - } - } - - static Delegate cb_ObsoleteMethod; -#pragma warning disable 0169 - [Obsolete] - static Delegate GetObsoleteMethodHandler () - { - if (cb_ObsoleteMethod == null) - cb_ObsoleteMethod = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_I) n_ObsoleteMethod); - return cb_ObsoleteMethod; - } - - [Obsolete] - static int n_ObsoleteMethod (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return __this.ObsoleteMethod (); - } -#pragma warning restore 0169 - - static IntPtr id_ObsoleteMethod; - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/method[@name='ObsoleteMethod' and count(parameter)=0]" - [Obsolete (@"Deprecated please use IntegerMethod instead")] - [Register ("ObsoleteMethod", "()I", "GetObsoleteMethodHandler")] - public virtual unsafe int ObsoleteMethod () - { - if (id_ObsoleteMethod == IntPtr.Zero) - id_ObsoleteMethod = JNIEnv.GetMethodID (class_ref, "ObsoleteMethod", "()I"); - try { - - if (((object) this).GetType () == ThresholdType) - return JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_ObsoleteMethod); - else - return JNIEnv.CallNonvirtualIntMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "ObsoleteMethod", "()I")); - } finally { - } - } - - static Delegate cb_ArrayListTest_Ljava_util_ArrayList_; -#pragma warning disable 0169 - static Delegate GetArrayListTest_Ljava_util_ArrayList_Handler () - { - if (cb_ArrayListTest_Ljava_util_ArrayList_ == null) - cb_ArrayListTest_Ljava_util_ArrayList_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_V) n_ArrayListTest_Ljava_util_ArrayList_); - return cb_ArrayListTest_Ljava_util_ArrayList_; - } - - static void n_ArrayListTest_Ljava_util_ArrayList_ (IntPtr jnienv, IntPtr native__this, IntPtr native_p0) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var p0 = global::Android.Runtime.JavaList.FromJniHandle (native_p0, JniHandleOwnership.DoNotTransfer); - __this.ArrayListTest (p0); - } -#pragma warning restore 0169 - - static IntPtr id_ArrayListTest_Ljava_util_ArrayList_; - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/method[@name='ArrayListTest' and count(parameter)=1 and parameter[1][@type='java.util.ArrayList<java.lang.Integer>']]" - [Register ("ArrayListTest", "(Ljava/util/ArrayList;)V", "GetArrayListTest_Ljava_util_ArrayList_Handler")] - public virtual unsafe void ArrayListTest (global::System.Collections.Generic.IList p0) - { - if (id_ArrayListTest_Ljava_util_ArrayList_ == IntPtr.Zero) - id_ArrayListTest_Ljava_util_ArrayList_ = JNIEnv.GetMethodID (class_ref, "ArrayListTest", "(Ljava/util/ArrayList;)V"); - IntPtr native_p0 = global::Android.Runtime.JavaList.ToLocalJniHandle (p0); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_p0); - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_ArrayListTest_Ljava_util_ArrayList_, __args); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "ArrayListTest", "(Ljava/util/ArrayList;)V"), __args); - } finally { - JNIEnv.DeleteLocalRef (native_p0); - } - } - - } -} diff --git a/tests/generator-Tests/expected/NormalProperties/Mono.Android.projitems b/tests/generator-Tests/expected/NormalProperties/Mono.Android.projitems deleted file mode 100644 index 066be1dd1..000000000 --- a/tests/generator-Tests/expected/NormalProperties/Mono.Android.projitems +++ /dev/null @@ -1,15 +0,0 @@ - - - - $(DefineConstants);ANDROID_1;ANDROID_2;ANDROID_3;ANDROID_4 - - - - - - - - - - - \ No newline at end of file diff --git a/tests/generator-Tests/expected/NormalProperties/Xamarin.Test.SomeObject.cs b/tests/generator-Tests/expected/NormalProperties/Xamarin.Test.SomeObject.cs deleted file mode 100644 index bcedc36c1..000000000 --- a/tests/generator-Tests/expected/NormalProperties/Xamarin.Test.SomeObject.cs +++ /dev/null @@ -1,253 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Xamarin.Test { - - // Metadata.xml XPath class reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']" - [global::Android.Runtime.Register ("xamarin/test/SomeObject", DoNotGenerateAcw=true)] - public abstract partial class SomeObject : global::Java.Lang.Object { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("xamarin/test/SomeObject", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (SomeObject); } - } - - protected SomeObject (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static Delegate cb_getSomeInteger; -#pragma warning disable 0169 - static Delegate GetGetSomeIntegerHandler () - { - if (cb_getSomeInteger == null) - cb_getSomeInteger = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_I) n_GetSomeInteger); - return cb_getSomeInteger; - } - - static int n_GetSomeInteger (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return __this.SomeInteger; - } -#pragma warning restore 0169 - - static Delegate cb_setSomeInteger_I; -#pragma warning disable 0169 - static Delegate GetSetSomeInteger_IHandler () - { - if (cb_setSomeInteger_I == null) - cb_setSomeInteger_I = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPI_V) n_SetSomeInteger_I); - return cb_setSomeInteger_I; - } - - static void n_SetSomeInteger_I (IntPtr jnienv, IntPtr native__this, int newvalue) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.SomeInteger = newvalue; - } -#pragma warning restore 0169 - - public abstract int SomeInteger { - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/method[@name='getSomeInteger' and count(parameter)=0]" - [Register ("getSomeInteger", "()I", "GetGetSomeIntegerHandler")] get; - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/method[@name='setSomeInteger' and count(parameter)=1 and parameter[1][@type='int']]" - [Register ("setSomeInteger", "(I)V", "GetSetSomeInteger_IHandler")] set; - } - - static Delegate cb_getSomeObjectProperty; -#pragma warning disable 0169 - static Delegate GetGetSomeObjectPropertyHandler () - { - if (cb_getSomeObjectProperty == null) - cb_getSomeObjectProperty = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_L) n_GetSomeObjectProperty); - return cb_getSomeObjectProperty; - } - - static IntPtr n_GetSomeObjectProperty (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return JNIEnv.ToLocalJniHandle (__this.SomeObjectProperty); - } -#pragma warning restore 0169 - - static Delegate cb_setSomeObjectProperty_Ljava_lang_Object_; -#pragma warning disable 0169 - static Delegate GetSetSomeObjectProperty_Ljava_lang_Object_Handler () - { - if (cb_setSomeObjectProperty_Ljava_lang_Object_ == null) - cb_setSomeObjectProperty_Ljava_lang_Object_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_V) n_SetSomeObjectProperty_Ljava_lang_Object_); - return cb_setSomeObjectProperty_Ljava_lang_Object_; - } - - static void n_SetSomeObjectProperty_Ljava_lang_Object_ (IntPtr jnienv, IntPtr native__this, IntPtr native_newvalue) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var newvalue = global::Java.Lang.Object.GetObject (native_newvalue, JniHandleOwnership.DoNotTransfer); - __this.SomeObjectProperty = newvalue; - } -#pragma warning restore 0169 - - public abstract global::Java.Lang.Object SomeObjectProperty { - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/method[@name='getSomeObjectProperty' and count(parameter)=0]" - [Register ("getSomeObjectProperty", "()Ljava/lang/Object;", "GetGetSomeObjectPropertyHandler")] get; - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/method[@name='setSomeObjectProperty' and count(parameter)=1 and parameter[1][@type='java.lang.Object']]" - [Register ("setSomeObjectProperty", "(Ljava/lang/Object;)V", "GetSetSomeObjectProperty_Ljava_lang_Object_Handler")] set; - } - - static Delegate cb_getSomeString; -#pragma warning disable 0169 - static Delegate GetGetSomeStringHandler () - { - if (cb_getSomeString == null) - cb_getSomeString = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_L) n_GetSomeString); - return cb_getSomeString; - } - - static IntPtr n_GetSomeString (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return JNIEnv.NewString (__this.SomeString); - } -#pragma warning restore 0169 - - static Delegate cb_setSomeString_Ljava_lang_String_; -#pragma warning disable 0169 - static Delegate GetSetSomeString_Ljava_lang_String_Handler () - { - if (cb_setSomeString_Ljava_lang_String_ == null) - cb_setSomeString_Ljava_lang_String_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_V) n_SetSomeString_Ljava_lang_String_); - return cb_setSomeString_Ljava_lang_String_; - } - - static void n_SetSomeString_Ljava_lang_String_ (IntPtr jnienv, IntPtr native__this, IntPtr native_newvalue) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var newvalue = JNIEnv.GetString (native_newvalue, JniHandleOwnership.DoNotTransfer); - __this.SomeString = newvalue; - } -#pragma warning restore 0169 - - public abstract string SomeString { - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/method[@name='getSomeString' and count(parameter)=0]" - [Register ("getSomeString", "()Ljava/lang/String;", "GetGetSomeStringHandler")] get; - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/method[@name='setSomeString' and count(parameter)=1 and parameter[1][@type='java.lang.String']]" - [Register ("setSomeString", "(Ljava/lang/String;)V", "GetSetSomeString_Ljava_lang_String_Handler")] set; - } - - } - - [global::Android.Runtime.Register ("xamarin/test/SomeObject", DoNotGenerateAcw=true)] - internal partial class SomeObjectInvoker : SomeObject { - - public SomeObjectInvoker (IntPtr handle, JniHandleOwnership transfer) : base (handle, transfer) {} - - protected override global::System.Type ThresholdType { - get { return typeof (SomeObjectInvoker); } - } - - static IntPtr id_getSomeInteger; - static IntPtr id_setSomeInteger_I; - public override unsafe int SomeInteger { - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/method[@name='getSomeInteger' and count(parameter)=0]" - [Register ("getSomeInteger", "()I", "GetGetSomeIntegerHandler")] - get { - if (id_getSomeInteger == IntPtr.Zero) - id_getSomeInteger = JNIEnv.GetMethodID (class_ref, "getSomeInteger", "()I"); - try { - return JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_getSomeInteger); - } finally { - } - } - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/method[@name='setSomeInteger' and count(parameter)=1 and parameter[1][@type='int']]" - [Register ("setSomeInteger", "(I)V", "GetSetSomeInteger_IHandler")] - set { - if (id_setSomeInteger_I == IntPtr.Zero) - id_setSomeInteger_I = JNIEnv.GetMethodID (class_ref, "setSomeInteger", "(I)V"); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (value); - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_setSomeInteger_I, __args); - } finally { - } - } - } - - static IntPtr id_getSomeObjectProperty; - static IntPtr id_setSomeObjectProperty_Ljava_lang_Object_; - public override unsafe global::Java.Lang.Object SomeObjectProperty { - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/method[@name='getSomeObjectProperty' and count(parameter)=0]" - [Register ("getSomeObjectProperty", "()Ljava/lang/Object;", "GetGetSomeObjectPropertyHandler")] - get { - if (id_getSomeObjectProperty == IntPtr.Zero) - id_getSomeObjectProperty = JNIEnv.GetMethodID (class_ref, "getSomeObjectProperty", "()Ljava/lang/Object;"); - try { - return global::Java.Lang.Object.GetObject (JNIEnv.CallObjectMethod (((global::Java.Lang.Object) this).Handle, id_getSomeObjectProperty), JniHandleOwnership.TransferLocalRef); - } finally { - } - } - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/method[@name='setSomeObjectProperty' and count(parameter)=1 and parameter[1][@type='java.lang.Object']]" - [Register ("setSomeObjectProperty", "(Ljava/lang/Object;)V", "GetSetSomeObjectProperty_Ljava_lang_Object_Handler")] - set { - if (id_setSomeObjectProperty_Ljava_lang_Object_ == IntPtr.Zero) - id_setSomeObjectProperty_Ljava_lang_Object_ = JNIEnv.GetMethodID (class_ref, "setSomeObjectProperty", "(Ljava/lang/Object;)V"); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (value); - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_setSomeObjectProperty_Ljava_lang_Object_, __args); - } finally { - } - } - } - - static IntPtr id_getSomeString; - static IntPtr id_setSomeString_Ljava_lang_String_; - public override unsafe string SomeString { - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/method[@name='getSomeString' and count(parameter)=0]" - [Register ("getSomeString", "()Ljava/lang/String;", "GetGetSomeStringHandler")] - get { - if (id_getSomeString == IntPtr.Zero) - id_getSomeString = JNIEnv.GetMethodID (class_ref, "getSomeString", "()Ljava/lang/String;"); - try { - return JNIEnv.GetString (JNIEnv.CallObjectMethod (((global::Java.Lang.Object) this).Handle, id_getSomeString), JniHandleOwnership.TransferLocalRef); - } finally { - } - } - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/method[@name='setSomeString' and count(parameter)=1 and parameter[1][@type='java.lang.String']]" - [Register ("setSomeString", "(Ljava/lang/String;)V", "GetSetSomeString_Ljava_lang_String_Handler")] - set { - if (id_setSomeString_Ljava_lang_String_ == IntPtr.Zero) - id_setSomeString_Ljava_lang_String_ = JNIEnv.GetMethodID (class_ref, "setSomeString", "(Ljava/lang/String;)V"); - IntPtr native_value = JNIEnv.NewString ((string)value); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_value); - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_setSomeString_Ljava_lang_String_, __args); - } finally { - JNIEnv.DeleteLocalRef (native_value); - } - } - } - - } - -} diff --git a/tests/generator-Tests/expected/ParameterXPath/Mono.Android.projitems b/tests/generator-Tests/expected/ParameterXPath/Mono.Android.projitems deleted file mode 100644 index e6f21d31f..000000000 --- a/tests/generator-Tests/expected/ParameterXPath/Mono.Android.projitems +++ /dev/null @@ -1,16 +0,0 @@ - - - - $(DefineConstants);ANDROID_1;ANDROID_2;ANDROID_3;ANDROID_4 - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/generator-Tests/expected/ParameterXPath/Xamarin.Test.A.cs b/tests/generator-Tests/expected/ParameterXPath/Xamarin.Test.A.cs deleted file mode 100644 index 5e4136993..000000000 --- a/tests/generator-Tests/expected/ParameterXPath/Xamarin.Test.A.cs +++ /dev/null @@ -1,116 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Xamarin.Test { - - // Metadata.xml XPath class reference: path="/api/package[@name='xamarin.test']/class[@name='A']" - [global::Android.Runtime.Register ("xamarin/test/A", DoNotGenerateAcw=true)] - [global::Java.Interop.JavaTypeParameters (new string [] {"T extends java.lang.Object"})] - public partial class A : global::Java.Lang.Object { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("xamarin/test/A", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (A); } - } - - protected A (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static Delegate cb_setA_Ljava_lang_Object_; -#pragma warning disable 0169 - static Delegate GetSetA_Ljava_lang_Object_Handler () - { - if (cb_setA_Ljava_lang_Object_ == null) - cb_setA_Ljava_lang_Object_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_V) n_SetA_Ljava_lang_Object_); - return cb_setA_Ljava_lang_Object_; - } - - static void n_SetA_Ljava_lang_Object_ (IntPtr jnienv, IntPtr native__this, IntPtr native_adapter) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var adapter = global::Java.Lang.Object.GetObject (native_adapter, JniHandleOwnership.DoNotTransfer); - __this.SetA (adapter); - } -#pragma warning restore 0169 - - static IntPtr id_setA_Ljava_lang_Object_; - // 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']]" - [Register ("setA", "(Ljava/lang/Object;)V", "GetSetA_Ljava_lang_Object_Handler")] - public virtual unsafe void SetA (global::Java.Lang.Object adapter) - { - if (id_setA_Ljava_lang_Object_ == IntPtr.Zero) - id_setA_Ljava_lang_Object_ = JNIEnv.GetMethodID (class_ref, "setA", "(Ljava/lang/Object;)V"); - IntPtr native_adapter = JNIEnv.ToLocalJniHandle (adapter); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_adapter); - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_setA_Ljava_lang_Object_, __args); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "setA", "(Ljava/lang/Object;)V"), __args); - } finally { - JNIEnv.DeleteLocalRef (native_adapter); - } - } - - static Delegate cb_listTest_Ljava_util_List_; -#pragma warning disable 0169 - static Delegate GetListTest_Ljava_util_List_Handler () - { - if (cb_listTest_Ljava_util_List_ == null) - cb_listTest_Ljava_util_List_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_V) n_ListTest_Ljava_util_List_); - return cb_listTest_Ljava_util_List_; - } - - static void n_ListTest_Ljava_util_List_ (IntPtr jnienv, IntPtr native__this, IntPtr native_p0) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var p0 = global::Android.Runtime.JavaList.FromJniHandle (native_p0, JniHandleOwnership.DoNotTransfer); - __this.ListTest (p0); - } -#pragma warning restore 0169 - - static IntPtr id_listTest_Ljava_util_List_; - // 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<java.lang.Integer>']]" - [Register ("listTest", "(Ljava/util/List;)V", "GetListTest_Ljava_util_List_Handler")] - public virtual unsafe void ListTest (global::System.Collections.Generic.IList p0) - { - if (id_listTest_Ljava_util_List_ == IntPtr.Zero) - id_listTest_Ljava_util_List_ = JNIEnv.GetMethodID (class_ref, "listTest", "(Ljava/util/List;)V"); - IntPtr native_p0 = global::Android.Runtime.JavaList.ToLocalJniHandle (p0); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_p0); - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_listTest_Ljava_util_List_, __args); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "listTest", "(Ljava/util/List;)V"), __args); - } finally { - JNIEnv.DeleteLocalRef (native_p0); - } - } - - } -} diff --git a/tests/generator-Tests/expected/StaticFields/Mono.Android.projitems b/tests/generator-Tests/expected/StaticFields/Mono.Android.projitems deleted file mode 100644 index 066be1dd1..000000000 --- a/tests/generator-Tests/expected/StaticFields/Mono.Android.projitems +++ /dev/null @@ -1,15 +0,0 @@ - - - - $(DefineConstants);ANDROID_1;ANDROID_2;ANDROID_3;ANDROID_4 - - - - - - - - - - - \ No newline at end of file diff --git a/tests/generator-Tests/expected/StaticFields/Xamarin.Test.SomeObject.cs b/tests/generator-Tests/expected/StaticFields/Xamarin.Test.SomeObject.cs deleted file mode 100644 index a4e0ca6b2..000000000 --- a/tests/generator-Tests/expected/StaticFields/Xamarin.Test.SomeObject.cs +++ /dev/null @@ -1,71 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Xamarin.Test { - - // Metadata.xml XPath class reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']" - [global::Android.Runtime.Register ("xamarin/test/SomeObject", DoNotGenerateAcw=true)] - public partial class SomeObject : global::Java.Lang.Object { - - - static IntPtr Value_jfieldId; - - // Metadata.xml XPath field reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/field[@name='Value']" - [Register ("Value")] - public static int Value { - get { - if (Value_jfieldId == IntPtr.Zero) - Value_jfieldId = JNIEnv.GetStaticFieldID (class_ref, "Value", "I"); - return JNIEnv.GetStaticIntField (class_ref, Value_jfieldId); - } - } - - static IntPtr Value2_jfieldId; - - // Metadata.xml XPath field reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/field[@name='Value2']" - [Register ("Value2")] - public static int Value2 { - get { - if (Value2_jfieldId == IntPtr.Zero) - Value2_jfieldId = JNIEnv.GetStaticFieldID (class_ref, "Value2", "I"); - return JNIEnv.GetStaticIntField (class_ref, Value2_jfieldId); - } - set { - if (Value2_jfieldId == IntPtr.Zero) - Value2_jfieldId = JNIEnv.GetStaticFieldID (class_ref, "Value2", "I"); - try { - JNIEnv.SetStaticField (class_ref, Value2_jfieldId, value); - } finally { - } - } - } - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("xamarin/test/SomeObject", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (SomeObject); } - } - - protected SomeObject (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - } -} diff --git a/tests/generator-Tests/expected/StaticMethods/Mono.Android.projitems b/tests/generator-Tests/expected/StaticMethods/Mono.Android.projitems deleted file mode 100644 index 066be1dd1..000000000 --- a/tests/generator-Tests/expected/StaticMethods/Mono.Android.projitems +++ /dev/null @@ -1,15 +0,0 @@ - - - - $(DefineConstants);ANDROID_1;ANDROID_2;ANDROID_3;ANDROID_4 - - - - - - - - - - - \ No newline at end of file diff --git a/tests/generator-Tests/expected/StaticMethods/Xamarin.Test.SomeObject.cs b/tests/generator-Tests/expected/StaticMethods/Xamarin.Test.SomeObject.cs deleted file mode 100644 index 4340390e9..000000000 --- a/tests/generator-Tests/expected/StaticMethods/Xamarin.Test.SomeObject.cs +++ /dev/null @@ -1,79 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Xamarin.Test { - - // Metadata.xml XPath class reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']" - [global::Android.Runtime.Register ("xamarin/test/SomeObject", DoNotGenerateAcw=true)] - public partial class SomeObject : global::Java.Lang.Object { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("xamarin/test/SomeObject", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (SomeObject); } - } - - protected SomeObject (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static IntPtr id_methodAsInt; - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/method[@name='methodAsInt' and count(parameter)=0]" - [Register ("methodAsInt", "()I", "")] - public static unsafe int MethodAsInt () - { - if (id_methodAsInt == IntPtr.Zero) - id_methodAsInt = JNIEnv.GetStaticMethodID (class_ref, "methodAsInt", "()I"); - try { - return JNIEnv.CallStaticIntMethod (class_ref, id_methodAsInt); - } finally { - } - } - - static IntPtr id_methodAsString; - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/method[@name='methodAsString' and count(parameter)=0]" - [Register ("methodAsString", "()Ljava/lang/String;", "")] - public static unsafe string MethodAsString () - { - if (id_methodAsString == IntPtr.Zero) - id_methodAsString = JNIEnv.GetStaticMethodID (class_ref, "methodAsString", "()Ljava/lang/String;"); - try { - return JNIEnv.GetString (JNIEnv.CallStaticObjectMethod (class_ref, id_methodAsString), JniHandleOwnership.TransferLocalRef); - } finally { - } - } - - static IntPtr id_Obsoletemethod; - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/method[@name='Obsoletemethod' and count(parameter)=0]" - [Obsolete (@"Deprecated please use methodAsString")] - [Register ("Obsoletemethod", "()Ljava/lang/String;", "")] - public static unsafe string Obsoletemethod () - { - if (id_Obsoletemethod == IntPtr.Zero) - id_Obsoletemethod = JNIEnv.GetStaticMethodID (class_ref, "Obsoletemethod", "()Ljava/lang/String;"); - try { - return JNIEnv.GetString (JNIEnv.CallStaticObjectMethod (class_ref, id_Obsoletemethod), JniHandleOwnership.TransferLocalRef); - } finally { - } - } - - } -} diff --git a/tests/generator-Tests/expected/StaticProperties/Mono.Android.projitems b/tests/generator-Tests/expected/StaticProperties/Mono.Android.projitems deleted file mode 100644 index 066be1dd1..000000000 --- a/tests/generator-Tests/expected/StaticProperties/Mono.Android.projitems +++ /dev/null @@ -1,15 +0,0 @@ - - - - $(DefineConstants);ANDROID_1;ANDROID_2;ANDROID_3;ANDROID_4 - - - - - - - - - - - \ No newline at end of file diff --git a/tests/generator-Tests/expected/StaticProperties/Xamarin.Test.SomeObject.cs b/tests/generator-Tests/expected/StaticProperties/Xamarin.Test.SomeObject.cs deleted file mode 100644 index 45b08ec40..000000000 --- a/tests/generator-Tests/expected/StaticProperties/Xamarin.Test.SomeObject.cs +++ /dev/null @@ -1,123 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Xamarin.Test { - - // Metadata.xml XPath class reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']" - [global::Android.Runtime.Register ("xamarin/test/SomeObject", DoNotGenerateAcw=true)] - public partial class SomeObject : global::Java.Lang.Object { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("xamarin/test/SomeObject", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (SomeObject); } - } - - protected SomeObject (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static IntPtr id_getSomeInteger; - static IntPtr id_setSomeInteger_I; - public static unsafe int SomeInteger { - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/method[@name='getSomeInteger' and count(parameter)=0]" - [Register ("getSomeInteger", "()I", "")] - get { - if (id_getSomeInteger == IntPtr.Zero) - id_getSomeInteger = JNIEnv.GetStaticMethodID (class_ref, "getSomeInteger", "()I"); - try { - return JNIEnv.CallStaticIntMethod (class_ref, id_getSomeInteger); - } finally { - } - } - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/method[@name='setSomeInteger' and count(parameter)=1 and parameter[1][@type='int']]" - [Register ("setSomeInteger", "(I)V", "")] - set { - if (id_setSomeInteger_I == IntPtr.Zero) - id_setSomeInteger_I = JNIEnv.GetStaticMethodID (class_ref, "setSomeInteger", "(I)V"); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (value); - JNIEnv.CallStaticVoidMethod (class_ref, id_setSomeInteger_I, __args); - } finally { - } - } - } - - static IntPtr id_getSomeString; - static IntPtr id_setSomeString_Ljava_lang_String_; - public static unsafe string SomeString { - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/method[@name='getSomeString' and count(parameter)=0]" - [Register ("getSomeString", "()Ljava/lang/String;", "")] - get { - if (id_getSomeString == IntPtr.Zero) - id_getSomeString = JNIEnv.GetStaticMethodID (class_ref, "getSomeString", "()Ljava/lang/String;"); - try { - return JNIEnv.GetString (JNIEnv.CallStaticObjectMethod (class_ref, id_getSomeString), JniHandleOwnership.TransferLocalRef); - } finally { - } - } - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/method[@name='setSomeString' and count(parameter)=1 and parameter[1][@type='java.lang.String']]" - [Register ("setSomeString", "(Ljava/lang/String;)V", "")] - set { - if (id_setSomeString_Ljava_lang_String_ == IntPtr.Zero) - id_setSomeString_Ljava_lang_String_ = JNIEnv.GetStaticMethodID (class_ref, "setSomeString", "(Ljava/lang/String;)V"); - IntPtr native_value = JNIEnv.NewString ((string)value); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_value); - JNIEnv.CallStaticVoidMethod (class_ref, id_setSomeString_Ljava_lang_String_, __args); - } finally { - JNIEnv.DeleteLocalRef (native_value); - } - } - } - - static IntPtr id_getSomeObject; - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/method[@name='getSomeObject' and count(parameter)=0]" - [Register ("getSomeObject", "()Ljava/lang/Object;", "")] - public static unsafe global::Java.Lang.Object GetSomeObject () - { - if (id_getSomeObject == IntPtr.Zero) - id_getSomeObject = JNIEnv.GetStaticMethodID (class_ref, "getSomeObject", "()Ljava/lang/Object;"); - try { - return global::Java.Lang.Object.GetObject (JNIEnv.CallStaticObjectMethod (class_ref, id_getSomeObject), JniHandleOwnership.TransferLocalRef); - } finally { - } - } - - static IntPtr id_setSomeObject_Ljava_lang_Object_; - // Metadata.xml XPath method reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/method[@name='setSomeObject' and count(parameter)=1 and parameter[1][@type='java.lang.Object']]" - [Register ("setSomeObject", "(Ljava/lang/Object;)V", "")] - public static unsafe void SetSomeObject (global::Java.Lang.Object newvalue) - { - if (id_setSomeObject_Ljava_lang_Object_ == IntPtr.Zero) - id_setSomeObject_Ljava_lang_Object_ = JNIEnv.GetStaticMethodID (class_ref, "setSomeObject", "(Ljava/lang/Object;)V"); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (newvalue); - JNIEnv.CallStaticVoidMethod (class_ref, id_setSomeObject_Ljava_lang_Object_, __args); - } finally { - } - } - - } -} diff --git a/tests/generator-Tests/expected/Streams/Java.IO.FilterOutputStream.cs b/tests/generator-Tests/expected/Streams/Java.IO.FilterOutputStream.cs deleted file mode 100644 index 33dda8be4..000000000 --- a/tests/generator-Tests/expected/Streams/Java.IO.FilterOutputStream.cs +++ /dev/null @@ -1,106 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Java.IO { - - // Metadata.xml XPath class reference: path="/api/package[@name='java.io']/class[@name='FilterOutputStream']" - [global::Android.Runtime.Register ("java/io/FilterOutputStream", DoNotGenerateAcw=true)] - public partial class FilterOutputStream : global::Java.IO.OutputStream { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("java/io/FilterOutputStream", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (FilterOutputStream); } - } - - protected FilterOutputStream (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static IntPtr id_ctor_Ljava_io_OutputStream_; - // Metadata.xml XPath constructor reference: path="/api/package[@name='java.io']/class[@name='FilterOutputStream']/constructor[@name='FilterOutputStream' and count(parameter)=1 and parameter[1][@type='java.io.OutputStream']]" - [Register (".ctor", "(Ljava/io/OutputStream;)V", "")] - public unsafe FilterOutputStream (global::System.IO.Stream @out) - : base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer) - { - if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero) - return; - - IntPtr native__out = global::Android.Runtime.OutputStreamAdapter.ToLocalJniHandle (@out); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native__out); - if (((object) this).GetType () != typeof (FilterOutputStream)) { - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (((object) this).GetType (), "(Ljava/io/OutputStream;)V", __args), - JniHandleOwnership.TransferLocalRef); - global::Android.Runtime.JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, "(Ljava/io/OutputStream;)V", __args); - return; - } - - if (id_ctor_Ljava_io_OutputStream_ == IntPtr.Zero) - id_ctor_Ljava_io_OutputStream_ = JNIEnv.GetMethodID (class_ref, "", "(Ljava/io/OutputStream;)V"); - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (class_ref, id_ctor_Ljava_io_OutputStream_, __args), - JniHandleOwnership.TransferLocalRef); - JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, class_ref, id_ctor_Ljava_io_OutputStream_, __args); - } finally { - JNIEnv.DeleteLocalRef (native__out); - } - } - - static Delegate cb_write_I; -#pragma warning disable 0169 - static Delegate GetWrite_IHandler () - { - if (cb_write_I == null) - cb_write_I = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPI_V) n_Write_I); - return cb_write_I; - } - - static void n_Write_I (IntPtr jnienv, IntPtr native__this, int oneByte) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.Write (oneByte); - } -#pragma warning restore 0169 - - static IntPtr id_write_I; - // Metadata.xml XPath method reference: path="/api/package[@name='java.io']/class[@name='FilterOutputStream']/method[@name='write' and count(parameter)=1 and parameter[1][@type='int']]" - [Register ("write", "(I)V", "GetWrite_IHandler")] - public override unsafe void Write (int oneByte) - { - if (id_write_I == IntPtr.Zero) - id_write_I = JNIEnv.GetMethodID (class_ref, "write", "(I)V"); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (oneByte); - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_write_I, __args); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "write", "(I)V"), __args); - } finally { - } - } - - } -} diff --git a/tests/generator-Tests/expected/Streams/Java.IO.IOException.cs b/tests/generator-Tests/expected/Streams/Java.IO.IOException.cs deleted file mode 100644 index 9584b3969..000000000 --- a/tests/generator-Tests/expected/Streams/Java.IO.IOException.cs +++ /dev/null @@ -1,84 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Java.IO { - - // Metadata.xml XPath class reference: path="/api/package[@name='java.io']/class[@name='IOException']" - [global::Android.Runtime.Register ("java/io/IOException", DoNotGenerateAcw=true)] - public abstract partial class IOException : global::Java.Lang.Throwable { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("java/io/IOException", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (IOException); } - } - - protected IOException (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static Delegate cb_printStackTrace; -#pragma warning disable 0169 - static Delegate GetPrintStackTraceHandler () - { - if (cb_printStackTrace == null) - cb_printStackTrace = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_V) n_PrintStackTrace); - return cb_printStackTrace; - } - - static void n_PrintStackTrace (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.PrintStackTrace (); - } -#pragma warning restore 0169 - - static IntPtr id_printStackTrace; - // Metadata.xml XPath method reference: path="/api/package[@name='java.io']/class[@name='IOException']/method[@name='printStackTrace' and count(parameter)=0]" - [Register ("printStackTrace", "()V", "GetPrintStackTraceHandler")] - public virtual unsafe void PrintStackTrace () - { - if (id_printStackTrace == IntPtr.Zero) - id_printStackTrace = JNIEnv.GetMethodID (class_ref, "printStackTrace", "()V"); - try { - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Throwable) this).Handle, id_printStackTrace); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Throwable) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "printStackTrace", "()V")); - } finally { - } - } - - } - - [global::Android.Runtime.Register ("java/io/IOException", DoNotGenerateAcw=true)] - internal partial class IOExceptionInvoker : IOException { - - public IOExceptionInvoker (IntPtr handle, JniHandleOwnership transfer) : base (handle, transfer) {} - - protected override global::System.Type ThresholdType { - get { return typeof (IOExceptionInvoker); } - } - - } - -} diff --git a/tests/generator-Tests/expected/Streams/Java.IO.InputStream.cs b/tests/generator-Tests/expected/Streams/Java.IO.InputStream.cs deleted file mode 100644 index 1bb1cd744..000000000 --- a/tests/generator-Tests/expected/Streams/Java.IO.InputStream.cs +++ /dev/null @@ -1,408 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Java.IO { - - // Metadata.xml XPath class reference: path="/api/package[@name='java.io']/class[@name='InputStream']" - [global::Android.Runtime.Register ("java/io/InputStream", DoNotGenerateAcw=true)] - public abstract partial class InputStream : global::Java.Lang.Object { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("java/io/InputStream", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (InputStream); } - } - - protected InputStream (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static IntPtr id_ctor; - // Metadata.xml XPath constructor reference: path="/api/package[@name='java.io']/class[@name='InputStream']/constructor[@name='InputStream' and count(parameter)=0]" - [Register (".ctor", "()V", "")] - public unsafe InputStream () - : base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer) - { - if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero) - return; - - try { - if (((object) this).GetType () != typeof (InputStream)) { - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (((object) this).GetType (), "()V"), - JniHandleOwnership.TransferLocalRef); - global::Android.Runtime.JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, "()V"); - return; - } - - if (id_ctor == IntPtr.Zero) - id_ctor = JNIEnv.GetMethodID (class_ref, "", "()V"); - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (class_ref, id_ctor), - JniHandleOwnership.TransferLocalRef); - JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, class_ref, id_ctor); - } finally { - } - } - - static Delegate cb_available; -#pragma warning disable 0169 - static Delegate GetAvailableHandler () - { - if (cb_available == null) - cb_available = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_I) n_Available); - return cb_available; - } - - static int n_Available (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return __this.Available (); - } -#pragma warning restore 0169 - - static IntPtr id_available; - // Metadata.xml XPath method reference: path="/api/package[@name='java.io']/class[@name='InputStream']/method[@name='available' and count(parameter)=0]" - [Register ("available", "()I", "GetAvailableHandler")] - public virtual unsafe int Available () - { - if (id_available == IntPtr.Zero) - id_available = JNIEnv.GetMethodID (class_ref, "available", "()I"); - try { - - if (((object) this).GetType () == ThresholdType) - return JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_available); - else - return JNIEnv.CallNonvirtualIntMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "available", "()I")); - } finally { - } - } - - static Delegate cb_close; -#pragma warning disable 0169 - static Delegate GetCloseHandler () - { - if (cb_close == null) - cb_close = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_V) n_Close); - return cb_close; - } - - static void n_Close (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.Close (); - } -#pragma warning restore 0169 - - static IntPtr id_close; - // Metadata.xml XPath method reference: path="/api/package[@name='java.io']/class[@name='InputStream']/method[@name='close' and count(parameter)=0]" - [Register ("close", "()V", "GetCloseHandler")] - public virtual unsafe void Close () - { - if (id_close == IntPtr.Zero) - id_close = JNIEnv.GetMethodID (class_ref, "close", "()V"); - try { - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_close); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "close", "()V")); - } finally { - } - } - - static Delegate cb_mark_I; -#pragma warning disable 0169 - static Delegate GetMark_IHandler () - { - if (cb_mark_I == null) - cb_mark_I = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPI_V) n_Mark_I); - return cb_mark_I; - } - - static void n_Mark_I (IntPtr jnienv, IntPtr native__this, int readlimit) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.Mark (readlimit); - } -#pragma warning restore 0169 - - static IntPtr id_mark_I; - // Metadata.xml XPath method reference: path="/api/package[@name='java.io']/class[@name='InputStream']/method[@name='mark' and count(parameter)=1 and parameter[1][@type='int']]" - [Register ("mark", "(I)V", "GetMark_IHandler")] - public virtual unsafe void Mark (int readlimit) - { - if (id_mark_I == IntPtr.Zero) - id_mark_I = JNIEnv.GetMethodID (class_ref, "mark", "(I)V"); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (readlimit); - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_mark_I, __args); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "mark", "(I)V"), __args); - } finally { - } - } - - static Delegate cb_markSupported; -#pragma warning disable 0169 - static Delegate GetMarkSupportedHandler () - { - if (cb_markSupported == null) - cb_markSupported = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_Z) n_MarkSupported); - return cb_markSupported; - } - - static bool n_MarkSupported (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return __this.MarkSupported (); - } -#pragma warning restore 0169 - - static IntPtr id_markSupported; - // Metadata.xml XPath method reference: path="/api/package[@name='java.io']/class[@name='InputStream']/method[@name='markSupported' and count(parameter)=0]" - [Register ("markSupported", "()Z", "GetMarkSupportedHandler")] - public virtual unsafe bool MarkSupported () - { - if (id_markSupported == IntPtr.Zero) - id_markSupported = JNIEnv.GetMethodID (class_ref, "markSupported", "()Z"); - try { - - if (((object) this).GetType () == ThresholdType) - return JNIEnv.CallBooleanMethod (((global::Java.Lang.Object) this).Handle, id_markSupported); - else - return JNIEnv.CallNonvirtualBooleanMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "markSupported", "()Z")); - } finally { - } - } - - static Delegate cb_read; -#pragma warning disable 0169 - static Delegate GetReadHandler () - { - if (cb_read == null) - cb_read = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_I) n_Read); - return cb_read; - } - - static int n_Read (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return __this.Read (); - } -#pragma warning restore 0169 - - // Metadata.xml XPath method reference: path="/api/package[@name='java.io']/class[@name='InputStream']/method[@name='read' and count(parameter)=0]" - [Register ("read", "()I", "GetReadHandler")] - public abstract int Read (); - - static Delegate cb_read_arrayB; -#pragma warning disable 0169 - static Delegate GetRead_arrayBHandler () - { - if (cb_read_arrayB == null) - cb_read_arrayB = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_I) n_Read_arrayB); - return cb_read_arrayB; - } - - static int n_Read_arrayB (IntPtr jnienv, IntPtr native__this, IntPtr native_buffer) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var buffer = (byte[]) JNIEnv.GetArray (native_buffer, JniHandleOwnership.DoNotTransfer, typeof (byte)); - int __ret = __this.Read (buffer); - if (buffer != null) - JNIEnv.CopyArray (buffer, native_buffer); - return __ret; - } -#pragma warning restore 0169 - - static IntPtr id_read_arrayB; - // Metadata.xml XPath method reference: path="/api/package[@name='java.io']/class[@name='InputStream']/method[@name='read' and count(parameter)=1 and parameter[1][@type='byte[]']]" - [Register ("read", "([B)I", "GetRead_arrayBHandler")] - public virtual unsafe int Read (byte[] buffer) - { - if (id_read_arrayB == IntPtr.Zero) - id_read_arrayB = JNIEnv.GetMethodID (class_ref, "read", "([B)I"); - IntPtr native_buffer = JNIEnv.NewArray (buffer); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_buffer); - - int __ret; - if (((object) this).GetType () == ThresholdType) - __ret = JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_read_arrayB, __args); - else - __ret = JNIEnv.CallNonvirtualIntMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "read", "([B)I"), __args); - return __ret; - } finally { - if (buffer != null) { - JNIEnv.CopyArray (native_buffer, buffer); - JNIEnv.DeleteLocalRef (native_buffer); - } - } - } - - static Delegate cb_read_arrayBII; -#pragma warning disable 0169 - static Delegate GetRead_arrayBIIHandler () - { - if (cb_read_arrayBII == null) - cb_read_arrayBII = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPLII_I) n_Read_arrayBII); - return cb_read_arrayBII; - } - - static int n_Read_arrayBII (IntPtr jnienv, IntPtr native__this, IntPtr native_buffer, int byteOffset, int byteCount) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var buffer = (byte[]) JNIEnv.GetArray (native_buffer, JniHandleOwnership.DoNotTransfer, typeof (byte)); - int __ret = __this.Read (buffer, byteOffset, byteCount); - if (buffer != null) - JNIEnv.CopyArray (buffer, native_buffer); - return __ret; - } -#pragma warning restore 0169 - - static IntPtr id_read_arrayBII; - // Metadata.xml XPath method reference: path="/api/package[@name='java.io']/class[@name='InputStream']/method[@name='read' and count(parameter)=3 and parameter[1][@type='byte[]'] and parameter[2][@type='int'] and parameter[3][@type='int']]" - [Register ("read", "([BII)I", "GetRead_arrayBIIHandler")] - public virtual unsafe int Read (byte[] buffer, int byteOffset, int byteCount) - { - if (id_read_arrayBII == IntPtr.Zero) - id_read_arrayBII = JNIEnv.GetMethodID (class_ref, "read", "([BII)I"); - IntPtr native_buffer = JNIEnv.NewArray (buffer); - try { - JValue* __args = stackalloc JValue [3]; - __args [0] = new JValue (native_buffer); - __args [1] = new JValue (byteOffset); - __args [2] = new JValue (byteCount); - - int __ret; - if (((object) this).GetType () == ThresholdType) - __ret = JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_read_arrayBII, __args); - else - __ret = JNIEnv.CallNonvirtualIntMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "read", "([BII)I"), __args); - return __ret; - } finally { - if (buffer != null) { - JNIEnv.CopyArray (native_buffer, buffer); - JNIEnv.DeleteLocalRef (native_buffer); - } - } - } - - static Delegate cb_reset; -#pragma warning disable 0169 - static Delegate GetResetHandler () - { - if (cb_reset == null) - cb_reset = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_V) n_Reset); - return cb_reset; - } - - static void n_Reset (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.Reset (); - } -#pragma warning restore 0169 - - static IntPtr id_reset; - // Metadata.xml XPath method reference: path="/api/package[@name='java.io']/class[@name='InputStream']/method[@name='reset' and count(parameter)=0]" - [Register ("reset", "()V", "GetResetHandler")] - public virtual unsafe void Reset () - { - if (id_reset == IntPtr.Zero) - id_reset = JNIEnv.GetMethodID (class_ref, "reset", "()V"); - try { - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_reset); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "reset", "()V")); - } finally { - } - } - - static Delegate cb_skip_J; -#pragma warning disable 0169 - static Delegate GetSkip_JHandler () - { - if (cb_skip_J == null) - cb_skip_J = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPJ_J) n_Skip_J); - return cb_skip_J; - } - - static long n_Skip_J (IntPtr jnienv, IntPtr native__this, long byteCount) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return __this.Skip (byteCount); - } -#pragma warning restore 0169 - - static IntPtr id_skip_J; - // Metadata.xml XPath method reference: path="/api/package[@name='java.io']/class[@name='InputStream']/method[@name='skip' and count(parameter)=1 and parameter[1][@type='long']]" - [Register ("skip", "(J)J", "GetSkip_JHandler")] - public virtual unsafe long Skip (long byteCount) - { - if (id_skip_J == IntPtr.Zero) - id_skip_J = JNIEnv.GetMethodID (class_ref, "skip", "(J)J"); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (byteCount); - - if (((object) this).GetType () == ThresholdType) - return JNIEnv.CallLongMethod (((global::Java.Lang.Object) this).Handle, id_skip_J, __args); - else - return JNIEnv.CallNonvirtualLongMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "skip", "(J)J"), __args); - } finally { - } - } - - } - - [global::Android.Runtime.Register ("java/io/InputStream", DoNotGenerateAcw=true)] - internal partial class InputStreamInvoker : InputStream { - - public InputStreamInvoker (IntPtr handle, JniHandleOwnership transfer) : base (handle, transfer) {} - - protected override global::System.Type ThresholdType { - get { return typeof (InputStreamInvoker); } - } - - static IntPtr id_read; - // Metadata.xml XPath method reference: path="/api/package[@name='java.io']/class[@name='InputStream']/method[@name='read' and count(parameter)=0]" - [Register ("read", "()I", "GetReadHandler")] - public override unsafe int Read () - { - if (id_read == IntPtr.Zero) - id_read = JNIEnv.GetMethodID (class_ref, "read", "()I"); - try { - return JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_read); - } finally { - } - } - - } - -} diff --git a/tests/generator-Tests/expected/Streams/Java.IO.OutputStream.cs b/tests/generator-Tests/expected/Streams/Java.IO.OutputStream.cs deleted file mode 100644 index 84e376838..000000000 --- a/tests/generator-Tests/expected/Streams/Java.IO.OutputStream.cs +++ /dev/null @@ -1,268 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Java.IO { - - // Metadata.xml XPath class reference: path="/api/package[@name='java.io']/class[@name='OutputStream']" - [global::Android.Runtime.Register ("java/io/OutputStream", DoNotGenerateAcw=true)] - public abstract partial class OutputStream : global::Java.Lang.Object { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("java/io/OutputStream", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (OutputStream); } - } - - protected OutputStream (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static IntPtr id_ctor; - // Metadata.xml XPath constructor reference: path="/api/package[@name='java.io']/class[@name='OutputStream']/constructor[@name='OutputStream' and count(parameter)=0]" - [Register (".ctor", "()V", "")] - public unsafe OutputStream () - : base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer) - { - if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero) - return; - - try { - if (((object) this).GetType () != typeof (OutputStream)) { - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (((object) this).GetType (), "()V"), - JniHandleOwnership.TransferLocalRef); - global::Android.Runtime.JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, "()V"); - return; - } - - if (id_ctor == IntPtr.Zero) - id_ctor = JNIEnv.GetMethodID (class_ref, "", "()V"); - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (class_ref, id_ctor), - JniHandleOwnership.TransferLocalRef); - JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, class_ref, id_ctor); - } finally { - } - } - - static Delegate cb_close; -#pragma warning disable 0169 - static Delegate GetCloseHandler () - { - if (cb_close == null) - cb_close = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_V) n_Close); - return cb_close; - } - - static void n_Close (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.Close (); - } -#pragma warning restore 0169 - - static IntPtr id_close; - // Metadata.xml XPath method reference: path="/api/package[@name='java.io']/class[@name='OutputStream']/method[@name='close' and count(parameter)=0]" - [Register ("close", "()V", "GetCloseHandler")] - public virtual unsafe void Close () - { - if (id_close == IntPtr.Zero) - id_close = JNIEnv.GetMethodID (class_ref, "close", "()V"); - try { - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_close); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "close", "()V")); - } finally { - } - } - - static Delegate cb_flush; -#pragma warning disable 0169 - static Delegate GetFlushHandler () - { - if (cb_flush == null) - cb_flush = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_V) n_Flush); - return cb_flush; - } - - static void n_Flush (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.Flush (); - } -#pragma warning restore 0169 - - static IntPtr id_flush; - // Metadata.xml XPath method reference: path="/api/package[@name='java.io']/class[@name='OutputStream']/method[@name='flush' and count(parameter)=0]" - [Register ("flush", "()V", "GetFlushHandler")] - public virtual unsafe void Flush () - { - if (id_flush == IntPtr.Zero) - id_flush = JNIEnv.GetMethodID (class_ref, "flush", "()V"); - try { - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_flush); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "flush", "()V")); - } finally { - } - } - - static Delegate cb_write_arrayB; -#pragma warning disable 0169 - static Delegate GetWrite_arrayBHandler () - { - if (cb_write_arrayB == null) - cb_write_arrayB = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_V) n_Write_arrayB); - return cb_write_arrayB; - } - - static void n_Write_arrayB (IntPtr jnienv, IntPtr native__this, IntPtr native_buffer) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var buffer = (byte[]) JNIEnv.GetArray (native_buffer, JniHandleOwnership.DoNotTransfer, typeof (byte)); - __this.Write (buffer); - if (buffer != null) - JNIEnv.CopyArray (buffer, native_buffer); - } -#pragma warning restore 0169 - - static IntPtr id_write_arrayB; - // Metadata.xml XPath method reference: path="/api/package[@name='java.io']/class[@name='OutputStream']/method[@name='write' and count(parameter)=1 and parameter[1][@type='byte[]']]" - [Register ("write", "([B)V", "GetWrite_arrayBHandler")] - public virtual unsafe void Write (byte[] buffer) - { - if (id_write_arrayB == IntPtr.Zero) - id_write_arrayB = JNIEnv.GetMethodID (class_ref, "write", "([B)V"); - IntPtr native_buffer = JNIEnv.NewArray (buffer); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_buffer); - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_write_arrayB, __args); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "write", "([B)V"), __args); - } finally { - if (buffer != null) { - JNIEnv.CopyArray (native_buffer, buffer); - JNIEnv.DeleteLocalRef (native_buffer); - } - } - } - - static Delegate cb_write_arrayBII; -#pragma warning disable 0169 - static Delegate GetWrite_arrayBIIHandler () - { - if (cb_write_arrayBII == null) - cb_write_arrayBII = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPLII_V) n_Write_arrayBII); - return cb_write_arrayBII; - } - - static void n_Write_arrayBII (IntPtr jnienv, IntPtr native__this, IntPtr native_buffer, int offset, int count) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var buffer = (byte[]) JNIEnv.GetArray (native_buffer, JniHandleOwnership.DoNotTransfer, typeof (byte)); - __this.Write (buffer, offset, count); - if (buffer != null) - JNIEnv.CopyArray (buffer, native_buffer); - } -#pragma warning restore 0169 - - static IntPtr id_write_arrayBII; - // Metadata.xml XPath method reference: path="/api/package[@name='java.io']/class[@name='OutputStream']/method[@name='write' and count(parameter)=3 and parameter[1][@type='byte[]'] and parameter[2][@type='int'] and parameter[3][@type='int']]" - [Register ("write", "([BII)V", "GetWrite_arrayBIIHandler")] - public virtual unsafe void Write (byte[] buffer, int offset, int count) - { - if (id_write_arrayBII == IntPtr.Zero) - id_write_arrayBII = JNIEnv.GetMethodID (class_ref, "write", "([BII)V"); - IntPtr native_buffer = JNIEnv.NewArray (buffer); - try { - JValue* __args = stackalloc JValue [3]; - __args [0] = new JValue (native_buffer); - __args [1] = new JValue (offset); - __args [2] = new JValue (count); - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_write_arrayBII, __args); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "write", "([BII)V"), __args); - } finally { - if (buffer != null) { - JNIEnv.CopyArray (native_buffer, buffer); - JNIEnv.DeleteLocalRef (native_buffer); - } - } - } - - static Delegate cb_write_I; -#pragma warning disable 0169 - static Delegate GetWrite_IHandler () - { - if (cb_write_I == null) - cb_write_I = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPI_V) n_Write_I); - return cb_write_I; - } - - static void n_Write_I (IntPtr jnienv, IntPtr native__this, int oneByte) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.Write (oneByte); - } -#pragma warning restore 0169 - - // Metadata.xml XPath method reference: path="/api/package[@name='java.io']/class[@name='OutputStream']/method[@name='write' and count(parameter)=1 and parameter[1][@type='int']]" - [Register ("write", "(I)V", "GetWrite_IHandler")] - public abstract void Write (int oneByte); - - } - - [global::Android.Runtime.Register ("java/io/OutputStream", DoNotGenerateAcw=true)] - internal partial class OutputStreamInvoker : OutputStream { - - public OutputStreamInvoker (IntPtr handle, JniHandleOwnership transfer) : base (handle, transfer) {} - - protected override global::System.Type ThresholdType { - get { return typeof (OutputStreamInvoker); } - } - - static IntPtr id_write_I; - // Metadata.xml XPath method reference: path="/api/package[@name='java.io']/class[@name='OutputStream']/method[@name='write' and count(parameter)=1 and parameter[1][@type='int']]" - [Register ("write", "(I)V", "GetWrite_IHandler")] - public override unsafe void Write (int oneByte) - { - if (id_write_I == IntPtr.Zero) - id_write_I = JNIEnv.GetMethodID (class_ref, "write", "(I)V"); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (oneByte); - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_write_I, __args); - } finally { - } - } - - } - -} diff --git a/tests/generator-Tests/expected/Streams/Java.Lang.Throwable.cs b/tests/generator-Tests/expected/Streams/Java.Lang.Throwable.cs deleted file mode 100644 index f057baf0a..000000000 --- a/tests/generator-Tests/expected/Streams/Java.Lang.Throwable.cs +++ /dev/null @@ -1,63 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Java.Lang { - - // Metadata.xml XPath class reference: path="/api/package[@name='java.lang']/class[@name='Throwable']" - [global::Android.Runtime.Register ("java/lang/Throwable", DoNotGenerateAcw=true)] - public partial class Throwable { - - internal static IntPtr java_class_handle; - internal static IntPtr class_ref { - get { - return JNIEnv.FindClass ("java/lang/Throwable", ref java_class_handle); - } - } - - static Delegate cb_getMessage; -#pragma warning disable 0169 - static Delegate GetGetMessageHandler () - { - if (cb_getMessage == null) - cb_getMessage = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_L) n_GetMessage); - return cb_getMessage; - } - - static IntPtr n_GetMessage (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return JNIEnv.NewString (__this.Message); - } -#pragma warning restore 0169 - - static IntPtr id_getMessage; - public new virtual unsafe string Message { - // Metadata.xml XPath method reference: path="/api/package[@name='java.lang']/class[@name='Throwable']/method[@name='getMessage' and count(parameter)=0]" - [Register ("getMessage", "()Ljava/lang/String;", "GetGetMessageHandler")] - get { - if (id_getMessage == IntPtr.Zero) - id_getMessage = JNIEnv.GetMethodID (class_ref, "getMessage", "()Ljava/lang/String;"); - try { - - if (((object) this).GetType () == ThresholdType) - return JNIEnv.GetString (JNIEnv.CallObjectMethod (((global::Java.Lang.Throwable) this).Handle, id_getMessage), JniHandleOwnership.TransferLocalRef); - else - return JNIEnv.GetString (JNIEnv.CallNonvirtualObjectMethod (((global::Java.Lang.Throwable) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "getMessage", "()Ljava/lang/String;")), JniHandleOwnership.TransferLocalRef); - } finally { - } - } - } - - } -} diff --git a/tests/generator-Tests/expected/Streams/Mono.Android.projitems b/tests/generator-Tests/expected/Streams/Mono.Android.projitems deleted file mode 100644 index 3d19ddac3..000000000 --- a/tests/generator-Tests/expected/Streams/Mono.Android.projitems +++ /dev/null @@ -1,19 +0,0 @@ - - - - $(DefineConstants);ANDROID_1;ANDROID_2;ANDROID_3;ANDROID_4 - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/generator-Tests/expected/TestInterface/ClassWithoutNamespace.cs b/tests/generator-Tests/expected/TestInterface/ClassWithoutNamespace.cs deleted file mode 100644 index 3c095cabf..000000000 --- a/tests/generator-Tests/expected/TestInterface/ClassWithoutNamespace.cs +++ /dev/null @@ -1,109 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -// Metadata.xml XPath class reference: path="/api/package[@name='']/class[@name='ClassWithoutNamespace']" -[global::Android.Runtime.Register ("ClassWithoutNamespace", DoNotGenerateAcw=true)] -public abstract partial class ClassWithoutNamespace : global::Java.Lang.Object, IInterfaceWithoutNamespace { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("ClassWithoutNamespace", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (ClassWithoutNamespace); } - } - - protected ClassWithoutNamespace (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static IntPtr id_ctor; - // Metadata.xml XPath constructor reference: path="/api/package[@name='']/class[@name='ClassWithoutNamespace']/constructor[@name='ClassWithoutNamespace' and count(parameter)=0]" - [Register (".ctor", "()V", "")] - public unsafe ClassWithoutNamespace () - : base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer) - { - if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero) - return; - - try { - if (((object) this).GetType () != typeof (ClassWithoutNamespace)) { - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (((object) this).GetType (), "()V"), - JniHandleOwnership.TransferLocalRef); - global::Android.Runtime.JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, "()V"); - return; - } - - if (id_ctor == IntPtr.Zero) - id_ctor = JNIEnv.GetMethodID (class_ref, "", "()V"); - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (class_ref, id_ctor), - JniHandleOwnership.TransferLocalRef); - JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, class_ref, id_ctor); - } finally { - } - } - - static Delegate cb_Foo; -#pragma warning disable 0169 - static Delegate GetFooHandler () - { - if (cb_Foo == null) - cb_Foo = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_V) n_Foo); - return cb_Foo; - } - - static void n_Foo (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.Foo (); - } -#pragma warning restore 0169 - - // Metadata.xml XPath method reference: path="/api/package[@name='']/interface[@name='InterfaceWithoutNamespace']/method[@name='Foo' and count(parameter)=0]" - [Register ("Foo", "()V", "GetFooHandler")] - public abstract void Foo (); - -} - -[global::Android.Runtime.Register ("ClassWithoutNamespace", DoNotGenerateAcw=true)] -internal partial class ClassWithoutNamespaceInvoker : ClassWithoutNamespace { - - public ClassWithoutNamespaceInvoker (IntPtr handle, JniHandleOwnership transfer) : base (handle, transfer) {} - - protected override global::System.Type ThresholdType { - get { return typeof (ClassWithoutNamespaceInvoker); } - } - - static IntPtr id_Foo; - // Metadata.xml XPath method reference: path="/api/package[@name='']/interface[@name='InterfaceWithoutNamespace']/method[@name='Foo' and count(parameter)=0]" - [Register ("Foo", "()V", "GetFooHandler")] - public override unsafe void Foo () - { - if (id_Foo == IntPtr.Zero) - id_Foo = JNIEnv.GetMethodID (class_ref, "Foo", "()V"); - try { - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_Foo); - } finally { - } - } - -} - diff --git a/tests/generator-Tests/expected/TestInterface/IInterfaceWithoutNamespace.cs b/tests/generator-Tests/expected/TestInterface/IInterfaceWithoutNamespace.cs deleted file mode 100644 index 612fe57d7..000000000 --- a/tests/generator-Tests/expected/TestInterface/IInterfaceWithoutNamespace.cs +++ /dev/null @@ -1,83 +0,0 @@ -using System; -using System.Collections.Generic; -using Android.Runtime; - -// Metadata.xml XPath interface reference: path="/api/package[@name='']/interface[@name='InterfaceWithoutNamespace']" -[Register ("InterfaceWithoutNamespace", "", "IInterfaceWithoutNamespaceInvoker")] -public partial interface IInterfaceWithoutNamespace : IJavaObject { - - // Metadata.xml XPath method reference: path="/api/package[@name='']/interface[@name='InterfaceWithoutNamespace']/method[@name='Foo' and count(parameter)=0]" - [Register ("Foo", "()V", "GetFooHandler:IInterfaceWithoutNamespaceInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")] - void Foo (); - -} - -[global::Android.Runtime.Register ("InterfaceWithoutNamespace", DoNotGenerateAcw=true)] -internal partial class IInterfaceWithoutNamespaceInvoker : global::Java.Lang.Object, IInterfaceWithoutNamespace { - - static IntPtr java_class_ref = JNIEnv.FindClass ("InterfaceWithoutNamespace"); - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (IInterfaceWithoutNamespaceInvoker); } - } - - new IntPtr class_ref; - - public static IInterfaceWithoutNamespace GetObject (IntPtr handle, JniHandleOwnership transfer) - { - return global::Java.Lang.Object.GetObject (handle, transfer); - } - - static IntPtr Validate (IntPtr handle) - { - if (!JNIEnv.IsInstanceOf (handle, java_class_ref)) - throw new InvalidCastException (string.Format ("Unable to convert instance of type '{0}' to type '{1}'.", - JNIEnv.GetClassNameFromInstance (handle), "InterfaceWithoutNamespace")); - return handle; - } - - protected override void Dispose (bool disposing) - { - if (this.class_ref != IntPtr.Zero) - JNIEnv.DeleteGlobalRef (this.class_ref); - this.class_ref = IntPtr.Zero; - base.Dispose (disposing); - } - - public IInterfaceWithoutNamespaceInvoker (IntPtr handle, JniHandleOwnership transfer) : base (Validate (handle), transfer) - { - IntPtr local_ref = JNIEnv.GetObjectClass (((global::Java.Lang.Object) this).Handle); - this.class_ref = JNIEnv.NewGlobalRef (local_ref); - JNIEnv.DeleteLocalRef (local_ref); - } - - static Delegate cb_Foo; -#pragma warning disable 0169 - static Delegate GetFooHandler () - { - if (cb_Foo == null) - cb_Foo = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_V) n_Foo); - return cb_Foo; - } - - static void n_Foo (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - __this.Foo (); - } -#pragma warning restore 0169 - - IntPtr id_Foo; - public unsafe void Foo () - { - if (id_Foo == IntPtr.Zero) - id_Foo = JNIEnv.GetMethodID (class_ref, "Foo", "()V"); - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_Foo); - } - -} - diff --git a/tests/generator-Tests/expected/TestInterface/Mono.Android.projitems b/tests/generator-Tests/expected/TestInterface/Mono.Android.projitems deleted file mode 100644 index 5a3e90231..000000000 --- a/tests/generator-Tests/expected/TestInterface/Mono.Android.projitems +++ /dev/null @@ -1,25 +0,0 @@ - - - - $(DefineConstants);ANDROID_1;ANDROID_2;ANDROID_3;ANDROID_4 - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/generator-Tests/expected/TestInterface/Test.ME.GenericImplementation.cs b/tests/generator-Tests/expected/TestInterface/Test.ME.GenericImplementation.cs deleted file mode 100644 index dcd3d996e..000000000 --- a/tests/generator-Tests/expected/TestInterface/Test.ME.GenericImplementation.cs +++ /dev/null @@ -1,116 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Test.ME { - - // Metadata.xml XPath class reference: path="/api/package[@name='test.me']/class[@name='GenericImplementation']" - [global::Android.Runtime.Register ("test/me/GenericImplementation", DoNotGenerateAcw=true)] - public partial class GenericImplementation : global::Java.Lang.Object, global::Test.ME.IGenericInterface { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("test/me/GenericImplementation", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (GenericImplementation); } - } - - protected GenericImplementation (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static IntPtr id_ctor; - // Metadata.xml XPath constructor reference: path="/api/package[@name='test.me']/class[@name='GenericImplementation']/constructor[@name='GenericImplementation' and count(parameter)=0]" - [Register (".ctor", "()V", "")] - public unsafe GenericImplementation () - : base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer) - { - if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero) - return; - - try { - if (((object) this).GetType () != typeof (GenericImplementation)) { - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (((object) this).GetType (), "()V"), - JniHandleOwnership.TransferLocalRef); - global::Android.Runtime.JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, "()V"); - return; - } - - if (id_ctor == IntPtr.Zero) - id_ctor = JNIEnv.GetMethodID (class_ref, "", "()V"); - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (class_ref, id_ctor), - JniHandleOwnership.TransferLocalRef); - JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, class_ref, id_ctor); - } finally { - } - } - - static Delegate cb_SetObject_arrayB; -#pragma warning disable 0169 - static Delegate GetSetObject_arrayBHandler () - { - if (cb_SetObject_arrayB == null) - cb_SetObject_arrayB = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_V) n_SetObject_arrayB); - return cb_SetObject_arrayB; - } - - static void n_SetObject_arrayB (IntPtr jnienv, IntPtr native__this, IntPtr native_value) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var value = (byte[]) JNIEnv.GetArray (native_value, JniHandleOwnership.DoNotTransfer, typeof (byte)); - __this.SetObject (value); - if (value != null) - JNIEnv.CopyArray (value, native_value); - } -#pragma warning restore 0169 - - static IntPtr id_SetObject_arrayB; - // Metadata.xml XPath method reference: path="/api/package[@name='test.me']/class[@name='GenericImplementation']/method[@name='SetObject' and count(parameter)=1 and parameter[1][@type='byte[]']]" - [Register ("SetObject", "([B)V", "GetSetObject_arrayBHandler")] - public virtual unsafe void SetObject (byte[] value) - { - if (id_SetObject_arrayB == IntPtr.Zero) - id_SetObject_arrayB = JNIEnv.GetMethodID (class_ref, "SetObject", "([B)V"); - IntPtr native_value = JNIEnv.NewArray (value); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_value); - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_SetObject_arrayB, __args); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "SetObject", "([B)V"), __args); - } finally { - if (value != null) { - JNIEnv.CopyArray (native_value, value); - JNIEnv.DeleteLocalRef (native_value); - } - } - } - - // This method is explicitly implemented as a member of an instantiated Test.ME.IGenericInterface - void global::Test.ME.IGenericInterface.SetObject (global::Java.Lang.Object value) - { - SetObject (value.ToArray ()); - } - - } -} diff --git a/tests/generator-Tests/expected/TestInterface/Test.ME.GenericObjectPropertyImplementation.cs b/tests/generator-Tests/expected/TestInterface/Test.ME.GenericObjectPropertyImplementation.cs deleted file mode 100644 index 7573c8b90..000000000 --- a/tests/generator-Tests/expected/TestInterface/Test.ME.GenericObjectPropertyImplementation.cs +++ /dev/null @@ -1,135 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Test.ME { - - // Metadata.xml XPath class reference: path="/api/package[@name='test.me']/class[@name='GenericObjectPropertyImplementation']" - [global::Android.Runtime.Register ("test/me/GenericObjectPropertyImplementation", DoNotGenerateAcw=true)] - public partial class GenericObjectPropertyImplementation : global::Java.Lang.Object, global::Test.ME.IGenericPropertyInterface { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("test/me/GenericObjectPropertyImplementation", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (GenericObjectPropertyImplementation); } - } - - protected GenericObjectPropertyImplementation (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static IntPtr id_ctor; - // Metadata.xml XPath constructor reference: path="/api/package[@name='test.me']/class[@name='GenericObjectPropertyImplementation']/constructor[@name='GenericObjectPropertyImplementation' and count(parameter)=0]" - [Register (".ctor", "()V", "")] - public unsafe GenericObjectPropertyImplementation () - : base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer) - { - if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero) - return; - - try { - if (((object) this).GetType () != typeof (GenericObjectPropertyImplementation)) { - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (((object) this).GetType (), "()V"), - JniHandleOwnership.TransferLocalRef); - global::Android.Runtime.JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, "()V"); - return; - } - - if (id_ctor == IntPtr.Zero) - id_ctor = JNIEnv.GetMethodID (class_ref, "", "()V"); - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (class_ref, id_ctor), - JniHandleOwnership.TransferLocalRef); - JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, class_ref, id_ctor); - } finally { - } - } - - static Delegate cb_getObject; -#pragma warning disable 0169 - static Delegate GetGetObjectHandler () - { - if (cb_getObject == null) - cb_getObject = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_L) n_GetObject); - return cb_getObject; - } - - static IntPtr n_GetObject (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return JNIEnv.ToLocalJniHandle (__this.Object); - } -#pragma warning restore 0169 - - static Delegate cb_setObject_Ljava_lang_Object_; -#pragma warning disable 0169 - static Delegate GetSetObject_Ljava_lang_Object_Handler () - { - if (cb_setObject_Ljava_lang_Object_ == null) - cb_setObject_Ljava_lang_Object_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_V) n_SetObject_Ljava_lang_Object_); - return cb_setObject_Ljava_lang_Object_; - } - - static void n_SetObject_Ljava_lang_Object_ (IntPtr jnienv, IntPtr native__this, IntPtr native_value) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var value = global::Java.Lang.Object.GetObject (native_value, JniHandleOwnership.DoNotTransfer); - __this.Object = value; - } -#pragma warning restore 0169 - - static IntPtr id_getObject; - static IntPtr id_setObject_Ljava_lang_Object_; - public virtual unsafe global::Java.Lang.Object Object { - // Metadata.xml XPath method reference: path="/api/package[@name='test.me']/class[@name='GenericObjectPropertyImplementation']/method[@name='getObject' and count(parameter)=0]" - [Register ("getObject", "()Ljava/lang/Object;", "GetGetObjectHandler")] - get { - if (id_getObject == IntPtr.Zero) - id_getObject = JNIEnv.GetMethodID (class_ref, "getObject", "()Ljava/lang/Object;"); - try { - - if (((object) this).GetType () == ThresholdType) - return global::Java.Lang.Object.GetObject (JNIEnv.CallObjectMethod (((global::Java.Lang.Object) this).Handle, id_getObject), JniHandleOwnership.TransferLocalRef); - else - return global::Java.Lang.Object.GetObject (JNIEnv.CallNonvirtualObjectMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "getObject", "()Ljava/lang/Object;")), JniHandleOwnership.TransferLocalRef); - } finally { - } - } - // Metadata.xml XPath method reference: path="/api/package[@name='test.me']/class[@name='GenericObjectPropertyImplementation']/method[@name='setObject' and count(parameter)=1 and parameter[1][@type='java.lang.Object']]" - [Register ("setObject", "(Ljava/lang/Object;)V", "GetSetObject_Ljava_lang_Object_Handler")] - set { - if (id_setObject_Ljava_lang_Object_ == IntPtr.Zero) - id_setObject_Ljava_lang_Object_ = JNIEnv.GetMethodID (class_ref, "setObject", "(Ljava/lang/Object;)V"); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (value); - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_setObject_Ljava_lang_Object_, __args); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "setObject", "(Ljava/lang/Object;)V"), __args); - } finally { - } - } - } - - } -} diff --git a/tests/generator-Tests/expected/TestInterface/Test.ME.GenericStringImplementation.cs b/tests/generator-Tests/expected/TestInterface/Test.ME.GenericStringImplementation.cs deleted file mode 100644 index e4423efaf..000000000 --- a/tests/generator-Tests/expected/TestInterface/Test.ME.GenericStringImplementation.cs +++ /dev/null @@ -1,116 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Test.ME { - - // Metadata.xml XPath class reference: path="/api/package[@name='test.me']/class[@name='GenericStringImplementation']" - [global::Android.Runtime.Register ("test/me/GenericStringImplementation", DoNotGenerateAcw=true)] - public partial class GenericStringImplementation : global::Java.Lang.Object, global::Test.ME.IGenericInterface { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("test/me/GenericStringImplementation", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (GenericStringImplementation); } - } - - protected GenericStringImplementation (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static IntPtr id_ctor; - // Metadata.xml XPath constructor reference: path="/api/package[@name='test.me']/class[@name='GenericStringImplementation']/constructor[@name='GenericStringImplementation' and count(parameter)=0]" - [Register (".ctor", "()V", "")] - public unsafe GenericStringImplementation () - : base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer) - { - if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero) - return; - - try { - if (((object) this).GetType () != typeof (GenericStringImplementation)) { - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (((object) this).GetType (), "()V"), - JniHandleOwnership.TransferLocalRef); - global::Android.Runtime.JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, "()V"); - return; - } - - if (id_ctor == IntPtr.Zero) - id_ctor = JNIEnv.GetMethodID (class_ref, "", "()V"); - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (class_ref, id_ctor), - JniHandleOwnership.TransferLocalRef); - JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, class_ref, id_ctor); - } finally { - } - } - - static Delegate cb_SetObject_arrayLjava_lang_String_; -#pragma warning disable 0169 - static Delegate GetSetObject_arrayLjava_lang_String_Handler () - { - if (cb_SetObject_arrayLjava_lang_String_ == null) - cb_SetObject_arrayLjava_lang_String_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_V) n_SetObject_arrayLjava_lang_String_); - return cb_SetObject_arrayLjava_lang_String_; - } - - static void n_SetObject_arrayLjava_lang_String_ (IntPtr jnienv, IntPtr native__this, IntPtr native_value) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var value = (string[]) JNIEnv.GetArray (native_value, JniHandleOwnership.DoNotTransfer, typeof (string)); - __this.SetObject (value); - if (value != null) - JNIEnv.CopyArray (value, native_value); - } -#pragma warning restore 0169 - - static IntPtr id_SetObject_arrayLjava_lang_String_; - // Metadata.xml XPath method reference: path="/api/package[@name='test.me']/class[@name='GenericStringImplementation']/method[@name='SetObject' and count(parameter)=1 and parameter[1][@type='java.lang.String[]']]" - [Register ("SetObject", "([Ljava/lang/String;)V", "GetSetObject_arrayLjava_lang_String_Handler")] - public virtual unsafe void SetObject (string[] value) - { - if (id_SetObject_arrayLjava_lang_String_ == IntPtr.Zero) - id_SetObject_arrayLjava_lang_String_ = JNIEnv.GetMethodID (class_ref, "SetObject", "([Ljava/lang/String;)V"); - IntPtr native_value = JNIEnv.NewArray (value); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_value); - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_SetObject_arrayLjava_lang_String_, __args); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "SetObject", "([Ljava/lang/String;)V"), __args); - } finally { - if (value != null) { - JNIEnv.CopyArray (native_value, value); - JNIEnv.DeleteLocalRef (native_value); - } - } - } - - // This method is explicitly implemented as a member of an instantiated Test.ME.IGenericInterface - void global::Test.ME.IGenericInterface.SetObject (global::Java.Lang.Object value) - { - SetObject (value.ToArray ()); - } - - } -} diff --git a/tests/generator-Tests/expected/TestInterface/Test.ME.GenericStringPropertyImplementation.cs b/tests/generator-Tests/expected/TestInterface/Test.ME.GenericStringPropertyImplementation.cs deleted file mode 100644 index 15263ec41..000000000 --- a/tests/generator-Tests/expected/TestInterface/Test.ME.GenericStringPropertyImplementation.cs +++ /dev/null @@ -1,149 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Test.ME { - - // Metadata.xml XPath class reference: path="/api/package[@name='test.me']/class[@name='GenericStringPropertyImplementation']" - [global::Android.Runtime.Register ("test/me/GenericStringPropertyImplementation", DoNotGenerateAcw=true)] - public partial class GenericStringPropertyImplementation : global::Java.Lang.Object, global::Test.ME.IGenericPropertyInterface { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("test/me/GenericStringPropertyImplementation", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (GenericStringPropertyImplementation); } - } - - protected GenericStringPropertyImplementation (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static IntPtr id_ctor; - // Metadata.xml XPath constructor reference: path="/api/package[@name='test.me']/class[@name='GenericStringPropertyImplementation']/constructor[@name='GenericStringPropertyImplementation' and count(parameter)=0]" - [Register (".ctor", "()V", "")] - public unsafe GenericStringPropertyImplementation () - : base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer) - { - if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero) - return; - - try { - if (((object) this).GetType () != typeof (GenericStringPropertyImplementation)) { - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (((object) this).GetType (), "()V"), - JniHandleOwnership.TransferLocalRef); - global::Android.Runtime.JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, "()V"); - return; - } - - if (id_ctor == IntPtr.Zero) - id_ctor = JNIEnv.GetMethodID (class_ref, "", "()V"); - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (class_ref, id_ctor), - JniHandleOwnership.TransferLocalRef); - JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, class_ref, id_ctor); - } finally { - } - } - - static Delegate cb_getObject; -#pragma warning disable 0169 - static Delegate GetGetObjectHandler () - { - if (cb_getObject == null) - cb_getObject = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_L) n_GetObject); - return cb_getObject; - } - - static IntPtr n_GetObject (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return JNIEnv.NewString (__this.Object); - } -#pragma warning restore 0169 - - static Delegate cb_SetObject_Ljava_lang_String_; -#pragma warning disable 0169 - static Delegate GetSetObject_Ljava_lang_String_Handler () - { - if (cb_SetObject_Ljava_lang_String_ == null) - cb_SetObject_Ljava_lang_String_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_V) n_SetObject_Ljava_lang_String_); - return cb_SetObject_Ljava_lang_String_; - } - - static void n_SetObject_Ljava_lang_String_ (IntPtr jnienv, IntPtr native__this, IntPtr native_value) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var value = JNIEnv.GetString (native_value, JniHandleOwnership.DoNotTransfer); - __this.Object = value; - } -#pragma warning restore 0169 - - static IntPtr id_getObject; - static IntPtr id_SetObject_Ljava_lang_String_; - public virtual unsafe string Object { - // Metadata.xml XPath method reference: path="/api/package[@name='test.me']/class[@name='GenericStringPropertyImplementation']/method[@name='getObject' and count(parameter)=0]" - [Register ("getObject", "()Ljava/lang/String;", "GetGetObjectHandler")] - get { - if (id_getObject == IntPtr.Zero) - id_getObject = JNIEnv.GetMethodID (class_ref, "getObject", "()Ljava/lang/String;"); - try { - - if (((object) this).GetType () == ThresholdType) - return JNIEnv.GetString (JNIEnv.CallObjectMethod (((global::Java.Lang.Object) this).Handle, id_getObject), JniHandleOwnership.TransferLocalRef); - else - return JNIEnv.GetString (JNIEnv.CallNonvirtualObjectMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "getObject", "()Ljava/lang/String;")), JniHandleOwnership.TransferLocalRef); - } finally { - } - } - // Metadata.xml XPath method reference: path="/api/package[@name='test.me']/class[@name='GenericStringPropertyImplementation']/method[@name='SetObject' and count(parameter)=1 and parameter[1][@type='java.lang.String']]" - [Register ("SetObject", "(Ljava/lang/String;)V", "GetSetObject_Ljava_lang_String_Handler")] - set { - if (id_SetObject_Ljava_lang_String_ == IntPtr.Zero) - id_SetObject_Ljava_lang_String_ = JNIEnv.GetMethodID (class_ref, "SetObject", "(Ljava/lang/String;)V"); - IntPtr native_value = JNIEnv.NewString ((string)value); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_value); - - if (((object) this).GetType () == ThresholdType) - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_SetObject_Ljava_lang_String_, __args); - else - JNIEnv.CallNonvirtualVoidMethod (((global::Java.Lang.Object) this).Handle, ThresholdClass, JNIEnv.GetMethodID (ThresholdClass, "SetObject", "(Ljava/lang/String;)V"), __args); - } finally { - JNIEnv.DeleteLocalRef (native_value); - } - } - } - - // This method is explicitly implemented as a member of an instantiated Test.ME.IGenericPropertyInterface - global::Java.Lang.Object global::Test.ME.IGenericPropertyInterface.Object { - // Metadata.xml XPath method reference: path="/api/package[@name='test.me']/interface[@name='GenericPropertyInterface']/method[@name='getObject' and count(parameter)=0]" - [Register ("getObject", "()Ljava/lang/Object;", "GetGetObjectHandler:Test.ME.IGenericPropertyInterfaceInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")] get { - return Object; - } - // Metadata.xml XPath method reference: path="/api/package[@name='test.me']/interface[@name='GenericPropertyInterface']/method[@name='setObject' and count(parameter)=1 and parameter[1][@type='T']]" - [Register ("setObject", "(Ljava/lang/Object;)V", "GetSetObject_Ljava_lang_Object_Handler:Test.ME.IGenericPropertyInterfaceInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")] set { - Object = value?.ToString (); - } - } - - } -} diff --git a/tests/generator-Tests/expected/TestInterface/Test.ME.IGenericInterface.cs b/tests/generator-Tests/expected/TestInterface/Test.ME.IGenericInterface.cs deleted file mode 100644 index 5dd28d2be..000000000 --- a/tests/generator-Tests/expected/TestInterface/Test.ME.IGenericInterface.cs +++ /dev/null @@ -1,92 +0,0 @@ -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Test.ME { - - // Metadata.xml XPath interface reference: path="/api/package[@name='test.me']/interface[@name='GenericInterface']" - [Register ("test/me/GenericInterface", "", "Test.ME.IGenericInterfaceInvoker")] - [global::Java.Interop.JavaTypeParameters (new string [] {"T"})] - public partial interface IGenericInterface : IJavaObject { - - // Metadata.xml XPath method reference: path="/api/package[@name='test.me']/interface[@name='GenericInterface']/method[@name='SetObject' and count(parameter)=1 and parameter[1][@type='T']]" - [Register ("SetObject", "(Ljava/lang/Object;)V", "GetSetObject_Ljava_lang_Object_Handler:Test.ME.IGenericInterfaceInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")] - void SetObject (global::Java.Lang.Object value); - - } - - [global::Android.Runtime.Register ("test/me/GenericInterface", DoNotGenerateAcw=true)] - internal partial class IGenericInterfaceInvoker : global::Java.Lang.Object, IGenericInterface { - - static IntPtr java_class_ref = JNIEnv.FindClass ("test/me/GenericInterface"); - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (IGenericInterfaceInvoker); } - } - - new IntPtr class_ref; - - public static IGenericInterface GetObject (IntPtr handle, JniHandleOwnership transfer) - { - return global::Java.Lang.Object.GetObject (handle, transfer); - } - - static IntPtr Validate (IntPtr handle) - { - if (!JNIEnv.IsInstanceOf (handle, java_class_ref)) - throw new InvalidCastException (string.Format ("Unable to convert instance of type '{0}' to type '{1}'.", - JNIEnv.GetClassNameFromInstance (handle), "test.me.GenericInterface")); - return handle; - } - - protected override void Dispose (bool disposing) - { - if (this.class_ref != IntPtr.Zero) - JNIEnv.DeleteGlobalRef (this.class_ref); - this.class_ref = IntPtr.Zero; - base.Dispose (disposing); - } - - public IGenericInterfaceInvoker (IntPtr handle, JniHandleOwnership transfer) : base (Validate (handle), transfer) - { - IntPtr local_ref = JNIEnv.GetObjectClass (((global::Java.Lang.Object) this).Handle); - this.class_ref = JNIEnv.NewGlobalRef (local_ref); - JNIEnv.DeleteLocalRef (local_ref); - } - - static Delegate cb_SetObject_Ljava_lang_Object_; -#pragma warning disable 0169 - static Delegate GetSetObject_Ljava_lang_Object_Handler () - { - if (cb_SetObject_Ljava_lang_Object_ == null) - cb_SetObject_Ljava_lang_Object_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_V) n_SetObject_Ljava_lang_Object_); - return cb_SetObject_Ljava_lang_Object_; - } - - static void n_SetObject_Ljava_lang_Object_ (IntPtr jnienv, IntPtr native__this, IntPtr native_value) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var value = global::Java.Lang.Object.GetObject (native_value, JniHandleOwnership.DoNotTransfer); - __this.SetObject (value); - } -#pragma warning restore 0169 - - IntPtr id_SetObject_Ljava_lang_Object_; - public unsafe void SetObject (global::Java.Lang.Object value) - { - if (id_SetObject_Ljava_lang_Object_ == IntPtr.Zero) - id_SetObject_Ljava_lang_Object_ = JNIEnv.GetMethodID (class_ref, "SetObject", "(Ljava/lang/Object;)V"); - IntPtr native_value = JNIEnv.ToLocalJniHandle (value); - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_value); - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_SetObject_Ljava_lang_Object_, __args); - JNIEnv.DeleteLocalRef (native_value); - } - - } - -} diff --git a/tests/generator-Tests/expected/TestInterface/Test.ME.IGenericPropertyInterface.cs b/tests/generator-Tests/expected/TestInterface/Test.ME.IGenericPropertyInterface.cs deleted file mode 100644 index c69c775fb..000000000 --- a/tests/generator-Tests/expected/TestInterface/Test.ME.IGenericPropertyInterface.cs +++ /dev/null @@ -1,118 +0,0 @@ -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Test.ME { - - // Metadata.xml XPath interface reference: path="/api/package[@name='test.me']/interface[@name='GenericPropertyInterface']" - [Register ("test/me/GenericPropertyInterface", "", "Test.ME.IGenericPropertyInterfaceInvoker")] - [global::Java.Interop.JavaTypeParameters (new string [] {"T"})] - public partial interface IGenericPropertyInterface : IJavaObject { - - global::Java.Lang.Object Object { - // Metadata.xml XPath method reference: path="/api/package[@name='test.me']/interface[@name='GenericPropertyInterface']/method[@name='getObject' and count(parameter)=0]" - [Register ("getObject", "()Ljava/lang/Object;", "GetGetObjectHandler:Test.ME.IGenericPropertyInterfaceInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")] get; - // Metadata.xml XPath method reference: path="/api/package[@name='test.me']/interface[@name='GenericPropertyInterface']/method[@name='setObject' and count(parameter)=1 and parameter[1][@type='T']]" - [Register ("setObject", "(Ljava/lang/Object;)V", "GetSetObject_Ljava_lang_Object_Handler:Test.ME.IGenericPropertyInterfaceInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")] set; - } - - } - - [global::Android.Runtime.Register ("test/me/GenericPropertyInterface", DoNotGenerateAcw=true)] - internal partial class IGenericPropertyInterfaceInvoker : global::Java.Lang.Object, IGenericPropertyInterface { - - static IntPtr java_class_ref = JNIEnv.FindClass ("test/me/GenericPropertyInterface"); - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (IGenericPropertyInterfaceInvoker); } - } - - new IntPtr class_ref; - - public static IGenericPropertyInterface GetObject (IntPtr handle, JniHandleOwnership transfer) - { - return global::Java.Lang.Object.GetObject (handle, transfer); - } - - static IntPtr Validate (IntPtr handle) - { - if (!JNIEnv.IsInstanceOf (handle, java_class_ref)) - throw new InvalidCastException (string.Format ("Unable to convert instance of type '{0}' to type '{1}'.", - JNIEnv.GetClassNameFromInstance (handle), "test.me.GenericPropertyInterface")); - return handle; - } - - protected override void Dispose (bool disposing) - { - if (this.class_ref != IntPtr.Zero) - JNIEnv.DeleteGlobalRef (this.class_ref); - this.class_ref = IntPtr.Zero; - base.Dispose (disposing); - } - - public IGenericPropertyInterfaceInvoker (IntPtr handle, JniHandleOwnership transfer) : base (Validate (handle), transfer) - { - IntPtr local_ref = JNIEnv.GetObjectClass (((global::Java.Lang.Object) this).Handle); - this.class_ref = JNIEnv.NewGlobalRef (local_ref); - JNIEnv.DeleteLocalRef (local_ref); - } - - static Delegate cb_getObject; -#pragma warning disable 0169 - static Delegate GetGetObjectHandler () - { - if (cb_getObject == null) - cb_getObject = JNINativeWrapper.CreateDelegate ((_JniMarshal_PP_L) n_GetObject); - return cb_getObject; - } - - static IntPtr n_GetObject (IntPtr jnienv, IntPtr native__this) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - return JNIEnv.ToLocalJniHandle (__this.Object); - } -#pragma warning restore 0169 - - static Delegate cb_setObject_Ljava_lang_Object_; -#pragma warning disable 0169 - static Delegate GetSetObject_Ljava_lang_Object_Handler () - { - if (cb_setObject_Ljava_lang_Object_ == null) - cb_setObject_Ljava_lang_Object_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_V) n_SetObject_Ljava_lang_Object_); - return cb_setObject_Ljava_lang_Object_; - } - - static void n_SetObject_Ljava_lang_Object_ (IntPtr jnienv, IntPtr native__this, IntPtr native_value) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var value = global::Java.Lang.Object.GetObject (native_value, JniHandleOwnership.DoNotTransfer); - __this.Object = value; - } -#pragma warning restore 0169 - - IntPtr id_getObject; - IntPtr id_setObject_Ljava_lang_Object_; - public unsafe global::Java.Lang.Object Object { - get { - if (id_getObject == IntPtr.Zero) - id_getObject = JNIEnv.GetMethodID (class_ref, "getObject", "()Ljava/lang/Object;"); - return (global::Java.Lang.Object) global::Java.Lang.Object.GetObject (JNIEnv.CallObjectMethod (((global::Java.Lang.Object) this).Handle, id_getObject), JniHandleOwnership.TransferLocalRef); - } - set { - if (id_setObject_Ljava_lang_Object_ == IntPtr.Zero) - id_setObject_Ljava_lang_Object_ = JNIEnv.GetMethodID (class_ref, "setObject", "(Ljava/lang/Object;)V"); - IntPtr native_value = JNIEnv.ToLocalJniHandle (value); - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_value); - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_setObject_Ljava_lang_Object_, __args); - JNIEnv.DeleteLocalRef (native_value); - } - } - - } - -} diff --git a/tests/generator-Tests/expected/TestInterface/Test.ME.ITestInterface.cs b/tests/generator-Tests/expected/TestInterface/Test.ME.ITestInterface.cs deleted file mode 100644 index bf30c1d16..000000000 --- a/tests/generator-Tests/expected/TestInterface/Test.ME.ITestInterface.cs +++ /dev/null @@ -1,214 +0,0 @@ -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Test.ME { - - [Register ("test/me/TestInterface", DoNotGenerateAcw=true)] - public abstract class TestInterface : Java.Lang.Object { - - internal TestInterface () - { - } - - // Metadata.xml XPath field reference: path="/api/package[@name='test.me']/interface[@name='TestInterface']/field[@name='SPAN_COMPOSING']" - [Register ("SPAN_COMPOSING")] - public const int SpanComposing = (int) 256; - - static IntPtr DEFAULT_FOO_jfieldId; - - // Metadata.xml XPath field reference: path="/api/package[@name='test.me']/interface[@name='TestInterface']/field[@name='DEFAULT_FOO']" - [Register ("DEFAULT_FOO")] - public static global::Java.Lang.Object DefaultFoo { - get { - if (DEFAULT_FOO_jfieldId == IntPtr.Zero) - DEFAULT_FOO_jfieldId = JNIEnv.GetStaticFieldID (class_ref, "DEFAULT_FOO", "Ljava/lang/Object;"); - IntPtr __ret = JNIEnv.GetStaticObjectField (class_ref, DEFAULT_FOO_jfieldId); - return global::Java.Lang.Object.GetObject (__ret, JniHandleOwnership.TransferLocalRef); - } - } - - new static IntPtr class_ref = JNIEnv.FindClass ("test/me/TestInterface"); - } - - [Register ("test/me/TestInterface", DoNotGenerateAcw=true)] - [global::System.Obsolete ("Use the 'TestInterface' type. This type will be removed in a future release.", error: true)] - public abstract class TestInterfaceConsts : TestInterface { - - private TestInterfaceConsts () - { - } - } - - // Metadata.xml XPath interface reference: path="/api/package[@name='test.me']/interface[@name='TestInterface']" - [Register ("test/me/TestInterface", "", "Test.ME.ITestInterfaceInvoker")] - public partial interface ITestInterface : IJavaObject { - - // Metadata.xml XPath method reference: path="/api/package[@name='test.me']/interface[@name='TestInterface']/method[@name='getSpanFlags' and count(parameter)=1 and parameter[1][@type='java.lang.Object']]" - [Register ("getSpanFlags", "(Ljava/lang/Object;)I", "GetGetSpanFlags_Ljava_lang_Object_Handler:Test.ME.ITestInterfaceInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")] - int GetSpanFlags (global::Java.Lang.Object tag); - - // Metadata.xml XPath method reference: path="/api/package[@name='test.me']/interface[@name='TestInterface']/method[@name='append' and count(parameter)=1 and parameter[1][@type='java.lang.CharSequence']]" - [Register ("append", "(Ljava/lang/CharSequence;)V", "GetAppend_Ljava_lang_CharSequence_Handler:Test.ME.ITestInterfaceInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")] - void Append (global::Java.Lang.ICharSequence value); - - // Metadata.xml XPath method reference: path="/api/package[@name='test.me']/interface[@name='TestInterface']/method[@name='identity' and count(parameter)=1 and parameter[1][@type='java.lang.CharSequence']]" - [Register ("identity", "(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;", "GetIdentity_Ljava_lang_CharSequence_Handler:Test.ME.ITestInterfaceInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")] - global::Java.Lang.ICharSequence IdentityFormatted (global::Java.Lang.ICharSequence value); - - } - - public static partial class ITestInterfaceExtensions { - - public static void Append (this Test.ME.ITestInterface self, string value) - { - var jls_value = value == null ? null : new global::Java.Lang.String (value); - self.Append (jls_value); - jls_value?.Dispose (); - } - - public static string Identity (this Test.ME.ITestInterface self, string value) - { - var jls_value = value == null ? null : new global::Java.Lang.String (value); - global::Java.Lang.ICharSequence __result = self.IdentityFormatted (jls_value); - var __rsval = __result?.ToString (); - jls_value?.Dispose (); - return __rsval; - } - } - - [global::Android.Runtime.Register ("test/me/TestInterface", DoNotGenerateAcw=true)] - internal partial class ITestInterfaceInvoker : global::Java.Lang.Object, ITestInterface { - - static IntPtr java_class_ref = JNIEnv.FindClass ("test/me/TestInterface"); - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (ITestInterfaceInvoker); } - } - - new IntPtr class_ref; - - public static ITestInterface GetObject (IntPtr handle, JniHandleOwnership transfer) - { - return global::Java.Lang.Object.GetObject (handle, transfer); - } - - static IntPtr Validate (IntPtr handle) - { - if (!JNIEnv.IsInstanceOf (handle, java_class_ref)) - throw new InvalidCastException (string.Format ("Unable to convert instance of type '{0}' to type '{1}'.", - JNIEnv.GetClassNameFromInstance (handle), "test.me.TestInterface")); - return handle; - } - - protected override void Dispose (bool disposing) - { - if (this.class_ref != IntPtr.Zero) - JNIEnv.DeleteGlobalRef (this.class_ref); - this.class_ref = IntPtr.Zero; - base.Dispose (disposing); - } - - public ITestInterfaceInvoker (IntPtr handle, JniHandleOwnership transfer) : base (Validate (handle), transfer) - { - IntPtr local_ref = JNIEnv.GetObjectClass (((global::Java.Lang.Object) this).Handle); - this.class_ref = JNIEnv.NewGlobalRef (local_ref); - JNIEnv.DeleteLocalRef (local_ref); - } - - static Delegate cb_getSpanFlags_Ljava_lang_Object_; -#pragma warning disable 0169 - static Delegate GetGetSpanFlags_Ljava_lang_Object_Handler () - { - if (cb_getSpanFlags_Ljava_lang_Object_ == null) - cb_getSpanFlags_Ljava_lang_Object_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_I) n_GetSpanFlags_Ljava_lang_Object_); - return cb_getSpanFlags_Ljava_lang_Object_; - } - - static int n_GetSpanFlags_Ljava_lang_Object_ (IntPtr jnienv, IntPtr native__this, IntPtr native_tag) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var tag = global::Java.Lang.Object.GetObject (native_tag, JniHandleOwnership.DoNotTransfer); - int __ret = __this.GetSpanFlags (tag); - return __ret; - } -#pragma warning restore 0169 - - IntPtr id_getSpanFlags_Ljava_lang_Object_; - public unsafe int GetSpanFlags (global::Java.Lang.Object tag) - { - if (id_getSpanFlags_Ljava_lang_Object_ == IntPtr.Zero) - id_getSpanFlags_Ljava_lang_Object_ = JNIEnv.GetMethodID (class_ref, "getSpanFlags", "(Ljava/lang/Object;)I"); - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (tag); - var __ret = JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_getSpanFlags_Ljava_lang_Object_, __args); - return __ret; - } - - static Delegate cb_append_Ljava_lang_CharSequence_; -#pragma warning disable 0169 - static Delegate GetAppend_Ljava_lang_CharSequence_Handler () - { - if (cb_append_Ljava_lang_CharSequence_ == null) - cb_append_Ljava_lang_CharSequence_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_V) n_Append_Ljava_lang_CharSequence_); - return cb_append_Ljava_lang_CharSequence_; - } - - static void n_Append_Ljava_lang_CharSequence_ (IntPtr jnienv, IntPtr native__this, IntPtr native_value) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var value = global::Java.Lang.Object.GetObject (native_value, JniHandleOwnership.DoNotTransfer); - __this.Append (value); - } -#pragma warning restore 0169 - - IntPtr id_append_Ljava_lang_CharSequence_; - public unsafe void Append (global::Java.Lang.ICharSequence value) - { - if (id_append_Ljava_lang_CharSequence_ == IntPtr.Zero) - id_append_Ljava_lang_CharSequence_ = JNIEnv.GetMethodID (class_ref, "append", "(Ljava/lang/CharSequence;)V"); - IntPtr native_value = CharSequence.ToLocalJniHandle (value); - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_value); - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_append_Ljava_lang_CharSequence_, __args); - JNIEnv.DeleteLocalRef (native_value); - } - - static Delegate cb_identity_Ljava_lang_CharSequence_; -#pragma warning disable 0169 - static Delegate GetIdentity_Ljava_lang_CharSequence_Handler () - { - if (cb_identity_Ljava_lang_CharSequence_ == null) - cb_identity_Ljava_lang_CharSequence_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_L) n_Identity_Ljava_lang_CharSequence_); - return cb_identity_Ljava_lang_CharSequence_; - } - - static IntPtr n_Identity_Ljava_lang_CharSequence_ (IntPtr jnienv, IntPtr native__this, IntPtr native_value) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var value = global::Java.Lang.Object.GetObject (native_value, JniHandleOwnership.DoNotTransfer); - IntPtr __ret = CharSequence.ToLocalJniHandle (__this.IdentityFormatted (value)); - return __ret; - } -#pragma warning restore 0169 - - IntPtr id_identity_Ljava_lang_CharSequence_; - public unsafe global::Java.Lang.ICharSequence IdentityFormatted (global::Java.Lang.ICharSequence value) - { - if (id_identity_Ljava_lang_CharSequence_ == IntPtr.Zero) - id_identity_Ljava_lang_CharSequence_ = JNIEnv.GetMethodID (class_ref, "identity", "(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;"); - IntPtr native_value = CharSequence.ToLocalJniHandle (value); - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_value); - var __ret = global::Java.Lang.Object.GetObject (JNIEnv.CallObjectMethod (((global::Java.Lang.Object) this).Handle, id_identity_Ljava_lang_CharSequence_, __args), JniHandleOwnership.TransferLocalRef); - JNIEnv.DeleteLocalRef (native_value); - return __ret; - } - - } - -} diff --git a/tests/generator-Tests/expected/TestInterface/Test.ME.TestInterfaceImplementation.cs b/tests/generator-Tests/expected/TestInterface/Test.ME.TestInterfaceImplementation.cs deleted file mode 100644 index f04972ac9..000000000 --- a/tests/generator-Tests/expected/TestInterface/Test.ME.TestInterfaceImplementation.cs +++ /dev/null @@ -1,234 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Test.ME { - - // Metadata.xml XPath class reference: path="/api/package[@name='test.me']/class[@name='TestInterfaceImplementation']" - [global::Android.Runtime.Register ("test/me/TestInterfaceImplementation", DoNotGenerateAcw=true)] - public abstract partial class TestInterfaceImplementation : global::Java.Lang.Object, global::Test.ME.ITestInterface { - - - public static class InterfaceConsts { - - // The following are fields from: test.me.TestInterface - - // Metadata.xml XPath field reference: path="/api/package[@name='test.me']/interface[@name='TestInterface']/field[@name='SPAN_COMPOSING']" - [Register ("SPAN_COMPOSING")] - public const int SpanComposing = (int) 256; - - static IntPtr DEFAULT_FOO_jfieldId; - - // Metadata.xml XPath field reference: path="/api/package[@name='test.me']/interface[@name='TestInterface']/field[@name='DEFAULT_FOO']" - [Register ("DEFAULT_FOO")] - public static global::Java.Lang.Object DefaultFoo { - get { - if (DEFAULT_FOO_jfieldId == IntPtr.Zero) - DEFAULT_FOO_jfieldId = JNIEnv.GetStaticFieldID (class_ref, "DEFAULT_FOO", "Ljava/lang/Object;"); - IntPtr __ret = JNIEnv.GetStaticObjectField (class_ref, DEFAULT_FOO_jfieldId); - return global::Java.Lang.Object.GetObject (__ret, JniHandleOwnership.TransferLocalRef); - } - } - } - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("test/me/TestInterfaceImplementation", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (TestInterfaceImplementation); } - } - - protected TestInterfaceImplementation (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static IntPtr id_ctor; - // Metadata.xml XPath constructor reference: path="/api/package[@name='test.me']/class[@name='TestInterfaceImplementation']/constructor[@name='TestInterfaceImplementation' and count(parameter)=0]" - [Register (".ctor", "()V", "")] - public unsafe TestInterfaceImplementation () - : base (IntPtr.Zero, JniHandleOwnership.DoNotTransfer) - { - if (((global::Java.Lang.Object) this).Handle != IntPtr.Zero) - return; - - try { - if (((object) this).GetType () != typeof (TestInterfaceImplementation)) { - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (((object) this).GetType (), "()V"), - JniHandleOwnership.TransferLocalRef); - global::Android.Runtime.JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, "()V"); - return; - } - - if (id_ctor == IntPtr.Zero) - id_ctor = JNIEnv.GetMethodID (class_ref, "", "()V"); - SetHandle ( - global::Android.Runtime.JNIEnv.StartCreateInstance (class_ref, id_ctor), - JniHandleOwnership.TransferLocalRef); - JNIEnv.FinishCreateInstance (((global::Java.Lang.Object) this).Handle, class_ref, id_ctor); - } finally { - } - } - - static Delegate cb_getSpanFlags_Ljava_lang_Object_; -#pragma warning disable 0169 - static Delegate GetGetSpanFlags_Ljava_lang_Object_Handler () - { - if (cb_getSpanFlags_Ljava_lang_Object_ == null) - cb_getSpanFlags_Ljava_lang_Object_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_I) n_GetSpanFlags_Ljava_lang_Object_); - return cb_getSpanFlags_Ljava_lang_Object_; - } - - static int n_GetSpanFlags_Ljava_lang_Object_ (IntPtr jnienv, IntPtr native__this, IntPtr native_tag) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var tag = global::Java.Lang.Object.GetObject (native_tag, JniHandleOwnership.DoNotTransfer); - int __ret = __this.GetSpanFlags (tag); - return __ret; - } -#pragma warning restore 0169 - - // Metadata.xml XPath method reference: path="/api/package[@name='test.me']/interface[@name='TestInterface']/method[@name='getSpanFlags' and count(parameter)=1 and parameter[1][@type='java.lang.Object']]" - [Register ("getSpanFlags", "(Ljava/lang/Object;)I", "GetGetSpanFlags_Ljava_lang_Object_Handler")] - public abstract int GetSpanFlags (global::Java.Lang.Object tag); - - static Delegate cb_append_Ljava_lang_CharSequence_; -#pragma warning disable 0169 - static Delegate GetAppend_Ljava_lang_CharSequence_Handler () - { - if (cb_append_Ljava_lang_CharSequence_ == null) - cb_append_Ljava_lang_CharSequence_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_V) n_Append_Ljava_lang_CharSequence_); - return cb_append_Ljava_lang_CharSequence_; - } - - static void n_Append_Ljava_lang_CharSequence_ (IntPtr jnienv, IntPtr native__this, IntPtr native_value) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var value = global::Java.Lang.Object.GetObject (native_value, JniHandleOwnership.DoNotTransfer); - __this.Append (value); - } -#pragma warning restore 0169 - - // Metadata.xml XPath method reference: path="/api/package[@name='test.me']/interface[@name='TestInterface']/method[@name='append' and count(parameter)=1 and parameter[1][@type='java.lang.CharSequence']]" - [Register ("append", "(Ljava/lang/CharSequence;)V", "GetAppend_Ljava_lang_CharSequence_Handler")] - public abstract void Append (global::Java.Lang.ICharSequence value); - - public void Append (string value) - { - var jls_value = value == null ? null : new global::Java.Lang.String (value); - Append (jls_value); - jls_value?.Dispose (); - } - - static Delegate cb_identity_Ljava_lang_CharSequence_; -#pragma warning disable 0169 - static Delegate GetIdentity_Ljava_lang_CharSequence_Handler () - { - if (cb_identity_Ljava_lang_CharSequence_ == null) - cb_identity_Ljava_lang_CharSequence_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_L) n_Identity_Ljava_lang_CharSequence_); - return cb_identity_Ljava_lang_CharSequence_; - } - - static IntPtr n_Identity_Ljava_lang_CharSequence_ (IntPtr jnienv, IntPtr native__this, IntPtr native_value) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var value = global::Java.Lang.Object.GetObject (native_value, JniHandleOwnership.DoNotTransfer); - IntPtr __ret = CharSequence.ToLocalJniHandle (__this.IdentityFormatted (value)); - return __ret; - } -#pragma warning restore 0169 - - // Metadata.xml XPath method reference: path="/api/package[@name='test.me']/interface[@name='TestInterface']/method[@name='identity' and count(parameter)=1 and parameter[1][@type='java.lang.CharSequence']]" - [Register ("identity", "(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;", "GetIdentity_Ljava_lang_CharSequence_Handler")] - public abstract global::Java.Lang.ICharSequence IdentityFormatted (global::Java.Lang.ICharSequence value); - - public string Identity (string value) - { - var jls_value = value == null ? null : new global::Java.Lang.String (value); - global::Java.Lang.ICharSequence __result = IdentityFormatted (jls_value); - var __rsval = __result?.ToString (); - jls_value?.Dispose (); - return __rsval; - } - - } - - [global::Android.Runtime.Register ("test/me/TestInterfaceImplementation", DoNotGenerateAcw=true)] - internal partial class TestInterfaceImplementationInvoker : TestInterfaceImplementation { - - public TestInterfaceImplementationInvoker (IntPtr handle, JniHandleOwnership transfer) : base (handle, transfer) {} - - protected override global::System.Type ThresholdType { - get { return typeof (TestInterfaceImplementationInvoker); } - } - - static IntPtr id_getSpanFlags_Ljava_lang_Object_; - // Metadata.xml XPath method reference: path="/api/package[@name='test.me']/interface[@name='TestInterface']/method[@name='getSpanFlags' and count(parameter)=1 and parameter[1][@type='java.lang.Object']]" - [Register ("getSpanFlags", "(Ljava/lang/Object;)I", "GetGetSpanFlags_Ljava_lang_Object_Handler")] - public override unsafe int GetSpanFlags (global::Java.Lang.Object tag) - { - if (id_getSpanFlags_Ljava_lang_Object_ == IntPtr.Zero) - id_getSpanFlags_Ljava_lang_Object_ = JNIEnv.GetMethodID (class_ref, "getSpanFlags", "(Ljava/lang/Object;)I"); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (tag); - int __ret = JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_getSpanFlags_Ljava_lang_Object_, __args); - return __ret; - } finally { - } - } - - static IntPtr id_append_Ljava_lang_CharSequence_; - // Metadata.xml XPath method reference: path="/api/package[@name='test.me']/interface[@name='TestInterface']/method[@name='append' and count(parameter)=1 and parameter[1][@type='java.lang.CharSequence']]" - [Register ("append", "(Ljava/lang/CharSequence;)V", "GetAppend_Ljava_lang_CharSequence_Handler")] - public override unsafe void Append (global::Java.Lang.ICharSequence value) - { - if (id_append_Ljava_lang_CharSequence_ == IntPtr.Zero) - id_append_Ljava_lang_CharSequence_ = JNIEnv.GetMethodID (class_ref, "append", "(Ljava/lang/CharSequence;)V"); - IntPtr native_value = CharSequence.ToLocalJniHandle (value); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_value); - JNIEnv.CallVoidMethod (((global::Java.Lang.Object) this).Handle, id_append_Ljava_lang_CharSequence_, __args); - } finally { - JNIEnv.DeleteLocalRef (native_value); - } - } - - static IntPtr id_identity_Ljava_lang_CharSequence_; - // Metadata.xml XPath method reference: path="/api/package[@name='test.me']/interface[@name='TestInterface']/method[@name='identity' and count(parameter)=1 and parameter[1][@type='java.lang.CharSequence']]" - [Register ("identity", "(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;", "GetIdentity_Ljava_lang_CharSequence_Handler")] - public override unsafe global::Java.Lang.ICharSequence IdentityFormatted (global::Java.Lang.ICharSequence value) - { - if (id_identity_Ljava_lang_CharSequence_ == IntPtr.Zero) - id_identity_Ljava_lang_CharSequence_ = JNIEnv.GetMethodID (class_ref, "identity", "(Ljava/lang/CharSequence;)Ljava/lang/CharSequence;"); - IntPtr native_value = CharSequence.ToLocalJniHandle (value); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_value); - global::Java.Lang.ICharSequence __ret = global::Java.Lang.Object.GetObject (JNIEnv.CallObjectMethod (((global::Java.Lang.Object) this).Handle, id_identity_Ljava_lang_CharSequence_, __args), JniHandleOwnership.TransferLocalRef); - return __ret; - } finally { - JNIEnv.DeleteLocalRef (native_value); - } - } - - } - -} diff --git a/tests/generator-Tests/expected/java.lang.Enum/Java.Lang.Enum.cs b/tests/generator-Tests/expected/java.lang.Enum/Java.Lang.Enum.cs deleted file mode 100644 index 8e1a0147c..000000000 --- a/tests/generator-Tests/expected/java.lang.Enum/Java.Lang.Enum.cs +++ /dev/null @@ -1,70 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Java.Lang { - - // Metadata.xml XPath class reference: path="/api/package[@name='java.lang']/class[@name='Enum']" - [global::Android.Runtime.Register ("java/lang/Enum", DoNotGenerateAcw=true)] - [global::Java.Interop.JavaTypeParameters (new string [] {"E extends java.lang.Enum"})] - public abstract partial class Enum : global::Java.Lang.Object, global::Java.Lang.IComparable { - - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("java/lang/Enum", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (Enum); } - } - - protected Enum (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - static IntPtr id_compareTo_Ljava_lang_Enum_; - // Metadata.xml XPath method reference: path="/api/package[@name='java.lang']/class[@name='Enum']/method[@name='compareTo' and count(parameter)=1 and parameter[1][@type='E']]" - [Register ("compareTo", "(Ljava/lang/Enum;)I", "")] - public unsafe int CompareTo (global::Java.Lang.Object o) - { - if (id_compareTo_Ljava_lang_Enum_ == IntPtr.Zero) - id_compareTo_Ljava_lang_Enum_ = JNIEnv.GetMethodID (class_ref, "compareTo", "(Ljava/lang/Enum;)I"); - IntPtr native_o = JNIEnv.ToLocalJniHandle (o); - try { - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_o); - int __ret = JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_compareTo_Ljava_lang_Enum_, __args); - return __ret; - } finally { - JNIEnv.DeleteLocalRef (native_o); - } - } - - } - - [global::Android.Runtime.Register ("java/lang/Enum", DoNotGenerateAcw=true)] - internal partial class EnumInvoker : Enum, global::Java.Lang.IComparable { - - public EnumInvoker (IntPtr handle, JniHandleOwnership transfer) : base (handle, transfer) {} - - protected override global::System.Type ThresholdType { - get { return typeof (EnumInvoker); } - } - - } - -} diff --git a/tests/generator-Tests/expected/java.lang.Enum/Java.Lang.IComparable.cs b/tests/generator-Tests/expected/java.lang.Enum/Java.Lang.IComparable.cs deleted file mode 100644 index 188e5ba2c..000000000 --- a/tests/generator-Tests/expected/java.lang.Enum/Java.Lang.IComparable.cs +++ /dev/null @@ -1,94 +0,0 @@ -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Java.Lang { - - // Metadata.xml XPath interface reference: path="/api/package[@name='java.lang']/interface[@name='Comparable']" - [Register ("java/lang/Comparable", "", "Java.Lang.IComparableInvoker")] - [global::Java.Interop.JavaTypeParameters (new string [] {"T"})] - public partial interface IComparable : IJavaObject { - - // Metadata.xml XPath method reference: path="/api/package[@name='java.lang']/interface[@name='Comparable']/method[@name='compareTo' and count(parameter)=1 and parameter[1][@type='T']]" - [Register ("compareTo", "(Ljava/lang/Object;)I", "GetCompareTo_Ljava_lang_Object_Handler:Java.Lang.IComparableInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null")] - int CompareTo (global::Java.Lang.Object another); - - } - - [global::Android.Runtime.Register ("java/lang/Comparable", DoNotGenerateAcw=true)] - internal partial class IComparableInvoker : global::Java.Lang.Object, IComparable { - - static IntPtr java_class_ref = JNIEnv.FindClass ("java/lang/Comparable"); - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (IComparableInvoker); } - } - - new IntPtr class_ref; - - public static IComparable GetObject (IntPtr handle, JniHandleOwnership transfer) - { - return global::Java.Lang.Object.GetObject (handle, transfer); - } - - static IntPtr Validate (IntPtr handle) - { - if (!JNIEnv.IsInstanceOf (handle, java_class_ref)) - throw new InvalidCastException (string.Format ("Unable to convert instance of type '{0}' to type '{1}'.", - JNIEnv.GetClassNameFromInstance (handle), "java.lang.Comparable")); - return handle; - } - - protected override void Dispose (bool disposing) - { - if (this.class_ref != IntPtr.Zero) - JNIEnv.DeleteGlobalRef (this.class_ref); - this.class_ref = IntPtr.Zero; - base.Dispose (disposing); - } - - public IComparableInvoker (IntPtr handle, JniHandleOwnership transfer) : base (Validate (handle), transfer) - { - IntPtr local_ref = JNIEnv.GetObjectClass (((global::Java.Lang.Object) this).Handle); - this.class_ref = JNIEnv.NewGlobalRef (local_ref); - JNIEnv.DeleteLocalRef (local_ref); - } - - static Delegate cb_compareTo_Ljava_lang_Object_; -#pragma warning disable 0169 - static Delegate GetCompareTo_Ljava_lang_Object_Handler () - { - if (cb_compareTo_Ljava_lang_Object_ == null) - cb_compareTo_Ljava_lang_Object_ = JNINativeWrapper.CreateDelegate ((_JniMarshal_PPL_I) n_CompareTo_Ljava_lang_Object_); - return cb_compareTo_Ljava_lang_Object_; - } - - static int n_CompareTo_Ljava_lang_Object_ (IntPtr jnienv, IntPtr native__this, IntPtr native_another) - { - var __this = global::Java.Lang.Object.GetObject (jnienv, native__this, JniHandleOwnership.DoNotTransfer); - var another = global::Java.Lang.Object.GetObject (native_another, JniHandleOwnership.DoNotTransfer); - int __ret = __this.CompareTo (another); - return __ret; - } -#pragma warning restore 0169 - - IntPtr id_compareTo_Ljava_lang_Object_; - public unsafe int CompareTo (global::Java.Lang.Object another) - { - if (id_compareTo_Ljava_lang_Object_ == IntPtr.Zero) - id_compareTo_Ljava_lang_Object_ = JNIEnv.GetMethodID (class_ref, "compareTo", "(Ljava/lang/Object;)I"); - IntPtr native_another = JNIEnv.ToLocalJniHandle (another); - JValue* __args = stackalloc JValue [1]; - __args [0] = new JValue (native_another); - var __ret = JNIEnv.CallIntMethod (((global::Java.Lang.Object) this).Handle, id_compareTo_Ljava_lang_Object_, __args); - JNIEnv.DeleteLocalRef (native_another); - return __ret; - } - - } - -} diff --git a/tests/generator-Tests/expected/java.lang.Enum/Java.Lang.Object.cs b/tests/generator-Tests/expected/java.lang.Enum/Java.Lang.Object.cs deleted file mode 100644 index dd027b081..000000000 --- a/tests/generator-Tests/expected/java.lang.Enum/Java.Lang.Object.cs +++ /dev/null @@ -1,29 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Java.Lang { - - // Metadata.xml XPath class reference: path="/api/package[@name='java.lang']/class[@name='Object']" - [global::Android.Runtime.Register ("java/lang/Object", DoNotGenerateAcw=true)] - public partial class Object { - - internal static IntPtr java_class_handle; - internal static IntPtr class_ref { - get { - return JNIEnv.FindClass ("java/lang/Object", ref java_class_handle); - } - } - - } -} diff --git a/tests/generator-Tests/expected/java.lang.Enum/Java.Lang.State.cs b/tests/generator-Tests/expected/java.lang.Enum/Java.Lang.State.cs deleted file mode 100644 index cd59b54c6..000000000 --- a/tests/generator-Tests/expected/java.lang.Enum/Java.Lang.State.cs +++ /dev/null @@ -1,117 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Java.Lang { - - // Metadata.xml XPath class reference: path="/api/package[@name='java.lang']/class[@name='State']" - [global::Android.Runtime.Register ("java/lang/State", DoNotGenerateAcw=true)] - public sealed partial class State : global::Java.Lang.Enum { - - - static IntPtr BLOCKED_jfieldId; - - // Metadata.xml XPath field reference: path="/api/package[@name='java.lang']/class[@name='State']/field[@name='BLOCKED']" - [Register ("BLOCKED")] - public static global::Java.Lang.State Blocked { - get { - if (BLOCKED_jfieldId == IntPtr.Zero) - BLOCKED_jfieldId = JNIEnv.GetStaticFieldID (class_ref, "BLOCKED", "Ljava/lang/State;"); - IntPtr __ret = JNIEnv.GetStaticObjectField (class_ref, BLOCKED_jfieldId); - return global::Java.Lang.Object.GetObject (__ret, JniHandleOwnership.TransferLocalRef); - } - } - - static IntPtr NEW_jfieldId; - - // Metadata.xml XPath field reference: path="/api/package[@name='java.lang']/class[@name='State']/field[@name='NEW']" - [Register ("NEW")] - public static global::Java.Lang.State New { - get { - if (NEW_jfieldId == IntPtr.Zero) - NEW_jfieldId = JNIEnv.GetStaticFieldID (class_ref, "NEW", "Ljava/lang/State;"); - IntPtr __ret = JNIEnv.GetStaticObjectField (class_ref, NEW_jfieldId); - return global::Java.Lang.Object.GetObject (__ret, JniHandleOwnership.TransferLocalRef); - } - } - - static IntPtr RUNNABLE_jfieldId; - - // Metadata.xml XPath field reference: path="/api/package[@name='java.lang']/class[@name='State']/field[@name='RUNNABLE']" - [Register ("RUNNABLE")] - public static global::Java.Lang.State Runnable { - get { - if (RUNNABLE_jfieldId == IntPtr.Zero) - RUNNABLE_jfieldId = JNIEnv.GetStaticFieldID (class_ref, "RUNNABLE", "Ljava/lang/State;"); - IntPtr __ret = JNIEnv.GetStaticObjectField (class_ref, RUNNABLE_jfieldId); - return global::Java.Lang.Object.GetObject (__ret, JniHandleOwnership.TransferLocalRef); - } - } - - static IntPtr TERMINATED_jfieldId; - - // Metadata.xml XPath field reference: path="/api/package[@name='java.lang']/class[@name='State']/field[@name='TERMINATED']" - [Register ("TERMINATED")] - public static global::Java.Lang.State Terminated { - get { - if (TERMINATED_jfieldId == IntPtr.Zero) - TERMINATED_jfieldId = JNIEnv.GetStaticFieldID (class_ref, "TERMINATED", "Ljava/lang/State;"); - IntPtr __ret = JNIEnv.GetStaticObjectField (class_ref, TERMINATED_jfieldId); - return global::Java.Lang.Object.GetObject (__ret, JniHandleOwnership.TransferLocalRef); - } - } - - static IntPtr TIMED_WAITING_jfieldId; - - // Metadata.xml XPath field reference: path="/api/package[@name='java.lang']/class[@name='State']/field[@name='TIMED_WAITING']" - [Register ("TIMED_WAITING")] - public static global::Java.Lang.State TimedWaiting { - get { - if (TIMED_WAITING_jfieldId == IntPtr.Zero) - TIMED_WAITING_jfieldId = JNIEnv.GetStaticFieldID (class_ref, "TIMED_WAITING", "Ljava/lang/State;"); - IntPtr __ret = JNIEnv.GetStaticObjectField (class_ref, TIMED_WAITING_jfieldId); - return global::Java.Lang.Object.GetObject (__ret, JniHandleOwnership.TransferLocalRef); - } - } - - static IntPtr WAITING_jfieldId; - - // Metadata.xml XPath field reference: path="/api/package[@name='java.lang']/class[@name='State']/field[@name='WAITING']" - [Register ("WAITING")] - public static global::Java.Lang.State Waiting { - get { - if (WAITING_jfieldId == IntPtr.Zero) - WAITING_jfieldId = JNIEnv.GetStaticFieldID (class_ref, "WAITING", "Ljava/lang/State;"); - IntPtr __ret = JNIEnv.GetStaticObjectField (class_ref, WAITING_jfieldId); - return global::Java.Lang.Object.GetObject (__ret, JniHandleOwnership.TransferLocalRef); - } - } - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("java/lang/State", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (State); } - } - - internal State (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - } -} diff --git a/tests/generator-Tests/expected/java.lang.Enum/Mono.Android.projitems b/tests/generator-Tests/expected/java.lang.Enum/Mono.Android.projitems deleted file mode 100644 index fa2e06041..000000000 --- a/tests/generator-Tests/expected/java.lang.Enum/Mono.Android.projitems +++ /dev/null @@ -1,17 +0,0 @@ - - - - $(DefineConstants);ANDROID_1;ANDROID_2;ANDROID_3;ANDROID_4 - - - - - - - - - - - - - \ No newline at end of file diff --git a/tests/generator-Tests/expected/java.lang.Object/Java.Interop.__TypeRegistrations.cs b/tests/generator-Tests/expected/java.lang.Object/Java.Interop.__TypeRegistrations.cs deleted file mode 100644 index 0131993a1..000000000 --- a/tests/generator-Tests/expected/java.lang.Object/Java.Interop.__TypeRegistrations.cs +++ /dev/null @@ -1,47 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Java.Interop { - - partial class __TypeRegistrations { - - public static void RegisterPackages () - { -#if MONODROID_TIMING - var start = DateTime.Now; - Android.Util.Log.Info ("MonoDroid-Timing", "RegisterPackages start: " + (start - new DateTime (1970, 1, 1)).TotalMilliseconds); -#endif // def MONODROID_TIMING - Java.Interop.TypeManager.RegisterPackages ( - new string[]{ - }, - new Converter[]{ - }); -#if MONODROID_TIMING - var end = DateTime.Now; - Android.Util.Log.Info ("MonoDroid-Timing", "RegisterPackages time: " + (end - new DateTime (1970, 1, 1)).TotalMilliseconds + " [elapsed: " + (end - start).TotalMilliseconds + " ms]"); -#endif // def MONODROID_TIMING - } - -#if NET5_0_OR_GREATER - [System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessage ("Trimming", "IL2057")] -#endif - static Type Lookup (string[] mappings, string javaType) - { - var managedType = Java.Interop.TypeManager.LookupTypeMapping (mappings, javaType); - if (managedType == null) - return null; - return Type.GetType (managedType); - } - } -} diff --git a/tests/generator-Tests/expected/java.lang.Object/Java.Lang.Object.cs b/tests/generator-Tests/expected/java.lang.Object/Java.Lang.Object.cs deleted file mode 100644 index dd027b081..000000000 --- a/tests/generator-Tests/expected/java.lang.Object/Java.Lang.Object.cs +++ /dev/null @@ -1,29 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Java.Lang { - - // Metadata.xml XPath class reference: path="/api/package[@name='java.lang']/class[@name='Object']" - [global::Android.Runtime.Register ("java/lang/Object", DoNotGenerateAcw=true)] - public partial class Object { - - internal static IntPtr java_class_handle; - internal static IntPtr class_ref { - get { - return JNIEnv.FindClass ("java/lang/Object", ref java_class_handle); - } - } - - } -} diff --git a/tests/generator-Tests/expected/java.lang.Object/Mono.Android.projitems b/tests/generator-Tests/expected/java.lang.Object/Mono.Android.projitems deleted file mode 100644 index d140c8de1..000000000 --- a/tests/generator-Tests/expected/java.lang.Object/Mono.Android.projitems +++ /dev/null @@ -1,14 +0,0 @@ - - - - $(DefineConstants);ANDROID_1;ANDROID_2;ANDROID_3;ANDROID_4 - - - - - - - - - - \ No newline at end of file diff --git a/tests/generator-Tests/expected/java.lang.Object/__NamespaceMapping__.cs b/tests/generator-Tests/expected/java.lang.Object/__NamespaceMapping__.cs deleted file mode 100644 index 01ebfbe27..000000000 --- a/tests/generator-Tests/expected/java.lang.Object/__NamespaceMapping__.cs +++ /dev/null @@ -1,4 +0,0 @@ -using System; - -[assembly:global::Android.Runtime.NamespaceMapping (Java = "java.lang", Managed="Java.Lang")] - diff --git a/tests/generator-Tests/expected/java.lang.Object/enumlist b/tests/generator-Tests/expected/java.lang.Object/enumlist deleted file mode 100644 index e69de29bb..000000000 diff --git a/tests/generator-Tests/expected/java.util.List/Mono.Android.projitems b/tests/generator-Tests/expected/java.util.List/Mono.Android.projitems deleted file mode 100644 index 066be1dd1..000000000 --- a/tests/generator-Tests/expected/java.util.List/Mono.Android.projitems +++ /dev/null @@ -1,15 +0,0 @@ - - - - $(DefineConstants);ANDROID_1;ANDROID_2;ANDROID_3;ANDROID_4 - - - - - - - - - - - \ No newline at end of file diff --git a/tests/generator-Tests/expected/java.util.List/Xamarin.Test.SomeObject.cs b/tests/generator-Tests/expected/java.util.List/Xamarin.Test.SomeObject.cs deleted file mode 100644 index b0f420982..000000000 --- a/tests/generator-Tests/expected/java.util.List/Xamarin.Test.SomeObject.cs +++ /dev/null @@ -1,200 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -#nullable restore -using System; -using System.Collections.Generic; -using Android.Runtime; - -namespace Xamarin.Test { - - // Metadata.xml XPath class reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']" - [global::Android.Runtime.Register ("xamarin/test/SomeObject", DoNotGenerateAcw=true)] - public partial class SomeObject : global::Java.Lang.Object { - - - static IntPtr myStrings_jfieldId; - - // Metadata.xml XPath field reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/field[@name='myStrings']" - [Register ("myStrings")] - public global::System.Collections.Generic.IList MyStrings { - get { - if (myStrings_jfieldId == IntPtr.Zero) - myStrings_jfieldId = JNIEnv.GetFieldID (class_ref, "myStrings", "Ljava/util/List;"); - IntPtr __ret = JNIEnv.GetObjectField (((global::Java.Lang.Object) this).Handle, myStrings_jfieldId); - return global::Android.Runtime.JavaList.FromJniHandle (__ret, JniHandleOwnership.TransferLocalRef); - } - set { - if (myStrings_jfieldId == IntPtr.Zero) - myStrings_jfieldId = JNIEnv.GetFieldID (class_ref, "myStrings", "Ljava/util/List;"); - IntPtr native_value = global::Android.Runtime.JavaList.ToLocalJniHandle (value); - try { - JNIEnv.SetField (((global::Java.Lang.Object) this).Handle, myStrings_jfieldId, native_value); - } finally { - JNIEnv.DeleteLocalRef (native_value); - } - } - } - - static IntPtr myInts_jfieldId; - - // Metadata.xml XPath field reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/field[@name='myInts']" - [Register ("myInts")] - public global::System.Collections.Generic.IList MyInts { - get { - if (myInts_jfieldId == IntPtr.Zero) - myInts_jfieldId = JNIEnv.GetFieldID (class_ref, "myInts", "Ljava/util/List;"); - IntPtr __ret = JNIEnv.GetObjectField (((global::Java.Lang.Object) this).Handle, myInts_jfieldId); - return global::Android.Runtime.JavaList.FromJniHandle (__ret, JniHandleOwnership.TransferLocalRef); - } - set { - if (myInts_jfieldId == IntPtr.Zero) - myInts_jfieldId = JNIEnv.GetFieldID (class_ref, "myInts", "Ljava/util/List;"); - IntPtr native_value = global::Android.Runtime.JavaList.ToLocalJniHandle (value); - try { - JNIEnv.SetField (((global::Java.Lang.Object) this).Handle, myInts_jfieldId, native_value); - } finally { - JNIEnv.DeleteLocalRef (native_value); - } - } - } - - static IntPtr mybools_jfieldId; - - // Metadata.xml XPath field reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/field[@name='mybools']" - [Register ("mybools")] - public global::System.Collections.Generic.IList Mybools { - get { - if (mybools_jfieldId == IntPtr.Zero) - mybools_jfieldId = JNIEnv.GetFieldID (class_ref, "mybools", "Ljava/util/List;"); - IntPtr __ret = JNIEnv.GetObjectField (((global::Java.Lang.Object) this).Handle, mybools_jfieldId); - return global::Android.Runtime.JavaList.FromJniHandle (__ret, JniHandleOwnership.TransferLocalRef); - } - set { - if (mybools_jfieldId == IntPtr.Zero) - mybools_jfieldId = JNIEnv.GetFieldID (class_ref, "mybools", "Ljava/util/List;"); - IntPtr native_value = global::Android.Runtime.JavaList.ToLocalJniHandle (value); - try { - JNIEnv.SetField (((global::Java.Lang.Object) this).Handle, mybools_jfieldId, native_value); - } finally { - JNIEnv.DeleteLocalRef (native_value); - } - } - } - - static IntPtr myObjects_jfieldId; - - // Metadata.xml XPath field reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/field[@name='myObjects']" - [Register ("myObjects")] - public global::System.Collections.Generic.IList MyObjects { - get { - if (myObjects_jfieldId == IntPtr.Zero) - myObjects_jfieldId = JNIEnv.GetFieldID (class_ref, "myObjects", "Ljava/util/List;"); - IntPtr __ret = JNIEnv.GetObjectField (((global::Java.Lang.Object) this).Handle, myObjects_jfieldId); - return global::Android.Runtime.JavaList.FromJniHandle (__ret, JniHandleOwnership.TransferLocalRef); - } - set { - if (myObjects_jfieldId == IntPtr.Zero) - myObjects_jfieldId = JNIEnv.GetFieldID (class_ref, "myObjects", "Ljava/util/List;"); - IntPtr native_value = global::Android.Runtime.JavaList.ToLocalJniHandle (value); - try { - JNIEnv.SetField (((global::Java.Lang.Object) this).Handle, myObjects_jfieldId, native_value); - } finally { - JNIEnv.DeleteLocalRef (native_value); - } - } - } - - static IntPtr myfloats_jfieldId; - - // Metadata.xml XPath field reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/field[@name='myfloats']" - [Register ("myfloats")] - public global::System.Collections.Generic.IList Myfloats { - get { - if (myfloats_jfieldId == IntPtr.Zero) - myfloats_jfieldId = JNIEnv.GetFieldID (class_ref, "myfloats", "Ljava/util/List;"); - IntPtr __ret = JNIEnv.GetObjectField (((global::Java.Lang.Object) this).Handle, myfloats_jfieldId); - return global::Android.Runtime.JavaList.FromJniHandle (__ret, JniHandleOwnership.TransferLocalRef); - } - set { - if (myfloats_jfieldId == IntPtr.Zero) - myfloats_jfieldId = JNIEnv.GetFieldID (class_ref, "myfloats", "Ljava/util/List;"); - IntPtr native_value = global::Android.Runtime.JavaList.ToLocalJniHandle (value); - try { - JNIEnv.SetField (((global::Java.Lang.Object) this).Handle, myfloats_jfieldId, native_value); - } finally { - JNIEnv.DeleteLocalRef (native_value); - } - } - } - - static IntPtr mydoubles_jfieldId; - - // Metadata.xml XPath field reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/field[@name='mydoubles']" - [Register ("mydoubles")] - public global::System.Collections.Generic.IList Mydoubles { - get { - if (mydoubles_jfieldId == IntPtr.Zero) - mydoubles_jfieldId = JNIEnv.GetFieldID (class_ref, "mydoubles", "Ljava/util/List;"); - IntPtr __ret = JNIEnv.GetObjectField (((global::Java.Lang.Object) this).Handle, mydoubles_jfieldId); - return global::Android.Runtime.JavaList.FromJniHandle (__ret, JniHandleOwnership.TransferLocalRef); - } - set { - if (mydoubles_jfieldId == IntPtr.Zero) - mydoubles_jfieldId = JNIEnv.GetFieldID (class_ref, "mydoubles", "Ljava/util/List;"); - IntPtr native_value = global::Android.Runtime.JavaList.ToLocalJniHandle (value); - try { - JNIEnv.SetField (((global::Java.Lang.Object) this).Handle, mydoubles_jfieldId, native_value); - } finally { - JNIEnv.DeleteLocalRef (native_value); - } - } - } - - static IntPtr mylongs_jfieldId; - - // Metadata.xml XPath field reference: path="/api/package[@name='xamarin.test']/class[@name='SomeObject']/field[@name='mylongs']" - [Register ("mylongs")] - public global::System.Collections.Generic.IList Mylongs { - get { - if (mylongs_jfieldId == IntPtr.Zero) - mylongs_jfieldId = JNIEnv.GetFieldID (class_ref, "mylongs", "Ljava/util/List;"); - IntPtr __ret = JNIEnv.GetObjectField (((global::Java.Lang.Object) this).Handle, mylongs_jfieldId); - return global::Android.Runtime.JavaList.FromJniHandle (__ret, JniHandleOwnership.TransferLocalRef); - } - set { - if (mylongs_jfieldId == IntPtr.Zero) - mylongs_jfieldId = JNIEnv.GetFieldID (class_ref, "mylongs", "Ljava/util/List;"); - IntPtr native_value = global::Android.Runtime.JavaList.ToLocalJniHandle (value); - try { - JNIEnv.SetField (((global::Java.Lang.Object) this).Handle, mylongs_jfieldId, native_value); - } finally { - JNIEnv.DeleteLocalRef (native_value); - } - } - } - internal static new IntPtr java_class_handle; - internal static new IntPtr class_ref { - get { - return JNIEnv.FindClass ("xamarin/test/SomeObject", ref java_class_handle); - } - } - - protected override IntPtr ThresholdClass { - get { return class_ref; } - } - - protected override global::System.Type ThresholdType { - get { return typeof (SomeObject); } - } - - protected SomeObject (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {} - - } -} diff --git a/tools/generator/CodeGenerationOptions.cs b/tools/generator/CodeGenerationOptions.cs index 4cf2293e1..2b40edee1 100644 --- a/tools/generator/CodeGenerationOptions.cs +++ b/tools/generator/CodeGenerationOptions.cs @@ -19,7 +19,6 @@ public CodeGenerationTarget CodeGenerationTarget { get { return codeGenerationTarget; } set { switch (value) { - case CodeGenerationTarget.XamarinAndroid: case CodeGenerationTarget.XAJavaInterop1: case CodeGenerationTarget.JavaInterop1: codeGenerationTarget = value; @@ -30,16 +29,14 @@ public CodeGenerationTarget CodeGenerationTarget { } } - internal CodeGenerator CreateCodeGenerator (TextWriter writer) + internal JavaInteropCodeGenerator CreateCodeGenerator (TextWriter writer) { switch (codeGenerationTarget) { - case CodeGenerationTarget.JavaInterop1: - return new JavaInteropCodeGenerator (writer, this); case CodeGenerationTarget.XAJavaInterop1: return new XAJavaInteropCodeGenerator (writer, this); - case CodeGenerationTarget.XamarinAndroid: + case CodeGenerationTarget.JavaInterop1: default: - return new XamarinAndroidCodeGenerator (writer, this); + return new JavaInteropCodeGenerator (writer, this); } } diff --git a/tools/generator/CodeGenerationTarget.cs b/tools/generator/CodeGenerationTarget.cs index b6b5a2826..e8624ac11 100644 --- a/tools/generator/CodeGenerationTarget.cs +++ b/tools/generator/CodeGenerationTarget.cs @@ -2,7 +2,6 @@ namespace Xamarin.Android.Binder { public enum CodeGenerationTarget { - XamarinAndroid, XAJavaInterop1, JavaInterop1, } diff --git a/tools/generator/CodeGeneratorOptions.cs b/tools/generator/CodeGeneratorOptions.cs index f8753ed04..a396b88cd 100644 --- a/tools/generator/CodeGeneratorOptions.cs +++ b/tools/generator/CodeGeneratorOptions.cs @@ -197,19 +197,12 @@ public static CodeGeneratorOptions Parse (string[] args) opts.ApiDescriptionFile = apis [0]; - if (opts.SupportDefaultInterfaceMethods && opts.CodeGenerationTarget == CodeGenerationTarget.XamarinAndroid) { - Console.Error.WriteLine (Report.FormatCodedMessage (true, Report.ErrorInvalidDIMArgument)); - return null; - } - return opts; } static CodeGenerationTarget ParseCodeGenerationTarget (string value) { switch (value.ToLowerInvariant ()) { - case "xamarinandroid": - return CodeGenerationTarget.XamarinAndroid; case "xajavainterop1": return CodeGenerationTarget.XAJavaInterop1; case "javainterop1": diff --git a/tools/generator/Java.Interop.Tools.Generator.CodeGeneration/CodeGenerator.cs b/tools/generator/Java.Interop.Tools.Generator.CodeGeneration/CodeGenerator.cs deleted file mode 100644 index 9278208f2..000000000 --- a/tools/generator/Java.Interop.Tools.Generator.CodeGeneration/CodeGenerator.cs +++ /dev/null @@ -1,1772 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.Specialized; -using System.IO; -using System.Linq; -using System.Text; -using generator.SourceWriters; -using Java.Interop.Tools.Generator; -using Xamarin.Android.Binder; - -namespace MonoDroid.Generation -{ - abstract class CodeGenerator - { - protected TextWriter writer; - protected CodeGenerationOptions opt; - - public CodeGeneratorContext Context { get; } = new CodeGeneratorContext (); - - protected CodeGenerator (TextWriter writer, CodeGenerationOptions options) - { - this.writer = writer; - opt = options; - } - - internal virtual string GetAllInterfaceImplements () => "IJavaObject"; - - internal abstract void WriteClassHandle (ClassGen type, string indent, bool requireNew); - - internal abstract void WriteClassHandle (InterfaceGen type, string indent, string declaringType); - - internal abstract void WriteClassInvokerHandle (ClassGen type, string indent, string declaringType); - internal abstract void WriteInterfaceInvokerHandle (InterfaceGen type, string indent, string declaringType); - - internal abstract void WriteConstructorIdField (Ctor ctor, string indent); - internal abstract void WriteConstructorBody (Ctor ctor, string indent, StringCollection call_cleanup); - - internal abstract void WriteMethodIdField (Method method, string indent); - internal abstract void WriteMethodBody (Method method, string indent, GenBase type); - - internal abstract void WriteFieldIdField (Field field, string indent); - internal abstract void WriteFieldGetBody (Field field, string indent, GenBase type); - internal abstract void WriteFieldSetBody (Field field, string indent, GenBase type); - - public void WriteClass (ClassGen @class, string indent, GenerationInfo gen_info) - { - Context.ContextTypes.Push (@class); - Context.ContextGeneratedMethods = new List (); - - gen_info.TypeRegistrations.Add (new KeyValuePair (@class.RawJniName, @class.AssemblyQualifiedName)); - bool is_enum = @class.base_symbol != null && @class.base_symbol.FullName == "Java.Lang.Enum"; - if (is_enum) - gen_info.Enums.Add (@class.RawJniName.Replace ('/', '.') + ":" + @class.Namespace + ":" + @class.JavaSimpleName); - StringBuilder sb = new StringBuilder (); - foreach (ISymbol isym in @class.Interfaces) { - GenericSymbol gs = isym as GenericSymbol; - InterfaceGen gen = (gs == null ? isym : gs.Gen) as InterfaceGen; - if (gen != null && (gen.IsConstSugar (opt) || gen.RawVisibility != "public")) - continue; - if (sb.Length > 0) - sb.Append (", "); - sb.Append (opt.GetOutputName (isym.FullName)); - } - - string obj_type = null; - if (@class.base_symbol != null) { - GenericSymbol gs = @class.base_symbol as GenericSymbol; - obj_type = gs != null && gs.IsConcrete ? gs.GetGenericType (null) : opt.GetOutputName (@class.base_symbol.FullName); - } - - writer.WriteLine ("{0}// Metadata.xml XPath class reference: path=\"{1}\"", indent, @class.MetadataXPathReference); - - if (@class.IsDeprecated) - writer.WriteLine ("{0}[ObsoleteAttribute (@\"{1}\")]", indent, @class.DeprecatedComment); - writer.WriteLine ("{0}[global::Android.Runtime.Register (\"{1}\", DoNotGenerateAcw=true{2})]", indent, @class.RawJniName, @class.AdditionalAttributeString ()); - if (@class.TypeParameters != null && @class.TypeParameters.Any ()) - writer.WriteLine ("{0}{1}", indent, @class.TypeParameters.ToGeneratedAttributeString ()); - string inherits = ""; - if (@class.InheritsObject && obj_type != null) { - inherits = ": " + obj_type; - } - if (sb.Length > 0) { - if (string.IsNullOrEmpty (inherits)) - inherits = ": "; - else - inherits += ", "; - } - writer.WriteLine ("{0}{1} {2}{3}{4}partial class {5} {6}{7} {{", - indent, - @class.Visibility, - @class.NeedsNew ? "new " : String.Empty, - @class.IsAbstract ? "abstract " : String.Empty, - @class.IsFinal ? "sealed " : String.Empty, - @class.Name, - inherits, - sb.ToString ()); - writer.WriteLine (); - - var seen = new HashSet (); - WriteFields (@class.Fields, indent + "\t", @class, seen); - bool haveNested = false; - foreach (var iface in @class.GetAllImplementedInterfaces () - .Except (@class.BaseGen == null - ? new InterfaceGen [0] - : @class.BaseGen.GetAllImplementedInterfaces ()) - .Where (i => i.Fields.Count > 0)) { - if (!haveNested) { - writer.WriteLine (); - writer.WriteLine ("{0}\tpublic static class InterfaceConsts {{", indent); - haveNested = true; - } - writer.WriteLine (); - writer.WriteLine ("{0}\t\t// The following are fields from: {1}", indent, iface.JavaName); - WriteFields (iface.Fields, indent + "\t\t", iface, seen); - } - - if (haveNested) { - writer.WriteLine ("{0}\t}}", indent); - writer.WriteLine (); - } - - foreach (GenBase nest in @class.NestedTypes) { - if (@class.BaseGen != null && @class.BaseGen.ContainsNestedType (nest)) - if (nest is ClassGen) - (nest as ClassGen).NeedsNew = true; - WriteType (nest, indent + "\t", gen_info); - writer.WriteLine (); - } - - // @class.InheritsObject is true unless @class refers to java.lang.Object or java.lang.Throwable. (see ClassGen constructor) - // If @class's base class is defined in the same api.xml file, then it requires the new keyword to overshadow the internal - // members of its baseclass since the two classes will be defined in the same assembly. If the base class is not from the - // same api.xml file, the new keyword is not needed because the internal access modifier already prevents it from being seen. - bool baseFromSameAssembly = @class?.BaseGen?.FromXml ?? false; - bool requireNew = @class.InheritsObject && baseFromSameAssembly; - WriteClassHandle (@class, indent, requireNew); - - WriteClassConstructors (@class, indent + "\t"); - - WriteImplementedProperties (@class.Properties, indent + "\t", @class.IsFinal, @class); - WriteClassMethods (@class, indent + "\t"); - - if (@class.IsAbstract) - WriteClassAbstractMembers (@class, indent + "\t"); - - bool is_char_seq = false; - foreach (ISymbol isym in @class.Interfaces) { - if (isym is GenericSymbol) { - GenericSymbol gs = isym as GenericSymbol; - if (gs.IsConcrete) { - // FIXME: not sure if excluding default methods is a valid idea... - foreach (Method m in gs.Gen.Methods) { - if (m.IsInterfaceDefaultMethod || m.IsStatic) - continue; - if (m.IsGeneric) - WriteMethodExplicitIface (m, indent + "\t", gs); - } - - var adapter = gs.Gen.AssemblyQualifiedName + "Invoker"; - foreach (Property p in gs.Gen.Properties) { - if (p.Getter != null) { - if (p.Getter.IsInterfaceDefaultMethod || p.Getter.IsStatic) - continue; - } - if (p.Setter != null) { - if (p.Setter.IsInterfaceDefaultMethod || p.Setter.IsStatic) - continue; - } - if (p.IsGeneric) - WritePropertyExplicitInterface (p, indent + "\t", gs, adapter); - } - } - } else if (isym.FullName == "Java.Lang.ICharSequence") - is_char_seq = true; - } - - if (is_char_seq) - WriteCharSequenceEnumerator (indent + "\t"); - - writer.WriteLine (indent + "}"); - - if (!@class.AssemblyQualifiedName.Contains ('/')) { - foreach (InterfaceExtensionInfo nestedIface in @class.GetNestedInterfaceTypes ()) - WriteInterfaceExtensionsDeclaration (nestedIface.Type, indent, nestedIface.DeclaringType); - } - - if (@class.IsAbstract) { - writer.WriteLine (); - WriteClassInvoker (@class, indent); - } - - Context.ContextGeneratedMethods.Clear (); - - Context.ContextTypes.Pop (); - } - - public void WriteClassAbstractMembers (ClassGen @class, string indent) - { - foreach (InterfaceGen gen in @class.GetAllDerivedInterfaces ()) - WriteInterfaceAbstractMembers (gen, @class, indent); - } - - public void WriteClassConstructors (ClassGen @class, string indent) - { - if (@class.FullName != "Java.Lang.Object" && @class.InheritsObject) { - writer.WriteLine ("{0}{1} {2} (IntPtr javaReference, JniHandleOwnership transfer) : base (javaReference, transfer) {{}}", indent, @class.IsFinal ? "internal" : "protected", @class.Name); - writer.WriteLine (); - } - - foreach (Ctor ctor in @class.Ctors) { - if (@class.IsFinal && ctor.Visibility == "protected") - continue; - ctor.Name = @class.Name; - WriteConstructor (ctor, indent, @class.InheritsObject, @class); - } - } - - public void WriteClassInvoker (ClassGen @class, string indent) - { - StringBuilder sb = new StringBuilder (); - foreach (InterfaceGen igen in @class.GetAllDerivedInterfaces ()) - if (igen.IsGeneric) - sb.Append (", " + opt.GetOutputName (igen.FullName)); - writer.WriteLine ("{0}[global::Android.Runtime.Register (\"{1}\", DoNotGenerateAcw=true{2})]", indent, @class.RawJniName, @class.AdditionalAttributeString ()); - writer.WriteLine ("{0}internal partial class {1}Invoker : {1}{2} {{", indent, @class.Name, sb.ToString ()); - writer.WriteLine (); - writer.WriteLine ("{0}\tpublic {1}Invoker (IntPtr handle, JniHandleOwnership transfer) : base (handle, transfer) {{}}", indent, @class.Name); - writer.WriteLine (); - WriteClassInvokerHandle (@class, indent + "\t", @class.Name + "Invoker"); - - HashSet members = new HashSet (); - WriteClassInvokerMembers (@class, indent + "\t", members); - writer.WriteLine ("{0}}}", indent); - writer.WriteLine (); - } - - public void WriteClassInvokerMembers (ClassGen @class, string indent, HashSet members) - { - WriteClassPropertyInvokers (@class, @class.Properties, indent, members); - WriteClassMethodInvokers (@class, @class.Methods, indent, members, null); - - foreach (InterfaceGen iface in @class.GetAllDerivedInterfaces ()) { - // if (iface.IsGeneric) - // continue; - WriteClassPropertyInvokers (@class, iface.Properties.Where (p => !@class.ContainsProperty (p.Name, false, false)), indent, members); - WriteClassMethodInvokers (@class, iface.Methods.Where (m => (opt.SupportDefaultInterfaceMethods || !m.IsInterfaceDefaultMethod) && !@class.ContainsMethod (m, false, false) && !@class.IsCovariantMethod (m) && !@class.ExplicitlyImplementedInterfaceMethods.Contains (m.GetSignature ())), indent, members, iface); - } - - if (@class.BaseGen != null && @class.BaseGen.FullName != "Java.Lang.Object") - WriteClassInvokerMembers (@class.BaseGen, indent, members); - } - - public void WriteClassMethodInvokers (ClassGen @class, IEnumerable methods, string indent, HashSet members, InterfaceGen gen) - { - foreach (Method m in methods) { - string sig = m.GetSignature (); - if (members.Contains (sig)) - continue; - members.Add (sig); - if (!m.IsAbstract) - continue; - if (@class.IsExplicitlyImplementedMethod (sig)) { - // sw.WriteLine ("// This invoker explicitly implements this method"); - WriteMethodExplicitInterfaceInvoker (m, indent, gen); - } else { - // sw.WriteLine ("// This invoker overrides {0} method", gen.FullName); - m.IsOverride = true; - WriteMethod (m, indent, @class, false); - m.IsOverride = false; - } - } - } - - public void WriteClassMethods (ClassGen @class, string indent) - { - var methodsToDeclare = @class.Methods.AsEnumerable (); - - // This does not exclude overrides (unlike virtual methods) because we're not sure - // if calling the base interface default method via JNI expectedly dispatches to - // the derived method. - var defaultMethods = @class.GetAllDerivedInterfaces () - .SelectMany (i => i.Methods) - .Where (m => m.IsInterfaceDefaultMethod) - .Where (m => !@class.ContainsMethod (m, false, false)); - var overrides = defaultMethods.Where (m => m.OverriddenInterfaceMethod != null); - - var overridens = defaultMethods.Where (m => overrides.Where (_ => _.Name == m.Name && _.JniSignature == m.JniSignature) - .Any (mm => mm.DeclaringType.GetAllDerivedInterfaces ().Contains (m.DeclaringType))); - - methodsToDeclare = opt.SupportDefaultInterfaceMethods ? methodsToDeclare : methodsToDeclare.Concat (defaultMethods.Except (overridens)).Where (m => m.DeclaringType.IsGeneratable); - - foreach (var m in methodsToDeclare) { - bool virt = m.IsVirtual; - m.IsVirtual = !@class.IsFinal && virt; - if (m.IsAbstract && m.OverriddenInterfaceMethod == null && (opt.SupportDefaultInterfaceMethods || !m.IsInterfaceDefaultMethod)) - WriteMethodAbstractDeclaration (m, indent, null, @class); - else - WriteMethod (m, indent, @class, true); - Context.ContextGeneratedMethods.Add (m); - m.IsVirtual = virt; - } - - var methods = @class.Methods.Concat (@class.Properties.Where (p => p.Setter != null).Select (p => p.Setter)); - foreach (InterfaceGen type in methods.Where (m => m.IsListenerConnector && m.EventName != String.Empty).Select (m => m.ListenerType).Distinct ()) { - writer.WriteLine ("#region \"Event implementation for {0}\"", type.FullName); - WriteInterfaceListenerEventsAndProperties (type, indent, @class); - writer.WriteLine ("#endregion"); - } - } - - public void WriteImplementedProperties (IEnumerable targetProperties, string indent, bool isFinal, GenBase gen) - { - foreach (var prop in targetProperties) { - bool get_virt = prop.Getter.IsVirtual; - bool set_virt = prop.Setter == null ? false : prop.Setter.IsVirtual; - prop.Getter.IsVirtual = !isFinal && get_virt; - if (prop.Setter != null) - prop.Setter.IsVirtual = !isFinal && set_virt; - if (prop.Getter.IsAbstract) - WritePropertyAbstractDeclaration (prop, indent, gen); - else - WriteProperty (prop, gen, indent); - prop.Getter.IsVirtual = get_virt; - if (prop.Setter != null) - prop.Setter.IsVirtual = set_virt; - } - } - - public void WriteClassPropertyInvokers (ClassGen @class, IEnumerable properties, string indent, HashSet members) - { - foreach (Property prop in properties) { - if (members.Contains (prop.Name)) - continue; - members.Add (prop.Name); - if ((prop.Getter != null && !prop.Getter.IsAbstract) || - (prop.Setter != null && !prop.Setter.IsAbstract)) - continue; - - WriteProperty (prop, @class, indent, false, true); - } - } - - internal void WriteCharSequenceEnumerator (string indent) - { - writer.WriteLine ("{0}System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator ()", indent); - writer.WriteLine ("{0}{{", indent); - writer.WriteLine ("{0}\treturn GetEnumerator ();", indent); - writer.WriteLine ("{0}}}", indent); - writer.WriteLine (); - writer.WriteLine ("{0}public System.Collections.Generic.IEnumerator GetEnumerator ()", indent); - writer.WriteLine ("{0}{{", indent); - writer.WriteLine ("{0}\tfor (int i = 0; i < Length(); i++)", indent); - writer.WriteLine ("{0}\t\tyield return CharAt (i);", indent); - writer.WriteLine ("{0}}}", indent); - writer.WriteLine (); - } - - internal virtual void WriteConstructor (Ctor constructor, string indent, bool useBase, ClassGen type) - { - string jni_sig = constructor.JniSignature; - bool gen_string_overload = constructor.Parameters.HasCharSequence && !type.ContainsCtor (jni_sig.Replace ("java/lang/CharSequence", "java/lang/String")); - System.Collections.Specialized.StringCollection call_cleanup = constructor.Parameters.GetCallCleanup (opt); - WriteConstructorIdField (constructor, indent); - writer.WriteLine ("{0}// Metadata.xml XPath constructor reference: path=\"{1}/constructor[@name='{2}'{3}]\"", indent, type.MetadataXPathReference, type.JavaSimpleName, constructor.Parameters.GetMethodXPathPredicate ()); - writer.WriteLine ("{0}[Register (\"{1}\", \"{2}\", \"{3}\"{4})]", indent, ".ctor", jni_sig, String.Empty, constructor.AdditionalAttributeString ()); - if (constructor.Deprecated != null) - writer.WriteLine ("{0}[Obsolete (@\"{1}\")]", indent, constructor.Deprecated.Replace ("\"", "\"\"")); - - if (constructor.CustomAttributes != null) - writer.WriteLine ("{0}{1}", indent, constructor.CustomAttributes); - if (constructor.Annotation != null) - writer.WriteLine ("{0}{1}", indent, constructor.Annotation); - - writer.WriteLine ("{0}{1} unsafe {2} ({3})", indent, constructor.Visibility, constructor.Name, constructor.GetSignature (opt)); - writer.WriteLine ("{0}\t: {1} (IntPtr.Zero, JniHandleOwnership.DoNotTransfer)", indent, useBase ? "base" : "this"); - writer.WriteLine ("{0}{{", indent); - WriteConstructorBody (constructor, indent + "\t", call_cleanup); - writer.WriteLine ("{0}}}", indent); - writer.WriteLine (); - if (gen_string_overload) { - writer.WriteLine ("{0}[Register (\"{1}\", \"{2}\", \"{3}\"{4})]", indent, ".ctor", jni_sig, String.Empty, constructor.AdditionalAttributeString ()); - writer.WriteLine ("{0}{1} unsafe {2} ({3})", indent, constructor.Visibility, constructor.Name, constructor.GetSignature (opt).Replace ("Java.Lang.ICharSequence", "string").Replace ("global::string", "string")); - writer.WriteLine ("{0}\t: {1} (IntPtr.Zero, JniHandleOwnership.DoNotTransfer)", indent, useBase ? "base" : "this"); - writer.WriteLine ("{0}{{", indent); - WriteConstructorBody (constructor, indent + "\t", call_cleanup); - writer.WriteLine ("{0}}}", indent); - writer.WriteLine (); - } - } - - public bool WriteFields (List fields, string indent, GenBase gen, HashSet seen = null) - { - bool needsProperty = false; - foreach (Field f in fields) { - if (gen.ContainsName (f.Name)) { - Report.LogCodedWarning (0, SourceWriterExtensions.GetFieldCollisionMessage (gen, f), f, gen.FullName, f.Name, gen.JavaName); - continue; - } - if (seen != null && seen.Contains (f.Name)) { - Report.LogCodedWarning (0, Report.WarningDuplicateField, f, gen.FullName, f.Name, gen.JavaName); - continue; - } - if (f.Validate (opt, gen.TypeParameters, Context)) { - if (seen != null) - seen.Add (f.Name); - needsProperty = needsProperty || f.NeedsProperty; - writer.WriteLine (); - WriteField (f, indent, gen); - } - } - return needsProperty; - } - - internal virtual void WriteField (Field field, string indent, GenBase type) - { - if (field.IsEnumified) - writer.WriteLine ("[global::Android.Runtime.GeneratedEnum]"); - if (field.NeedsProperty) { - string fieldType = field.Symbol.IsArray ? "IList<" + field.Symbol.ElementType + ">" + opt.NullableOperator : opt.GetTypeReferenceName (field); - WriteFieldIdField (field, indent); - writer.WriteLine (); - writer.WriteLine ("{0}// Metadata.xml XPath field reference: path=\"{1}/field[@name='{2}']\"", indent, type.MetadataXPathReference, field.JavaName); - writer.WriteLine ("{0}[Register (\"{1}\"{2})]", indent, field.JavaName, field.AdditionalAttributeString ()); - if (field.IsDeprecated) { - var deprecatedError = field.IsDeprecatedError ? ", error: true" : string.Empty; - writer.WriteLine ("{0}[Obsolete (\"{1}\"{2})]", indent, field.DeprecatedComment, deprecatedError); - } - writer.WriteLine ("{0}{1} {2}{3} {4} {{", indent, field.Visibility, field.IsStatic ? "static " : String.Empty, fieldType, field.Name); - writer.WriteLine ("{0}\tget {{", indent); - WriteFieldGetBody (field, indent + "\t\t", type); - writer.WriteLine ("{0}\t}}", indent); - - if (!field.IsConst) { - writer.WriteLine ("{0}\tset {{", indent); - WriteFieldSetBody (field, indent + "\t\t", type); - writer.WriteLine ("{0}\t}}", indent); - } - writer.WriteLine ("{0}}}", indent); - } else { - writer.WriteLine ("{0}// Metadata.xml XPath field reference: path=\"{1}/field[@name='{2}']\"", indent, type.MetadataXPathReference, field.JavaName); - writer.WriteLine ("{0}[Register (\"{1}\"{2})]", indent, field.JavaName, field.AdditionalAttributeString ()); - if (field.IsDeprecated) { - var deprecatedError = field.IsDeprecatedError ? ", error: true" : string.Empty; - writer.WriteLine ("{0}[Obsolete (\"{1}\"{2})]", indent, field.DeprecatedComment, deprecatedError); - } - if (field.Annotation != null) - writer.WriteLine ("{0}{1}", indent, field.Annotation); - - // the Value complication is due to constant enum from negative integer value (C# compiler requires explicit parenthesis). - writer.WriteLine ("{0}{1} const {2} {3} = ({2}) {4};", indent, field.Visibility, opt.GetOutputName (field.Symbol.FullName), field.Name, field.Value.Contains ('-') && field.Symbol.FullName.Contains ('.') ? '(' + field.Value + ')' : field.Value); - } - } - - public void WriteInterface (InterfaceGen @interface, string indent, GenerationInfo gen_info) - { - Context.ContextTypes.Push (@interface); - - // Generate sibling types for nested types we don't want to nest - foreach (var nest in @interface.NestedTypes.Where (t => t.Unnest)) { - WriteType (nest, indent, gen_info); - writer.WriteLine (); - } - - WriteInterfaceImplementedMembersAlternative (@interface, indent); - - // If this interface is just fields and we can't generate any of them - // then we don't need to write the interface - if (@interface.IsConstSugar (opt) && @interface.GetGeneratableFields (opt).Count () == 0) - return; - - WriteInterfaceDeclaration (@interface, indent, gen_info); - - // If this interface is just constant fields we don't need to write all the invoker bits - if (@interface.IsConstSugar (opt)) - return; - - if (!@interface.AssemblyQualifiedName.Contains ('/')) - WriteInterfaceExtensionsDeclaration (@interface, indent, null); - WriteInterfaceInvoker (@interface, indent); - WriteInterfaceEventHandler (@interface, indent); - Context.ContextTypes.Pop (); - } - - // For each interface, generate either an abstract method or an explicit implementation method. - public void WriteInterfaceAbstractMembers (InterfaceGen @interface, ClassGen gen, string indent) - { - foreach (var m in @interface.Methods.Where (m => !m.IsInterfaceDefaultMethod && !m.IsStatic)) { - bool mapped = false; - string sig = m.GetSignature (); - if (Context.ContextGeneratedMethods.Any (_ => _.Name == m.Name && _.JniSignature == m.JniSignature)) - continue; - for (var cls = gen; cls != null; cls = cls.BaseGen) - if (cls.ContainsMethod (m, false) || cls != gen && gen.ExplicitlyImplementedInterfaceMethods.Contains (sig)) { - mapped = true; - break; - } - if (mapped) - continue; - if (gen.ExplicitlyImplementedInterfaceMethods.Contains (sig)) - WriteMethodExplicitInterfaceImplementation (m, indent, @interface); - else - WriteMethodAbstractDeclaration (m, indent, @interface, gen); - Context.ContextGeneratedMethods.Add (m); - } - foreach (var prop in @interface.Properties.Where (p => !p.Getter.IsInterfaceDefaultMethod && !p.Getter.IsStatic)) { - if (gen.ContainsProperty (prop.Name, false)) - continue; - WritePropertyAbstractDeclaration (prop, indent, gen); - } - } - - public void WriteInterfaceDeclaration (InterfaceGen @interface, string indent, GenerationInfo gen_info) - { - StringBuilder sb = new StringBuilder (); - foreach (ISymbol isym in @interface.Interfaces) { - InterfaceGen igen = (isym is GenericSymbol ? (isym as GenericSymbol).Gen : isym) as InterfaceGen; - if (igen.IsConstSugar (opt) || igen.RawVisibility != "public") - continue; - if (sb.Length > 0) - sb.Append (", "); - sb.Append (opt.GetOutputName (isym.FullName)); - } - - writer.WriteLine ("{0}// Metadata.xml XPath interface reference: path=\"{1}\"", indent, @interface.MetadataXPathReference); - - if (@interface.IsDeprecated) - writer.WriteLine ("{0}[ObsoleteAttribute (@\"{1}\")]", indent, @interface.DeprecatedComment); - - if (!@interface.IsConstSugar (opt)) { - var signature = string.IsNullOrWhiteSpace (@interface.Namespace) - ? @interface.FullName.Replace ('.', '/') - : @interface.Namespace + "." + @interface.FullName.Substring (@interface.Namespace.Length + 1).Replace ('.', '/'); - - writer.WriteLine ("{0}[Register (\"{1}\", \"\", \"{2}\"{3})]", indent, @interface.RawJniName, signature + "Invoker", @interface.AdditionalAttributeString ()); - } - - if (@interface.TypeParameters != null && @interface.TypeParameters.Any ()) - writer.WriteLine ("{0}{1}", indent, @interface.TypeParameters.ToGeneratedAttributeString ()); - writer.WriteLine ("{0}{1} partial interface {2}{3} {{", indent, @interface.Visibility, @interface.Name, - @interface.IsConstSugar (opt) ? string.Empty : @interface.Interfaces.Count == 0 || sb.Length == 0 ? " : " + GetAllInterfaceImplements () : " : " + sb.ToString ()); - - if (opt.SupportDefaultInterfaceMethods && (@interface.HasDefaultMethods || @interface.HasStaticMethods)) - WriteClassHandle (@interface, indent + "\t", @interface.Name); - - WriteInterfaceFields (@interface, indent + "\t"); - writer.WriteLine (); - WriteInterfaceProperties (@interface, indent + "\t"); - WriteInterfaceMethods (@interface, indent + "\t"); - - // Generate nested types for supported nested types - foreach (var nest in @interface.NestedTypes.Where (t => !t.Unnest)) { - WriteType (nest, indent + "\t", gen_info); - writer.WriteLine (); - } - - writer.WriteLine (indent + "}"); - writer.WriteLine (); - } - - public void WriteInterfaceExtensionMethods (InterfaceGen @interface, string indent) - { - foreach (Method m in @interface.Methods.Where (m => !m.IsStatic)) { - WriteMethodExtensionOverload (m, indent, @interface.FullName); - WriteMethodExtensionAsyncWrapper (m, indent, @interface.FullName); - } - } - - public void WriteInterfaceEventArgs (InterfaceGen @interface, Method m, string indent) - { - string args_name = @interface.GetArgsName (m); - if (m.RetVal.IsVoid || m.IsEventHandlerWithHandledProperty) { - if (!m.IsSimpleEventHandler || m.IsEventHandlerWithHandledProperty) { - writer.WriteLine ("{0}// event args for {1}.{2}", indent, @interface.JavaName, m.JavaName); - writer.WriteLine ("{0}public partial class {1} : global::System.EventArgs {{", indent, args_name); - writer.WriteLine (); - var signature = m.Parameters.GetSignatureDropSender (opt); - writer.WriteLine ("{0}\tpublic {1} ({2}{3}{4})", indent, args_name, - m.IsEventHandlerWithHandledProperty ? "bool handled" : "", - (m.IsEventHandlerWithHandledProperty && signature.Length != 0) ? ", " : "", - signature); - writer.WriteLine ("{0}\t{{", indent); - if (m.IsEventHandlerWithHandledProperty) - writer.WriteLine ("{0}\t\tthis.handled = handled;", indent); - foreach (Parameter p in m.Parameters) - if (!p.IsSender) - writer.WriteLine ("{0}\t\tthis.{1} = {1};", indent, opt.GetSafeIdentifier (p.Name)); - writer.WriteLine ("{0}\t}}", indent); - if (m.IsEventHandlerWithHandledProperty) { - writer.WriteLine (); - writer.WriteLine ("{0}\tbool handled;", indent); - writer.WriteLine ("{0}\tpublic bool Handled {{", indent); - writer.WriteLine ("{0}\t\tget {{ return handled; }}", indent); - writer.WriteLine ("{0}\t\tset {{ handled = value; }}", indent); - writer.WriteLine ("{0}\t}}", indent); - } - foreach (Parameter p in m.Parameters) { - if (p.IsSender) - continue; - writer.WriteLine (); - - // Remove "params" from things like "global::Java.Lang.Object[]" - var type_reference_name = opt.GetTypeReferenceName (p); - type_reference_name = type_reference_name.StartsWith ("params ", StringComparison.Ordinal) ? type_reference_name.Substring ("params ".Length) : type_reference_name; - - writer.WriteLine ("{0}\t{1} {2};", indent, type_reference_name, opt.GetSafeIdentifier (p.Name)); - // AbsListView.IMultiChoiceModeListener.onItemCheckedStateChanged() hit this strict name check, at parameter "@checked". - writer.WriteLine ("{0}\tpublic {1} {2} {{", indent, type_reference_name, p.PropertyName); - writer.WriteLine ("{0}\t\tget {{ return {1}; }}", indent, opt.GetSafeIdentifier (p.Name)); - writer.WriteLine ("{0}\t}}", indent); - } - writer.WriteLine ("{0}}}", indent); - writer.WriteLine (); - } - } else { - writer.WriteLine ("{0}public delegate {1} {2} ({3});", indent, opt.GetTypeReferenceName (m.RetVal), @interface.GetEventDelegateName (m), m.GetSignature (opt)); - writer.WriteLine (); - } - } - - public void WriteInterfaceEventHandler (InterfaceGen @interface, string indent) - { - if (!@interface.IsListener) - return; - //Method m = Methods [0]; - foreach (var method in @interface.Methods.Where (m => m.EventName != string.Empty)) - WriteInterfaceEventArgs (@interface, method, indent); - WriteInterfaceEventHandlerImpl (@interface, indent); - } - - public void WriteInterfaceEventHandlerImpl (InterfaceGen @interface, string indent) - { - string jniClass = "mono/" + @interface.RawJniName.Replace ('$', '_') + "Implementor"; - writer.WriteLine ("{0}[global::Android.Runtime.Register (\"{1}\"{2})]", indent, jniClass, @interface.AdditionalAttributeString ()); - writer.WriteLine ("{0}internal sealed partial class {1}Implementor : global::Java.Lang.Object, {1} {{", indent, @interface.Name); - bool needs_sender = @interface.NeedsSender; - if (needs_sender) { - writer.WriteLine (); - writer.WriteLine ("{0}\tobject sender;", indent); - } - writer.WriteLine (); - writer.WriteLine ("{0}\tpublic {1}Implementor ({2})", indent, @interface.Name, needs_sender ? "object sender" : ""); - writer.WriteLine ("{0}\t\t: base (", indent); - writer.WriteLine ("{0}\t\t\tglobal::Android.Runtime.JNIEnv.StartCreateInstance (\"{1}\", \"()V\"),", indent, jniClass); - writer.WriteLine ("{0}\t\t\tJniHandleOwnership.TransferLocalRef)", indent); - writer.WriteLine ("{0}\t{{", indent); - writer.WriteLine ("{0}\t\tglobal::Android.Runtime.JNIEnv.FinishCreateInstance ({1}, \"()V\");", indent, @interface.GetObjectHandleProperty (opt, "this")); - if (needs_sender) - writer.WriteLine ("{0}\t\tthis.sender = sender;", indent); - writer.WriteLine ("{0}\t}}", indent); - writer.WriteLine (); - var handlers = new List (); - foreach (var m in @interface.Methods) - WriteInterfaceEventHandlerImplContent (@interface, m, indent, needs_sender, jniClass, handlers); - writer.WriteLine (); - writer.WriteLine ("{0}\tinternal static bool __IsEmpty ({1}Implementor value)", indent, @interface.Name); - writer.WriteLine ("{0}\t{{", indent); - if (!@interface.Methods.Any (m => m.EventName != string.Empty) || handlers.Count == 0) - writer.WriteLine ("{0}\t\treturn true;", indent); - else - writer.WriteLine ("{0}\t\treturn {1};", indent, - string.Join (" && ", handlers.Select (e => string.Format ("value.{0}Handler == null", e)))); - writer.WriteLine ("{0}\t}}", indent); - writer.WriteLine ("{0}}}", indent); - writer.WriteLine (); - } - - public void WriteInterfaceEventHandlerImplContent (InterfaceGen @interface, Method m, string indent, bool needs_sender, string jniClass, List handlers) - { - string methodSpec = @interface.Methods.Count > 1 ? m.AdjustedName : String.Empty; - handlers.Add (methodSpec); - string args_name = @interface.GetArgsName (m); - if (m.EventName != string.Empty) { - writer.WriteLine ("#pragma warning disable 0649"); - writer.WriteLine ("{0}\tpublic {1}{3} {2}Handler;", indent, @interface.GetEventDelegateName (m), methodSpec, opt.NullableOperator); - writer.WriteLine ("#pragma warning restore 0649"); - } - writer.WriteLine (); - writer.WriteLine ("{0}\tpublic {1} {2} ({3})", indent, opt.GetTypeReferenceName (m.RetVal), m.Name, m.GetSignature (opt)); - writer.WriteLine ("{0}\t{{", indent); - if (m.EventName == string.Empty) { - // generate nothing - } else if (m.IsVoid) { - writer.WriteLine ("{0}\t\tvar __h = {1}Handler;", indent, methodSpec); - writer.WriteLine ("{0}\t\tif (__h != null)", indent); - writer.WriteLine ("{0}\t\t\t__h ({1}, new {2} ({3}));", indent, needs_sender ? "sender" : m.Parameters.SenderName, args_name, m.Parameters.CallDropSender); - } else if (m.IsEventHandlerWithHandledProperty) { - writer.WriteLine ("{0}\t\tvar __h = {1}Handler;", indent, methodSpec); - writer.WriteLine ("{0}\t\tif (__h == null)", indent); - writer.WriteLine ("{0}\t\t\treturn {1};", indent, m.RetVal.DefaultValue); - var call = m.Parameters.CallDropSender; - writer.WriteLine ("{0}\t\tvar __e = new {1} (true{2}{3});", indent, args_name, - call.Length != 0 ? ", " : "", - call); - writer.WriteLine ("{0}\t\t__h ({1}, __e);", indent, needs_sender ? "sender" : m.Parameters.SenderName); - writer.WriteLine ("{0}\t\treturn __e.Handled;", indent); - } else { - writer.WriteLine ("{0}\t\tvar __h = {1}Handler;", indent, methodSpec); - writer.WriteLine ("{0}\t\treturn __h != null ? __h ({1}) : default ({2});", indent, m.Parameters.GetCall (opt), opt.GetTypeReferenceName (m.RetVal)); - } - writer.WriteLine ("{0}\t}}", indent); - } - - public void WriteInterfaceExtensionsDeclaration (InterfaceGen @interface, string indent, string declaringTypeName) - { - if (!@interface.Methods.Any (m => m.CanHaveStringOverload) && !@interface.Methods.Any (m => m.Asyncify)) - return; - - writer.WriteLine ("{0}public static partial class {1}{2}Extensions {{", indent, declaringTypeName, @interface.Name); - WriteInterfaceExtensionMethods (@interface, indent + "\t"); - writer.WriteLine (indent + "}"); - writer.WriteLine (); - } - - public void WriteInterfaceFields (InterfaceGen iface, string indent) - { - // Interface fields are only supported with DIM - if (!opt.SupportInterfaceConstants) - return; - - var seen = new HashSet (); - var fields = iface.GetGeneratableFields (opt).ToList (); - - WriteFields (fields, indent, iface, seen); - } - - public void WriteInterfaceImplementedMembersAlternative (InterfaceGen @interface, string indent) - { - // Historically .NET has not allowed interface implemented fields or constants, so we - // initially worked around that by moving them to an abstract class, generally - // IMyInterface -> MyInterfaceConsts - // This was later expanded to accomodate static interface methods, creating a more appropriately named class - // IMyInterface -> MyInterface - // In this case the XXXConsts class is [Obsolete]'d and simply inherits from the newer class - // in order to maintain backward compatibility. - // If we're creating a binding that supports DIM, we remove the XXXConsts class as they've been - // [Obsolete:iserror] for a long time, and we add [Obsolete] to the interface "class". - - // Bail if requested we not produce alternative classes for this interface - if (@interface.NoAlternatives) - return; - - var staticMethods = @interface.Methods.Where (m => m.IsStatic); - var should_obsolete = opt.SupportInterfaceConstants && opt.SupportDefaultInterfaceMethods; - - if (@interface.Fields.Any () || staticMethods.Any ()) { - string name = @interface.HasManagedName - ? @interface.Name.Substring (1) + "Consts" - : @interface.Name.Substring (1); - writer.WriteLine ("{0}[Register (\"{1}\"{2}, DoNotGenerateAcw=true)]", indent, @interface.RawJniName, @interface.AdditionalAttributeString ()); - - if (should_obsolete) - writer.WriteLine ("{0}[global::System.Obsolete (\"Use the '{1}' type. This class will be removed in a future release.\")]", indent, @interface.FullName); - - writer.WriteLine ("{0}public abstract class {1} : Java.Lang.Object {{", indent, name); - writer.WriteLine (); - writer.WriteLine ("{0}\tinternal {1} ()", indent, name); - writer.WriteLine ("{0}\t{{", indent); - writer.WriteLine ("{0}\t}}", indent); - - var seen = new HashSet (); - - var original_fields = DeprecateFields (@interface, should_obsolete); - bool needsClassRef = WriteFields (@interface.Fields, indent + "\t", @interface, seen) || staticMethods.Any (); - RestoreDeprecatedFields (original_fields); - - foreach (var iface in @interface.GetAllImplementedInterfaces ().OfType ()) { - writer.WriteLine (); - writer.WriteLine ("{0}\t// The following are fields from: {1}", indent, iface.JavaName); - original_fields = DeprecateFields (iface, should_obsolete); - bool v = WriteFields (iface.Fields, indent + "\t", iface, seen); - RestoreDeprecatedFields (original_fields); - needsClassRef = needsClassRef || v; - } - - foreach (var m in @interface.Methods.Where (m => m.IsStatic)) { - var original = m.Deprecated; - - if (should_obsolete && string.IsNullOrWhiteSpace (m.Deprecated)) - m.Deprecated = $"Use '{@interface.FullName}.{m.AdjustedName}'. This class will be removed in a future release."; - - WriteMethod (m, indent + "\t", @interface, true); - - m.Deprecated = original; - } - - if (needsClassRef) { - writer.WriteLine (); - WriteClassHandle (@interface, indent + "\t", name); - } - - writer.WriteLine ("{0}}}", indent, @interface.Name); - writer.WriteLine (); - - if (!@interface.HasManagedName && !opt.SupportInterfaceConstants) { - writer.WriteLine ("{0}[Register (\"{1}\"{2}, DoNotGenerateAcw=true)]", indent, @interface.RawJniName, @interface.AdditionalAttributeString ()); - writer.WriteLine ("{0}[global::System.Obsolete (\"Use the '{1}' type. This type will be removed in a future release.\", error: true)]", indent, name); - writer.WriteLine ("{0}public abstract class {1}Consts : {1} {{", indent, name); - writer.WriteLine (); - writer.WriteLine ("{0}\tprivate {1}Consts ()", indent, name); - writer.WriteLine ("{0}\t{{", indent); - writer.WriteLine ("{0}\t}}", indent); - writer.WriteLine ("{0}}}", indent); - writer.WriteLine (); - } - } - } - - List<(Field field, bool deprecated, string comment)> DeprecateFields (InterfaceGen iface, bool shouldObsolete) - { - var original_fields = iface.Fields.Select (f => (f, f.IsDeprecated, f.DeprecatedComment)).ToList (); - - if (!shouldObsolete) - return original_fields; - - foreach (var f in iface.Fields) { - // Only use this derprecation if it's not already deprecated for another reason - if (!f.IsDeprecated) { - f.IsDeprecated = true; - f.DeprecatedComment = $"Use '{iface.FullName}.{f.Name}'. This class will be removed in a future release."; ; - } - } - - return original_fields; - } - - void RestoreDeprecatedFields (List<(Field field, bool deprecated, string comment)> fields) - { - foreach (var tuple in fields) { - tuple.field.IsDeprecated = tuple.deprecated; - tuple.field.DeprecatedComment = tuple.comment; - } - } - - public void WriteInterfaceInvoker (InterfaceGen @interface, string indent) - { - writer.WriteLine ("{0}[global::Android.Runtime.Register (\"{1}\", DoNotGenerateAcw=true{2})]", indent, @interface.RawJniName, @interface.AdditionalAttributeString ()); - writer.WriteLine ("{0}internal partial class {1}Invoker : global::Java.Lang.Object, {1} {{", indent, @interface.Name); - writer.WriteLine (); - WriteInterfaceInvokerHandle (@interface, indent + "\t", @interface.Name + "Invoker"); - writer.WriteLine ("{0}\t{1}IntPtr class_ref;", indent, opt.BuildingCoreAssembly ? "new " : ""); - writer.WriteLine (); - writer.WriteLine ("{0}\tpublic static {1}{2} GetObject (IntPtr handle, JniHandleOwnership transfer)", indent, @interface.Name, opt.NullableOperator); - writer.WriteLine ("{0}\t{{", indent); - writer.WriteLine ("{0}\t\treturn global::Java.Lang.Object.GetObject<{1}> (handle, transfer);", indent, @interface.Name); - writer.WriteLine ("{0}\t}}", indent); - writer.WriteLine (); - writer.WriteLine ("{0}\tstatic IntPtr Validate (IntPtr handle)", indent); - writer.WriteLine ("{0}\t{{", indent); - writer.WriteLine ("{0}\t\tif (!JNIEnv.IsInstanceOf (handle, java_class_ref))", indent); - writer.WriteLine ("{0}\t\t\tthrow new InvalidCastException (string.Format (\"Unable to convert instance of type '{{0}}' to type '{{1}}'.\",", indent); - writer.WriteLine ("{0}\t\t\t\t\t\tJNIEnv.GetClassNameFromInstance (handle), \"{1}\"));", indent, @interface.JavaName); - writer.WriteLine ("{0}\t\treturn handle;", indent); - writer.WriteLine ("{0}\t}}", indent); - writer.WriteLine (); - writer.WriteLine ("{0}\tprotected override void Dispose (bool disposing)", indent); - writer.WriteLine ("{0}\t{{", indent); - writer.WriteLine ("{0}\t\tif (this.class_ref != IntPtr.Zero)", indent); - writer.WriteLine ("{0}\t\t\tJNIEnv.DeleteGlobalRef (this.class_ref);", indent); - writer.WriteLine ("{0}\t\tthis.class_ref = IntPtr.Zero;", indent); - writer.WriteLine ("{0}\t\tbase.Dispose (disposing);", indent); - writer.WriteLine ("{0}\t}}", indent); - writer.WriteLine (); - writer.WriteLine ("{0}\tpublic {1}Invoker (IntPtr handle, JniHandleOwnership transfer) : base (Validate (handle), transfer)", indent, @interface.Name); - writer.WriteLine ("{0}\t{{", indent); - writer.WriteLine ("{0}\t\tIntPtr local_ref = JNIEnv.GetObjectClass ({1});", indent, Context.ContextType.GetObjectHandleProperty (opt, "this")); - writer.WriteLine ("{0}\t\tthis.class_ref = JNIEnv.NewGlobalRef (local_ref);", indent); - writer.WriteLine ("{0}\t\tJNIEnv.DeleteLocalRef (local_ref);", indent); - writer.WriteLine ("{0}\t}}", indent); - writer.WriteLine (); - - HashSet members = new HashSet (); - WriteInterfacePropertyInvokers (@interface, @interface.Properties.Where (p => !p.Getter.IsStatic && !p.Getter.IsInterfaceDefaultMethod), indent + "\t", members); - WriteInterfaceMethodInvokers (@interface, @interface.Methods.Where (m => !m.IsStatic && !m.IsInterfaceDefaultMethod), indent + "\t", members); - if (@interface.FullName == "Java.Lang.ICharSequence") - WriteCharSequenceEnumerator (indent + "\t"); - - foreach (InterfaceGen iface in @interface.GetAllDerivedInterfaces ()) { - WriteInterfacePropertyInvokers (@interface, iface.Properties.Where (p => !p.Getter.IsStatic && !p.Getter.IsInterfaceDefaultMethod), indent + "\t", members); - WriteInterfaceMethodInvokers (@interface, iface.Methods.Where (m => !m.IsStatic && !m.IsInterfaceDefaultMethod && !@interface.IsCovariantMethod (m) && !(iface.FullName.StartsWith ("Java.Lang.ICharSequence", StringComparison.Ordinal) && m.Name.EndsWith ("Formatted", StringComparison.Ordinal))), indent + "\t", members); - if (iface.FullName == "Java.Lang.ICharSequence") - WriteCharSequenceEnumerator (indent + "\t"); - } - writer.WriteLine ("{0}}}", indent); - writer.WriteLine (); - } - - public void WriteInterfaceListenerEvent (InterfaceGen @interface, string indent, string name, string nameSpec, string methodName, string full_delegate_name, bool needs_sender, string wrefSuffix, string add, string remove, bool hasHandlerArgument = false) - { - writer.WriteLine ("{0}public event {1} {2} {{", indent, opt.GetOutputName (full_delegate_name), name); - writer.WriteLine ("{0}\tadd {{", indent); - writer.WriteLine ("{0}\t\tglobal::Java.Interop.EventHelper.AddEventHandler<{1}, {1}Implementor>(", - indent, opt.GetOutputName (@interface.FullName)); - writer.WriteLine ("{0}\t\t\t\tref weak_implementor_{1},", indent, wrefSuffix); - writer.WriteLine ("{0}\t\t\t\t__Create{1}Implementor,", indent, @interface.Name); - writer.WriteLine ("{0}\t\t\t\t{1},", indent, add + (hasHandlerArgument ? "_Event_With_Handler_Helper" : null)); - writer.WriteLine ("{0}\t\t\t\t__h => __h.{1}Handler += value);", indent, nameSpec); - writer.WriteLine ("{0}\t}}", indent); - writer.WriteLine ("{0}\tremove {{", indent); - writer.WriteLine ("{0}\t\tglobal::Java.Interop.EventHelper.RemoveEventHandler<{1}, {1}Implementor>(", - indent, opt.GetOutputName (@interface.FullName)); - writer.WriteLine ("{0}\t\t\t\tref weak_implementor_{1},", indent, wrefSuffix); - writer.WriteLine ("{0}\t\t\t\t{1}Implementor.__IsEmpty,", indent, opt.GetOutputName (@interface.FullName)); - writer.WriteLine ("{0}\t\t\t\t{1},", indent, remove); - writer.WriteLine ("{0}\t\t\t\t__h => __h.{1}Handler -= value);", indent, nameSpec); - writer.WriteLine ("{0}\t}}", indent); - writer.WriteLine ("{0}}}", indent); - writer.WriteLine (); - - if (hasHandlerArgument) { - writer.WriteLine ("{0}void {1} ({2} value)", indent, add + "_Event_With_Handler_Helper", opt.GetOutputName (@interface.FullName)); - writer.WriteLine ("{0}{{", indent); - writer.WriteLine ("{0}\t{1} (value, null);", indent, add); - writer.WriteLine ("{0}}}", indent); - writer.WriteLine (); - } - } - - public void WriteInterfaceListenerEventsAndProperties (InterfaceGen @interface, string indent, ClassGen target, string name, string connector_fmt, string add, string remove) - { - if (!@interface.IsValid) - return; - foreach (var m in @interface.Methods) { - string nameSpec = @interface.Methods.Count > 1 ? m.EventName ?? m.AdjustedName : String.Empty; - string nameUnique = String.IsNullOrEmpty (nameSpec) ? name : nameSpec; - if (nameUnique.StartsWith ("On", StringComparison.Ordinal)) - nameUnique = nameUnique.Substring (2); - if (target.ContainsName (nameUnique)) - nameUnique += "Event"; - WriteInterfaceListenerEventOrProperty (@interface, m, indent, target, nameUnique, connector_fmt, add, remove); - } - } - - public void WriteInterfaceListenerEventsAndProperties (InterfaceGen @interface, string indent, ClassGen target) - { - var methods = target.Methods.Concat (target.Properties.Where (p => p.Setter != null).Select (p => p.Setter)); - var props = new HashSet (); - var refs = new HashSet (); - var eventMethods = methods.Where (m => m.IsListenerConnector && m.EventName != String.Empty && m.ListenerType == @interface).OrderBy (m => m.Parameters.Count).GroupBy (m => m.Name).Select (g => g.First ()).Distinct (); - foreach (var method in eventMethods) { - string name = method.CalculateEventName (target.ContainsName); - if (String.IsNullOrEmpty (name)) { - Report.LogCodedWarning (0, Report.WarningEmptyEventName, method, @interface.FullName, method.Name); - continue; - } - if (opt.GetSafeIdentifier (name) != name) { - Report.LogCodedWarning (0, Report.WarningInvalidEventName, method, @interface.FullName, method.Name); - continue; - } - var prop = target.Properties.FirstOrDefault (p => p.Setter == method); - if (prop != null) { - string setter = "__Set" + prop.Name; - props.Add (prop.Name); - refs.Add (setter); - WriteInterfaceListenerEventsAndProperties (@interface, indent, target, name, setter, - string.Format ("__v => {0} = __v", prop.Name), - string.Format ("__v => {0} = null", prop.Name)); - } else { - refs.Add (method.Name); - string rm = null; - string remove; - if (method.Name.StartsWith ("Set", StringComparison.Ordinal)) - remove = string.Format ("__v => {0} (null)", method.Name); - else if (method.Name.StartsWith ("Add", StringComparison.Ordinal) && - (rm = "Remove" + method.Name.Substring ("Add".Length)) != null && - methods.Where (m => m.Name == rm).Any ()) - remove = string.Format ("__v => {0} (__v)", rm); - else - remove = string.Format ("__v => {{throw new NotSupportedException (\"Cannot unregister from {0}.{1}\");}}", - @interface.FullName, method.Name); - WriteInterfaceListenerEventsAndProperties (@interface, indent, target, name, method.Name, - method.Name, - remove); - } - } - - foreach (var r in refs) { - writer.WriteLine ("{0}WeakReference{2} weak_implementor_{1};", indent, r, opt.NullableOperator); - } - writer.WriteLine (); - writer.WriteLine ("{0}{1}Implementor __Create{2}Implementor ()", indent, opt.GetOutputName (@interface.FullName), @interface.Name); - writer.WriteLine ("{0}{{", indent); - writer.WriteLine ("{0}\treturn new {1}Implementor ({2});", indent, opt.GetOutputName (@interface.FullName), - @interface.NeedsSender ? "this" : ""); - writer.WriteLine ("{0}}}", indent); - } - - public void WriteInterfaceListenerEventOrProperty (InterfaceGen @interface, Method m, string indent, ClassGen target, string name, string connector_fmt, string add, string remove) - { - if (m.EventName == string.Empty) - return; - string nameSpec = @interface.Methods.Count > 1 ? m.AdjustedName : String.Empty; - int idx = @interface.FullName.LastIndexOf ('.'); - int start = @interface.Name.StartsWith ("IOn", StringComparison.Ordinal) ? 3 : 1; - string full_delegate_name = @interface.FullName.Substring (0, idx + 1) + @interface.Name.Substring (start, @interface.Name.Length - start - 8) + nameSpec; - if (m.IsSimpleEventHandler) - full_delegate_name = "EventHandler"; - else if (m.RetVal.IsVoid || m.IsEventHandlerWithHandledProperty) - full_delegate_name = "EventHandler<" + @interface.FullName.Substring (0, idx + 1) + @interface.GetArgsName (m) + ">"; - else - full_delegate_name += "Handler"; - if (m.RetVal.IsVoid || m.IsEventHandlerWithHandledProperty) { - if (opt.GetSafeIdentifier (name) != name) { - Report.LogCodedWarning (0, Report.WarningInvalidEventName2, m, @interface.FullName, name); - return; - } else { - var mt = target.Methods.Where (method => string.Compare (method.Name, connector_fmt, StringComparison.OrdinalIgnoreCase) == 0 && method.IsListenerConnector).FirstOrDefault (); - var hasHandlerArgument = mt != null && mt.IsListenerConnector && mt.Parameters.Count == 2 && mt.Parameters [1].Type == "Android.OS.Handler"; - WriteInterfaceListenerEvent (@interface, indent, name, nameSpec, m.AdjustedName, full_delegate_name, !m.Parameters.HasSender, connector_fmt, add, remove, hasHandlerArgument); - } - } else { - if (opt.GetSafeIdentifier (name) != name) { - Report.LogCodedWarning (0, Report.WarningInvalidEventPropertyName, m, @interface.FullName, name); - return; - } - writer.WriteLine ("{0}WeakReference{2} weak_implementor_{1};", indent, name, opt.NullableOperator); - writer.WriteLine ("{0}{1}Implementor{3} Impl{2} {{", indent, opt.GetOutputName (@interface.FullName), name, opt.NullableOperator); - writer.WriteLine ("{0}\tget {{", indent); - writer.WriteLine ("{0}\t\tif (weak_implementor_{1} == null || !weak_implementor_{1}.IsAlive)", indent, name); - writer.WriteLine ("{0}\t\t\treturn null;", indent); - writer.WriteLine ("{0}\t\treturn weak_implementor_{1}.Target as {2}Implementor;", indent, name, opt.GetOutputName (@interface.FullName)); - writer.WriteLine ("{0}\t}}", indent); - writer.WriteLine ("{0}\tset {{ weak_implementor_{1} = new WeakReference (value, true); }}", indent, name); - writer.WriteLine ("{0}}}", indent); - writer.WriteLine (); - WriteInterfaceListenerProperty (@interface, indent, name, nameSpec, m.AdjustedName, connector_fmt, full_delegate_name); - } - } - - public void WriteInterfaceListenerProperty (InterfaceGen @interface, string indent, string name, string nameSpec, string methodName, string connector_fmt, string full_delegate_name) - { - string handlerPrefix = @interface.Methods.Count > 1 ? methodName : string.Empty; - writer.WriteLine ("{0}public {1}{3} {2} {{", indent, opt.GetOutputName (full_delegate_name), name, opt.NullableOperator); - writer.WriteLine ("{0}\tget {{", indent); - writer.WriteLine ("{0}\t\t{1}Implementor{3} impl = Impl{2};", indent, opt.GetOutputName (@interface.FullName), name, opt.NullableOperator); - writer.WriteLine ("{0}\t\treturn impl == null ? null : impl.{1}Handler;", indent, handlerPrefix); - writer.WriteLine ("{0}\t}}", indent); - writer.WriteLine ("{0}\tset {{", indent); - writer.WriteLine ("{0}\t\t{1}Implementor{3} impl = Impl{2};", indent, opt.GetOutputName (@interface.FullName), name, opt.NullableOperator); - writer.WriteLine ("{0}\t\tif (impl == null) {{", indent); - writer.WriteLine ("{0}\t\t\timpl = new {1}Implementor ({2});", indent, opt.GetOutputName (@interface.FullName), @interface.NeedsSender ? "this" : string.Empty); - writer.WriteLine ("{0}\t\t\tImpl{1} = impl;", indent, name); - writer.WriteLine ("{0}\t\t}} else", indent); - writer.WriteLine ("{0}\t\t\timpl.{1}Handler = value;", indent, nameSpec); - writer.WriteLine ("{0}\t}}", indent); - writer.WriteLine ("{0}}}", indent); - writer.WriteLine (); - } - - public void WriteInterfaceMethodInvokers (InterfaceGen @interface, IEnumerable methods, string indent, HashSet members) - { - foreach (Method m in methods.Where (m => !m.IsStatic)) { - string sig = m.GetSignature (); - if (members.Contains (sig)) - continue; - members.Add (sig); - WriteMethodInvoker (m, indent, @interface); - } - } - - public void WriteInterfaceMethods (InterfaceGen @interface, string indent) - { - foreach (var m in @interface.Methods.Where (m => !m.IsStatic && !m.IsInterfaceDefaultMethod)) { - if (m.Name == @interface.Name || @interface.ContainsProperty (m.Name, true)) - m.Name = "Invoke" + m.Name; - - WriteMethodDeclaration (m, indent, @interface, @interface.AssemblyQualifiedName + "Invoker"); - } - - if (opt.SupportDefaultInterfaceMethods) - foreach (var m in @interface.Methods.Where (m => m.IsInterfaceDefaultMethod || m.IsStatic)) - WriteMethod (m, indent, @interface, true); - } - - public void WriteInterfaceProperties (InterfaceGen @interface, string indent) - { - foreach (var prop in @interface.Properties.Where (p => !p.Getter.IsStatic && !p.Getter.IsInterfaceDefaultMethod)) - WritePropertyDeclaration (prop, indent, @interface, @interface.AssemblyQualifiedName + "Invoker"); - - if (opt.SupportDefaultInterfaceMethods) - WriteImplementedProperties (@interface.Properties.Where (p => p.Getter.IsInterfaceDefaultMethod || p.Getter.IsStatic), indent, false, @interface); - } - - public void WriteInterfacePropertyInvokers (InterfaceGen @interface, IEnumerable properties, string indent, HashSet members) - { - foreach (Property prop in properties) { - if (members.Contains (prop.Name)) - continue; - members.Add (prop.Name); - WritePropertyInvoker (prop, indent, @interface); - } - } - - #region "if you're changing this part, also change method in https://github.com/xamarin/xamarin-android/blob/master/src/Mono.Android.Export/CallbackCode.cs" - public virtual void WriteMethodCallback (Method method, string indent, GenBase type, string property_name, bool as_formatted = false) - { - var is_private = method.IsInterfaceDefaultMethod ? "private " : string.Empty; - - string delegate_type = method.GetDelegateType (opt); - writer.WriteLine ("{0}{2}static Delegate{3} {1};", indent, method.EscapedCallbackName, is_private, opt.NullableOperator); - writer.WriteLine ("#pragma warning disable 0169"); - if (method.Deprecated != null) - writer.WriteLine ($"{indent}[Obsolete]"); - writer.WriteLine ("{0}{2}static Delegate {1} ()", indent, method.ConnectorName, is_private); - writer.WriteLine ("{0}{{", indent); - writer.WriteLine ("{0}\tif ({1} == null)", indent, method.EscapedCallbackName); - writer.WriteLine ("{0}\t\t{1} = JNINativeWrapper.CreateDelegate (({2}) n_{3});", indent, method.EscapedCallbackName, delegate_type, method.Name + method.IDSignature); - writer.WriteLine ("{0}\treturn {1};", indent, method.EscapedCallbackName); - writer.WriteLine ("{0}}}", indent); - writer.WriteLine (); - if (method.Deprecated != null) - writer.WriteLine ($"{indent}[Obsolete]"); - writer.WriteLine ("{0}{4}static {1} n_{2} (IntPtr jnienv, IntPtr native__this{3})", indent, method.RetVal.NativeType, method.Name + method.IDSignature, method.Parameters.GetCallbackSignature (opt), is_private); - writer.WriteLine ("{0}{{", indent); - writer.WriteLine ("{0}\tvar __this = global::Java.Lang.Object.GetObject<{1}> (jnienv, native__this, JniHandleOwnership.DoNotTransfer){2};", indent, opt.GetOutputName (type.FullName), opt.NullForgivingOperator); - foreach (string s in method.Parameters.GetCallbackPrep (opt)) - writer.WriteLine ("{0}\t{1}", indent, s); - if (String.IsNullOrEmpty (property_name)) { - string call = "__this." + method.Name + (as_formatted ? "Formatted" : String.Empty) + " (" + method.Parameters.GetCall (opt) + ")"; - if (method.IsVoid) - writer.WriteLine ("{0}\t{1};", indent, call); - else - writer.WriteLine ("{0}\t{1} {2};", indent, method.Parameters.HasCleanup ? method.RetVal.NativeType + " __ret =" : "return", method.RetVal.ToNative (opt, call)); - } else { - if (method.IsVoid) - writer.WriteLine ("{0}\t__this.{1} = {2};", indent, property_name, method.Parameters.GetCall (opt)); - else - writer.WriteLine ("{0}\t{1} {2};", indent, method.Parameters.HasCleanup ? method.RetVal.NativeType + " __ret =" : "return", method.RetVal.ToNative (opt, "__this." + property_name)); - } - foreach (string cleanup in method.Parameters.GetCallbackCleanup (opt)) - writer.WriteLine ("{0}\t{1}", indent, cleanup); - if (!method.IsVoid && method.Parameters.HasCleanup) - writer.WriteLine ("{0}\treturn __ret;", indent); - writer.WriteLine ("{0}}}", indent); - writer.WriteLine ("#pragma warning restore 0169"); - writer.WriteLine (); - } - #endregion - - public void WriteMethodCustomAttributes (Method method, string indent) - { - if (method.GenericArguments != null && method.GenericArguments.Any ()) - writer.WriteLine ("{0}{1}", indent, method.GenericArguments.ToGeneratedAttributeString ()); - if (method.CustomAttributes != null) - writer.WriteLine ("{0}{1}", indent, method.CustomAttributes); - if (method.Annotation != null) - writer.WriteLine ("{0}{1}", indent, method.Annotation); - } - - public void WriteMethodExplicitInterfaceImplementation (Method method, string indent, GenBase iface) - { - //writer.WriteLine ("// explicitly implemented method from " + iface.FullName); - WriteMethodCustomAttributes (method, indent); - writer.WriteLine ("{0}{1} {2}.{3} ({4})", indent, opt.GetTypeReferenceName (method.RetVal), opt.GetOutputName (iface.FullName), method.Name, method.GetSignature (opt)); - writer.WriteLine ("{0}{{", indent); - writer.WriteLine ("{0}\treturn {1} ({2});", indent, method.Name, method.Parameters.GetCall (opt)); - writer.WriteLine ("{0}}}", indent); - writer.WriteLine (); - } - - public void WriteMethodExplicitInterfaceInvoker (Method method, string indent, GenBase iface) - { - //writer.WriteLine ("\t\t// explicitly implemented invoker method from " + iface.FullName); - WriteMethodIdField (method, indent); - writer.WriteLine ("{0}unsafe {1} {2}.{3} ({4})", - indent, opt.GetTypeReferenceName (method.RetVal), opt.GetOutputName (iface.FullName), method.Name, method.GetSignature (opt)); - writer.WriteLine ("{0}{{", indent); - WriteMethodBody (method, indent + "\t", iface); - writer.WriteLine ("{0}}}", indent); - writer.WriteLine (); - } - - public void WriteMethodAbstractDeclaration (Method method, string indent, InterfaceGen gen, GenBase impl) - { - if (method.RetVal.IsGeneric && gen != null) { - WriteMethodCustomAttributes (method, indent); - writer.WriteLine ("{0}{1} {2}.{3} ({4})", indent, opt.GetTypeReferenceName (method.RetVal), opt.GetOutputName (gen.FullName), method.Name, method.GetSignature (opt)); - writer.WriteLine ("{0}{{", indent); - writer.WriteLine ("{0}\tthrow new NotImplementedException ();", indent); - writer.WriteLine ("{0}}}", indent); - writer.WriteLine (); - } else { - bool gen_as_formatted = method.IsReturnCharSequence; - string name = method.AdjustedName; - WriteMethodCallback (method, indent, impl, null, gen_as_formatted); - if (method.DeclaringType.IsGeneratable) - writer.WriteLine ("{0}// Metadata.xml XPath method reference: path=\"{1}\"", indent, method.GetMetadataXPathReference (method.DeclaringType)); - writer.WriteLine ("{0}[Register (\"{1}\", \"{2}\", \"{3}\"{4})]", indent, method.JavaName, method.JniSignature, method.ConnectorName, method.AdditionalAttributeString ()); - WriteMethodCustomAttributes (method, indent); - writer.WriteLine ("{0}{1}{2} abstract {3} {4} ({5});", - indent, - impl.RequiresNew (method.Name, method) ? "new " : "", - method.Visibility, - opt.GetTypeReferenceName (method.RetVal), - name, - method.GetSignature (opt)); - writer.WriteLine (); - - if (gen_as_formatted || method.Parameters.HasCharSequence) - WriteMethodStringOverload (method, indent); - } - - WriteMethodAsyncWrapper (method, indent); - } - - public void WriteMethodDeclaration (Method method, string indent, GenBase type, string adapter) - { - if (method.DeclaringType.IsGeneratable) - writer.WriteLine ("{0}// Metadata.xml XPath method reference: path=\"{1}\"", indent, method.GetMetadataXPathReference (method.DeclaringType)); - if (method.Deprecated != null) - writer.WriteLine ("[Obsolete (@\"{0}\")]", method.Deprecated.Replace ("\"", "\"\"")); - if (method.IsReturnEnumified) - writer.WriteLine ("{0}[return:global::Android.Runtime.GeneratedEnum]", indent); - if (method.IsInterfaceDefaultMethod) - writer.WriteLine ("{0}[global::Java.Interop.JavaInterfaceDefaultMethod]", indent); - writer.WriteLine ("{0}[Register (\"{1}\", \"{2}\", \"{3}:{4}\"{5})]", indent, method.JavaName, method.JniSignature, method.ConnectorName, method.GetAdapterName (opt, adapter), method.AdditionalAttributeString ()); - WriteMethodCustomAttributes (method, indent); - writer.WriteLine ("{0}{1} {2} ({3});", indent, opt.GetTypeReferenceName (method.RetVal), method.AdjustedName, method.GetSignature (opt)); - writer.WriteLine (); - } - - public void WriteMethodEventDelegate (Method method, string indent) - { - writer.WriteLine ("{0}public delegate {1} {2}EventHandler ({3});", indent, opt.GetTypeReferenceName (method.RetVal), method.Name, method.GetSignature (opt)); - writer.WriteLine (); - } - - // This is supposed to generate instantiated generic method output, but I don't think it is done yet. - public void WriteMethodExplicitIface (Method method, string indent, GenericSymbol gen) - { - writer.WriteLine ("{0}// This method is explicitly implemented as a member of an instantiated {1}", indent, gen.FullName); - WriteMethodCustomAttributes (method, indent); - writer.WriteLine ("{0}{1} {2}.{3} ({4})", indent, opt.GetTypeReferenceName (method.RetVal), opt.GetOutputName (gen.Gen.FullName), method.Name, method.GetSignature (opt)); - writer.WriteLine ("{0}{{", indent); - Dictionary mappings = new Dictionary (); - for (int i = 0; i < gen.TypeParams.Length; i++) - mappings [gen.Gen.TypeParameters [i].Name] = gen.TypeParams [i].FullName; - WriteMethodGenericBody (method, indent + "\t", null, String.Empty, mappings); - writer.WriteLine ("{0}}}", indent); - writer.WriteLine (); - } - - void WriteMethodGenericBody (Method method, string indent, string property_name, string container_prefix, Dictionary mappings) - { - if (String.IsNullOrEmpty (property_name)) { - string call = container_prefix + method.Name + " (" + method.Parameters.GetGenericCall (opt, mappings) + ")"; - writer.WriteLine ("{0}{1}{2};", indent, method.IsVoid ? String.Empty : "return ", method.RetVal.GetGenericReturn (opt, call, mappings)); - } else { - if (method.IsVoid) // setter - writer.WriteLine ("{0}{1} = {2};", indent, container_prefix + property_name, method.Parameters.GetGenericCall (opt, mappings)); - else // getter - writer.WriteLine ("{0}return {1};", indent, method.RetVal.GetGenericReturn (opt, container_prefix + property_name, mappings)); - } - } - - public void WriteMethodIdField (Method method, string indent, bool invoker = false) - { - if (invoker) { - writer.WriteLine ("{0}IntPtr {1};", indent, method.EscapedIdName); - return; - } - WriteMethodIdField (method, indent); - } - - public void WriteMethodInvoker (Method method, string indent, GenBase type) - { - WriteMethodCallback (method, indent, type, null, method.IsReturnCharSequence); - WriteMethodIdField (method, indent, invoker: true); - writer.WriteLine ("{0}public unsafe {1}{2} {3} ({4})", - indent, method.IsStatic ? "static " : string.Empty, opt.GetTypeReferenceName (method.RetVal), method.AdjustedName, method.GetSignature (opt)); - writer.WriteLine ("{0}{{", indent); - WriteMethodInvokerBody (method, indent + "\t"); - writer.WriteLine ("{0}}}", indent); - writer.WriteLine (); - } - - public void WriteMethodInvokerBody (Method method, string indent) - { - writer.WriteLine ("{0}if ({1} == IntPtr.Zero)", indent, method.EscapedIdName); - writer.WriteLine ("{0}\t{1} = JNIEnv.GetMethodID (class_ref, \"{2}\", \"{3}\");", indent, method.EscapedIdName, method.JavaName, method.JniSignature); - foreach (string prep in method.Parameters.GetCallPrep (opt)) - writer.WriteLine ("{0}{1}", indent, prep); - WriteParameterListCallArgs (method.Parameters, indent, invoker: true); - string env_method = "Call" + method.RetVal.CallMethodPrefix + "Method"; - string call = method.RetVal.ReturnCast + "JNIEnv." + env_method + " (" + - Context.ContextType.GetObjectHandleProperty (opt, "this") + ", " + method.EscapedIdName + method.Parameters.GetCallArgs (opt, invoker: true) + ")"; - if (method.IsVoid) - writer.WriteLine ("{0}{1};", indent, call); - else - writer.WriteLine ("{0}{1}{2};", indent, method.Parameters.HasCleanup ? "var __ret = " : "return ", method.RetVal.FromNative (opt, call, true) + opt.GetNullForgiveness (method.RetVal)); - - foreach (string cleanup in method.Parameters.GetCallCleanup (opt)) - writer.WriteLine ("{0}{1}", indent, cleanup); - - if (!method.IsVoid && method.Parameters.HasCleanup) - writer.WriteLine ("{0}return __ret;", indent); - } - - void WriteMethodStringOverloadBody (Method method, string indent, bool haveSelf) - { - var call = new System.Text.StringBuilder (); - foreach (Parameter p in method.Parameters) { - string pname = p.Name; - if (p.Type == "Java.Lang.ICharSequence") { - pname = p.GetName ("jls_"); - writer.WriteLine ("{0}var {1} = {2} == null ? null : new global::Java.Lang.String ({2});", indent, pname, p.Name); - } else if (p.Type == "Java.Lang.ICharSequence[]" || p.Type == "params Java.Lang.ICharSequence[]") { - pname = p.GetName ("jlca_"); - writer.WriteLine ("{0}var {1} = CharSequence.ArrayFromStringArray({2});", indent, pname, p.Name); - } - if (call.Length > 0) - call.Append (", "); - call.Append (pname + (p.Type == "Java.Lang.ICharSequence" ? opt.GetNullForgiveness (p) : string.Empty)); - } - writer.WriteLine ("{0}{1}{2}{3} ({4});", indent, method.RetVal.IsVoid ? String.Empty : opt.GetTypeReferenceName (method.RetVal) + " __result = ", haveSelf ? "self." : "", method.AdjustedName, call.ToString ()); - switch (method.RetVal.FullName) { - case "void": - break; - case "Java.Lang.ICharSequence[]": - writer.WriteLine ("{0}var __rsval = CharSequence.ArrayToStringArray (__result);", indent); - break; - case "Java.Lang.ICharSequence": - writer.WriteLine ("{0}var __rsval = __result?.ToString ();", indent); - break; - default: - writer.WriteLine ("{0}var __rsval = __result;", indent); - break; - } - foreach (Parameter p in method.Parameters) { - if (p.Type == "Java.Lang.ICharSequence") - writer.WriteLine ("{0}{1}?.Dispose ();", indent, p.GetName ("jls_")); - else if (p.Type == "Java.Lang.ICharSequence[]") - writer.WriteLine ("{0}if ({1} != null) foreach (var s in {1}) s?.Dispose ();", indent, p.GetName ("jlca_")); - } - if (!method.RetVal.IsVoid) { - writer.WriteLine ($"{indent}return __rsval{opt.GetNullForgiveness (method.RetVal)};"); - } - } - - void WriteMethodStringOverload (Method method, string indent) - { - string static_arg = method.IsStatic ? " static" : String.Empty; - string ret = opt.GetTypeReferenceName (method.RetVal).Replace ("Java.Lang.ICharSequence", "string").Replace ("global::string", "string"); - if (method.Deprecated != null) - writer.WriteLine ("{0}[Obsolete (@\"{1}\")]", indent, method.Deprecated.Replace ("\"", "\"\"").Trim ()); - writer.WriteLine ("{0}{1}{2} {3} {4} ({5})", indent, method.Visibility, static_arg, ret, method.Name, method.GetSignature (opt).Replace ("Java.Lang.ICharSequence", "string").Replace ("global::string", "string")); - writer.WriteLine ("{0}{{", indent); - WriteMethodStringOverloadBody (method, indent + "\t", false); - writer.WriteLine ("{0}}}", indent); - writer.WriteLine (); - } - - public void WriteMethodExtensionOverload (Method method, string indent, string selfType) - { - if (!method.CanHaveStringOverload) - return; - - string ret = opt.GetTypeReferenceName (method.RetVal).Replace ("Java.Lang.ICharSequence", "string").Replace ("global::string", "string"); - writer.WriteLine (); - - var parameters = method.GetSignature (opt).Replace ("Java.Lang.ICharSequence", "string").Replace ("global::string", "string"); - writer.WriteLine ("{0}public static {1} {2} (this {3} self{4}{5})", indent, ret, method.Name, selfType, parameters.Length > 0 ? ", " : "", parameters); - - writer.WriteLine ("{0}{{", indent); - WriteMethodStringOverloadBody (method, indent + "\t", true); - writer.WriteLine ("{0}}}", indent); - } - - static string GetDeclaringTypeOfExplicitInterfaceMethod (Method method) - { - return method.OverriddenInterfaceMethod != null ? - GetDeclaringTypeOfExplicitInterfaceMethod (method.OverriddenInterfaceMethod) : - method.DeclaringType.FullName; - } - - - public void WriteMethodAsyncWrapper (Method method, string indent) - { - if (!method.Asyncify) - return; - - string static_arg = method.IsStatic ? " static" : String.Empty; - string ret; - - if (method.IsVoid) - ret = "global::System.Threading.Tasks.Task"; - else - ret = "global::System.Threading.Tasks.Task<" + opt.GetTypeReferenceName (method.RetVal) + ">"; - - writer.WriteLine ("{0}{1}{2} {3} {4}Async ({5})", indent, method.Visibility, static_arg, ret, method.AdjustedName, method.GetSignature (opt)); - writer.WriteLine ("{0}{{", indent); - writer.WriteLine ("{0}\treturn global::System.Threading.Tasks.Task.Run (() => {1} ({2}));", indent, method.AdjustedName, method.Parameters.GetCall (opt)); - writer.WriteLine ("{0}}}", indent); - writer.WriteLine (); - } - - public void WriteMethodExtensionAsyncWrapper (Method method, string indent, string selfType) - { - if (!method.Asyncify) - return; - - string ret; - - if (method.IsVoid) - ret = "global::System.Threading.Tasks.Task"; - else - ret = "global::System.Threading.Tasks.Task<" + opt.GetTypeReferenceName (method.RetVal) + ">"; - - writer.WriteLine ("{0}public static {1} {2}Async (this {3} self{4}{5})", indent, ret, method.AdjustedName, selfType, method.Parameters.Count > 0 ? ", " : string.Empty, method.GetSignature (opt)); - writer.WriteLine ("{0}{{", indent); - writer.WriteLine ("{0}\treturn global::System.Threading.Tasks.Task.Run (() => self.{1} ({2}));", indent, method.AdjustedName, method.Parameters.GetCall (opt)); - writer.WriteLine ("{0}}}", indent); - writer.WriteLine (); - } - - public void WriteMethod (Method method, string indent, GenBase type, bool generate_callbacks) - { - if (!method.IsValid) - return; - - bool gen_as_formatted = method.IsReturnCharSequence; - if (generate_callbacks && method.IsVirtual) - WriteMethodCallback (method, indent, type, null, gen_as_formatted); - - string name_and_jnisig = method.JavaName + method.JniSignature.Replace ("java/lang/CharSequence", "java/lang/String"); - bool gen_string_overload = !method.IsOverride && method.Parameters.HasCharSequence && !type.ContainsMethod (name_and_jnisig); - - string static_arg = method.IsStatic ? " static" : String.Empty; - - var is_explicit = opt.SupportDefaultInterfaceMethods && type is InterfaceGen && method.OverriddenInterfaceMethod != null; - var virt_ov = is_explicit ? string.Empty : method.IsOverride ? (opt.SupportDefaultInterfaceMethods && method.OverriddenInterfaceMethod != null ? " virtual" : " override") : method.IsVirtual ? " virtual" : string.Empty; - string seal = method.IsOverride && method.IsFinal ? " sealed" : null; - - // When using DIM, don't generate "virtual sealed" methods, remove both modifiers instead - if (opt.SupportDefaultInterfaceMethods && method.OverriddenInterfaceMethod != null && virt_ov == " virtual" && seal == " sealed") { - virt_ov = string.Empty; - seal = string.Empty; - } - - if ((string.IsNullOrEmpty (virt_ov) || virt_ov == " virtual") && type.RequiresNew (method.AdjustedName, method)) { - virt_ov = " new" + virt_ov; - } - string ret = opt.GetTypeReferenceName (method.RetVal); - WriteMethodIdField (method, indent); - if (method.DeclaringType.IsGeneratable) - writer.WriteLine ("{0}// Metadata.xml XPath method reference: path=\"{1}\"", indent, method.GetMetadataXPathReference (method.DeclaringType)); - if (method.Deprecated != null) - writer.WriteLine ("{0}[Obsolete (@\"{1}\")]", indent, method.Deprecated.Replace ("\"", "\"\"")); - if (method.IsReturnEnumified) - writer.WriteLine ("{0}[return:global::Android.Runtime.GeneratedEnum]", indent); - writer.WriteLine ("{0}[Register (\"{1}\", \"{2}\", \"{3}\"{4})]", - indent, method.JavaName, method.JniSignature, method.IsVirtual ? method.GetConnectorNameFull (opt) : String.Empty, method.AdditionalAttributeString ()); - WriteMethodCustomAttributes (method, indent); - - var visibility = type is InterfaceGen && !method.IsStatic ? string.Empty : method.Visibility; - - writer.WriteLine ("{0}{1}{2}{3}{4} unsafe {5} {6}{7} ({8})", - indent, - visibility, - static_arg, - virt_ov, - seal, - ret, - is_explicit ? GetDeclaringTypeOfExplicitInterfaceMethod (method.OverriddenInterfaceMethod) + '.' : string.Empty, - method.AdjustedName, - method.GetSignature (opt)); - - writer.WriteLine ("{0}{{", indent); - WriteMethodBody (method, indent + "\t", type); - writer.WriteLine ("{0}}}", indent); - writer.WriteLine (); - - //NOTE: Invokers are the only place false is passed for generate_callbacks, they do not need string overloads - if (generate_callbacks && (gen_string_overload || gen_as_formatted)) - WriteMethodStringOverload (method, indent); - - WriteMethodAsyncWrapper (method, indent); - } - - public void WriteParameterListCallArgs (ParameterList parameters, string indent, bool invoker) - { - if (parameters.Count == 0) - return; - string JValue = "JValue"; - switch (opt.CodeGenerationTarget) { - case CodeGenerationTarget.XAJavaInterop1: - case CodeGenerationTarget.JavaInterop1: - JValue = invoker ? JValue : "JniArgumentValue"; - break; - } - writer.WriteLine ("{0}{1}* __args = stackalloc {1} [{2}];", indent, JValue, parameters.Count); - for (int i = 0; i < parameters.Count; ++i) { - var p = parameters [i]; - writer.WriteLine ("{0}__args [{1}] = new {2} ({3});", indent, i, JValue, p.GetCall (opt)); - } - } - - public void WriteProperty (Property property, GenBase gen, string indent, bool with_callbacks = true, bool force_override = false) - { - // - // This is a special workaround for AdapterView inheritance. - // (How it is special? They have hand-written bindings AND brings generic - // version of AdapterView in the inheritance, also added by metadata!) - // - // They are on top of fragile hand-bound code, and when we are making changes - // in generator, they bite. Since we are not going to bring API breakage - // right now, we need special workarounds to get things working. - // - // So far, what we need here is to have AbsSpinner.Adapter compile. - // - // > platforms/*/src/generated/Android.Widget.AbsSpinner.cs(156,56): error CS0533: - // > `Android.Widget.AbsSpinner.Adapter' hides inherited abstract member - // > `Android.Widget.AdapterView.Adapter - // - // It is because the AdapterView.Adapter is hand-bound and cannot be - // detected by generator! - // - // So, we explicitly treat it as a special-case. - // - // Then, Spinner, ListView and GridView instantiate them, so they are also special cases. - // - if (property.Name == "Adapter" && - (property.Getter.DeclaringType.BaseGen.FullName == "Android.Widget.AdapterView" || - property.Getter.DeclaringType.BaseGen.BaseGen != null && property.Getter.DeclaringType.BaseGen.BaseGen.FullName == "Android.Widget.AdapterView")) - force_override = true; - // ... and the above breaks generator tests... - if (property.Name == "Adapter" && - (property.Getter.DeclaringType.BaseGen.FullName == "Xamarin.Test.AdapterView" || - property.Getter.DeclaringType.BaseGen.BaseGen != null && property.Getter.DeclaringType.BaseGen.BaseGen.FullName == "Xamarin.Test.AdapterView")) - force_override = true; - - string decl_name = property.AdjustedName; - string needNew = gen.RequiresNew (property) ? " new" : ""; - string virtual_override = String.Empty; - bool is_virtual = property.Getter.IsVirtual && (property.Setter == null || property.Setter.IsVirtual); - if (with_callbacks && is_virtual) { - virtual_override = needNew + " virtual"; - WriteMethodCallback (property.Getter, indent, gen, property.AdjustedName); - } - if (with_callbacks && is_virtual && property.Setter != null) { - virtual_override = needNew + " virtual"; - WriteMethodCallback (property.Setter, indent, gen, property.AdjustedName); - } - virtual_override = force_override ? " override" : virtual_override; - if ((property.Getter ?? property.Setter).IsStatic) - virtual_override = " static"; - // It should be using AdjustedName instead of Name, but ICharSequence ("Formatted") properties are not caught by this... - else if (gen.BaseSymbol != null) { - var base_prop = gen.BaseSymbol.GetPropertyByName (property.Name, true); - - // If the matching base getter we found is a DIM, we do not override it, it should stay virtual - if (base_prop != null && !base_prop.Getter.IsInterfaceDefaultMethod) - virtual_override = " override"; - } - - WriteMethodIdField (property.Getter, indent); - if (property.Setter != null) - WriteMethodIdField (property.Setter, indent); - string visibility = gen is InterfaceGen ? string.Empty : property.Getter.IsAbstract && property.Getter.RetVal.IsGeneric ? "protected" : (property.Setter ?? property.Getter).Visibility; - // Unlike [Register], mcs does not allow applying [Obsolete] on property accessors, so we can apply them only under limited condition... - if (property.Getter.Deprecated != null && (property.Setter == null || property.Setter.Deprecated != null)) - writer.WriteLine ("{0}[Obsolete (@\"{1}\")]", indent, property.Getter.Deprecated.Replace ("\"", "\"\"").Trim () + (property.Setter != null && property.Setter.Deprecated != property.Getter.Deprecated ? " " + property.Setter.Deprecated.Replace ("\"", "\"\"").Trim () : null)); - WriteMethodCustomAttributes (property.Getter, indent); - writer.WriteLine ("{0}{1}{2} unsafe {3} {4} {{", indent, visibility, virtual_override, opt.GetTypeReferenceName (property.Getter.RetVal), decl_name); - if (gen.IsGeneratable) - writer.WriteLine ("{0}\t// Metadata.xml XPath method reference: path=\"{1}/method[@name='{2}'{3}]\"", indent, gen.MetadataXPathReference, property.Getter.JavaName, property.Getter.Parameters.GetMethodXPathPredicate ()); - writer.WriteLine ("{0}\t[Register (\"{1}\", \"{2}\", \"{3}\"{4})]", indent, property.Getter.JavaName, property.Getter.JniSignature, property.Getter.IsVirtual ? property.Getter.GetConnectorNameFull (opt) : string.Empty, property.Getter.AdditionalAttributeString ()); - writer.WriteLine ("{0}\tget {{", indent); - WriteMethodBody (property.Getter, indent + "\t\t", gen); - writer.WriteLine ("{0}\t}}", indent); - if (property.Setter != null) { - if (gen.IsGeneratable) - writer.WriteLine ("{0}\t// Metadata.xml XPath method reference: path=\"{1}/method[@name='{2}'{3}]\"", indent, gen.MetadataXPathReference, property.Setter.JavaName, property.Setter.Parameters.GetMethodXPathPredicate ()); - WriteMethodCustomAttributes (property.Setter, indent); - writer.WriteLine ("{0}\t[Register (\"{1}\", \"{2}\", \"{3}\"{4})]", indent, property.Setter.JavaName, property.Setter.JniSignature, property.Setter.IsVirtual ? property.Setter.GetConnectorNameFull (opt) : string.Empty, property.Setter.AdditionalAttributeString ()); - writer.WriteLine ("{0}\tset {{", indent); - string pname = property.Setter.Parameters [0].Name; - property.Setter.Parameters [0].Name = "value"; - WriteMethodBody (property.Setter, indent + "\t\t", gen); - property.Setter.Parameters [0].Name = pname; - writer.WriteLine ("{0}\t}}", indent); - } else if (property.GenerateDispatchingSetter) { - writer.WriteLine ("{0}// This is a dispatching setter", indent + "\t"); - writer.WriteLine ("{0}set {{ Set{1} (value); }}", indent + "\t", property.Name); - } - writer.WriteLine ("{0}}}", indent); - writer.WriteLine (); - - if (property.Type.StartsWith ("Java.Lang.ICharSequence", StringComparison.Ordinal) && virtual_override != " override") - WritePropertyStringVariant (property, indent); - } - - public void WritePropertyAbstractDeclaration (Property property, string indent, GenBase gen) - { - bool overrides = false; - var baseProp = gen.BaseSymbol != null ? gen.BaseSymbol.GetPropertyByName (property.Name, true) : null; - if (baseProp != null) { - if (baseProp.Type != property.Getter.Return) { - // This may not be required if we can change generic parameter support to return constrained type (not just J.L.Object). - writer.WriteLine ("{0}// skipped generating property {1} because its Java method declaration is variant that we cannot represent in C#", indent, property.Name); - return; - } - overrides = true; - } - - bool requiresNew = false; - string abstract_name = property.AdjustedName; - string visibility = property.Getter.RetVal.IsGeneric ? "protected" : property.Getter.Visibility; - if (!overrides) { - requiresNew = gen.RequiresNew (property); - WritePropertyCallbacks (property, indent, gen, abstract_name); - } - writer.WriteLine ("{0}{1}{2} abstract{3} {4} {5} {{", - indent, - visibility, - requiresNew ? " new" : "", - overrides ? " override" : "", - opt.GetTypeReferenceName (property.Getter.RetVal), - abstract_name); - if (gen.IsGeneratable) - writer.WriteLine ("{0}\t// Metadata.xml XPath method reference: path=\"{1}/method[@name='{2}'{3}]\"", indent, gen.MetadataXPathReference, property.Getter.JavaName, property.Getter.Parameters.GetMethodXPathPredicate ()); - if (property.Getter.IsReturnEnumified) - writer.WriteLine ("{0}[return:global::Android.Runtime.GeneratedEnum]", indent); - WriteMethodCustomAttributes (property.Getter, indent); - writer.WriteLine ("{0}\t[Register (\"{1}\", \"{2}\", \"{3}\"{4})] get;", indent, property.Getter.JavaName, property.Getter.JniSignature, property.Getter.GetConnectorNameFull (opt), property.Getter.AdditionalAttributeString ()); - if (property.Setter != null) { - if (gen.IsGeneratable) - writer.WriteLine ("{0}\t// Metadata.xml XPath method reference: path=\"{1}/method[@name='{2}'{3}]\"", indent, gen.MetadataXPathReference, property.Setter.JavaName, property.Setter.Parameters.GetMethodXPathPredicate ()); - WriteMethodCustomAttributes (property.Setter, indent); - writer.WriteLine ("{0}\t[Register (\"{1}\", \"{2}\", \"{3}\"{4})] set;", indent, property.Setter.JavaName, property.Setter.JniSignature, property.Setter.GetConnectorNameFull (opt), property.Setter.AdditionalAttributeString ()); - } - writer.WriteLine ("{0}}}", indent); - writer.WriteLine (); - if (property.Type.StartsWith ("Java.Lang.ICharSequence", StringComparison.Ordinal)) - WritePropertyStringVariant (property, indent); - } - - public void WritePropertyCallbacks (Property property, string indent, GenBase gen) - => WritePropertyCallbacks (property, indent, gen, property.AdjustedName); - - public void WritePropertyCallbacks (Property property, string indent, GenBase gen, string name) - { - WriteMethodCallback (property.Getter, indent, gen, name); - - if (property.Setter != null) - WriteMethodCallback (property.Setter, indent, gen, name); - } - - public void WritePropertyExplicitInterface (Property property, string indent, GenericSymbol gen, string adapter) - { - Dictionary mappings = new Dictionary (); - for (int i = 0; i < gen.TypeParams.Length; i++) - mappings [gen.Gen.TypeParameters [i].Name] = gen.TypeParams [i].FullName; - - //If the property type is Java.Lang.Object, we don't need to generate an explicit implementation - if (property.Getter?.RetVal.GetGenericType (mappings) == "Java.Lang.Object") - return; - if (property.Setter?.Parameters [0].GetGenericType (mappings) == "Java.Lang.Object") - return; - - writer.WriteLine ("{0}// This method is explicitly implemented as a member of an instantiated {1}", indent, gen.FullName); - writer.WriteLine ("{0}{1} {2}.{3} {{", indent, opt.GetTypeReferenceName (property), opt.GetOutputName (gen.Gen.FullName), property.AdjustedName); - if (property.Getter != null) { - if (gen.Gen.IsGeneratable) - writer.WriteLine ("{0}\t// Metadata.xml XPath method reference: path=\"{1}/method[@name='{2}'{3}]\"", indent, gen.Gen.MetadataXPathReference, property.Getter.JavaName, property.Getter.Parameters.GetMethodXPathPredicate ()); - if (property.Getter.GenericArguments != null && property.Getter.GenericArguments.Any ()) - writer.WriteLine ("{0}{1}", indent, property.Getter.GenericArguments.ToGeneratedAttributeString ()); - writer.WriteLine ("{0}\t[Register (\"{1}\", \"{2}\", \"{3}:{4}\"{5})] get {{", indent, property.Getter.JavaName, property.Getter.JniSignature, property.Getter.ConnectorName, property.Getter.GetAdapterName (opt, adapter), property.Getter.AdditionalAttributeString ()); - writer.WriteLine ("{0}\t\treturn {1};", indent, property.Name); - writer.WriteLine ("{0}\t}}", indent); - } - if (property.Setter != null) { - if (gen.Gen.IsGeneratable) - writer.WriteLine ("{0}\t// Metadata.xml XPath method reference: path=\"{1}/method[@name='{2}'{3}]\"", indent, gen.Gen.MetadataXPathReference, property.Setter.JavaName, property.Setter.Parameters.GetMethodXPathPredicate ()); - if (property.Setter.GenericArguments != null && property.Setter.GenericArguments.Any ()) - writer.WriteLine ("{0}{1}", indent, property.Setter.GenericArguments.ToGeneratedAttributeString ()); - writer.WriteLine ("{0}\t[Register (\"{1}\", \"{2}\", \"{3}:{4}\"{5})] set {{", indent, property.Setter.JavaName, property.Setter.JniSignature, property.Setter.ConnectorName, property.Setter.GetAdapterName (opt, adapter), property.Setter.AdditionalAttributeString ()); - - // Temporarily rename the parameter to "value" - var pname = property.Setter.Parameters [0].Name; - property.Setter.Parameters [0].Name = "value"; - writer.WriteLine ("{0}\t\t{1} = {2};", indent, property.Name, property.Setter.Parameters.GetGenericCall (opt, mappings)); - property.Setter.Parameters [0].Name = pname; - - writer.WriteLine ("{0}\t}}", indent); - } - writer.WriteLine ("{0}}}", indent); - writer.WriteLine (); - } - - public void WritePropertyDeclaration (Property property, string indent, GenBase gen, string adapter) - { - writer.WriteLine ("{0}{1} {2} {{", indent, opt.GetTypeReferenceName (property), property.AdjustedName); - if (property.Getter != null) { - if (gen.IsGeneratable) - writer.WriteLine ("{0}\t// Metadata.xml XPath method reference: path=\"{1}/method[@name='{2}'{3}]\"", indent, gen.MetadataXPathReference, property.Getter.JavaName, property.Getter.Parameters.GetMethodXPathPredicate ()); - if (property.Getter.GenericArguments != null && property.Getter.GenericArguments.Any ()) - writer.WriteLine ("{0}{1}", indent, property.Getter.GenericArguments.ToGeneratedAttributeString ()); - writer.WriteLine ("{0}\t[Register (\"{1}\", \"{2}\", \"{3}:{4}\"{5})] get;", indent, property.Getter.JavaName, property.Getter.JniSignature, property.Getter.ConnectorName, property.Getter.GetAdapterName (opt, adapter), property.Getter.AdditionalAttributeString ()); - } - if (property.Setter != null) { - if (gen.IsGeneratable) - writer.WriteLine ("{0}\t// Metadata.xml XPath method reference: path=\"{1}/method[@name='{2}'{3}]\"", indent, gen.MetadataXPathReference, property.Setter.JavaName, property.Setter.Parameters.GetMethodXPathPredicate ()); - if (property.Setter.GenericArguments != null && property.Setter.GenericArguments.Any ()) - writer.WriteLine ("{0}{1}", indent, property.Setter.GenericArguments.ToGeneratedAttributeString ()); - writer.WriteLine ("{0}\t[Register (\"{1}\", \"{2}\", \"{3}:{4}\"{5})] set;", indent, property.Setter.JavaName, property.Setter.JniSignature, property.Setter.ConnectorName, property.Setter.GetAdapterName (opt, adapter), property.Setter.AdditionalAttributeString ()); - } - writer.WriteLine ("{0}}}", indent); - writer.WriteLine (); - } - - public void WritePropertyInvoker (Property property, string indent, GenBase container) - { - WritePropertyCallbacks (property, indent, container); - WriteMethodIdField (property.Getter, indent, invoker: true); - if (property.Setter != null) - WriteMethodIdField (property.Setter, indent, invoker: true); - writer.WriteLine ("{0}public unsafe {1} {2} {{", indent, opt.GetTypeReferenceName (property), property.AdjustedName); - writer.WriteLine ("{0}\tget {{", indent); - WriteMethodInvokerBody (property.Getter, indent + "\t\t"); - writer.WriteLine ("{0}\t}}", indent); - if (property.Setter != null) { - string pname = property.Setter.Parameters [0].Name; - property.Setter.Parameters [0].Name = "value"; - writer.WriteLine ("{0}\tset {{", indent); - WriteMethodInvokerBody (property.Setter, indent + "\t\t"); - writer.WriteLine ("{0}\t}}", indent); - property.Setter.Parameters [0].Name = pname; - } - writer.WriteLine ("{0}}}", indent); - writer.WriteLine (); - } - - public void WritePropertyStringVariant (Property property, string indent) - { - bool is_array = property.Getter.RetVal.IsArray; - writer.WriteLine ("{0}{1} string{2}{4} {3} {{", indent, (property.Setter ?? property.Getter).Visibility, is_array ? "[]" : String.Empty, property.Name, opt.NullableOperator); - if (is_array) - writer.WriteLine ("{0}\tget {{ return CharSequence.ArrayToStringArray ({1}); }}", indent, property.AdjustedName); - else - writer.WriteLine ("{0}\tget {{ return {1} == null ? null : {1}.ToString (); }}", indent, property.AdjustedName); - if (property.Setter != null) { - if (is_array) { - writer.WriteLine ("{0}\tset {{", indent); - writer.WriteLine ("{0}\t\tglobal::Java.Lang.ICharSequence[] jlsa = CharSequence.ArrayFromStringArray (value);", indent); - writer.WriteLine ("{0}\t\t{1} = jlsa;", indent, property.AdjustedName); - writer.WriteLine ("{0}\t\tforeach (var jls in jlsa) if (jls != null) jls.Dispose ();", indent); - writer.WriteLine ("{0}\t}}", indent); - } else { - writer.WriteLine ("{0}\tset {{", indent); - writer.WriteLine ("{0}\t\tvar jls = value == null ? null : new global::Java.Lang.String (value);", indent); - writer.WriteLine ("{0}\t\t{1} = jls;", indent, property.AdjustedName); - writer.WriteLine ("{0}\t\tif (jls != null) jls.Dispose ();", indent); - writer.WriteLine ("{0}\t}}", indent); - } - } - writer.WriteLine ("{0}}}", indent); - writer.WriteLine (); - } - - public virtual void WriteType (GenBase gen, string indent, GenerationInfo gen_info) - { - // Only used for XamarinAndroid code target - if (gen is InterfaceGen iface) - WriteInterface (iface, indent, gen_info); - else if (gen is ClassGen @class) - WriteClass (@class, indent, gen_info); - else - throw new InvalidOperationException ("Unknown GenBase type"); - } - } -} diff --git a/tools/generator/Java.Interop.Tools.Generator.CodeGeneration/JavaInteropCodeGenerator.cs b/tools/generator/Java.Interop.Tools.Generator.CodeGeneration/JavaInteropCodeGenerator.cs index f84e298f4..d13c9fb31 100644 --- a/tools/generator/Java.Interop.Tools.Generator.CodeGeneration/JavaInteropCodeGenerator.cs +++ b/tools/generator/Java.Interop.Tools.Generator.CodeGeneration/JavaInteropCodeGenerator.cs @@ -1,18 +1,21 @@ using System; -using System.Collections.Generic; -using System.Collections.Specialized; using System.IO; using generator.SourceWriters; -using Mono.Options; using Xamarin.SourceWriter; namespace MonoDroid.Generation { - class JavaInteropCodeGenerator : CodeGenerator + class JavaInteropCodeGenerator { + protected TextWriter writer; + protected CodeGenerationOptions opt; - public JavaInteropCodeGenerator (TextWriter writer, CodeGenerationOptions options) : base (writer, options) + public CodeGeneratorContext Context { get; } = new CodeGeneratorContext (); + + public JavaInteropCodeGenerator (TextWriter writer, CodeGenerationOptions options) { + this.writer = writer; + opt = options; } public static string GetInvokeType (string type) @@ -33,7 +36,7 @@ public static string GetInvokeType (string type) }; } - public override void WriteType (GenBase gen, string indent, GenerationInfo gen_info) + public virtual void WriteType (GenBase gen, string indent, GenerationInfo gen_info) { TypeWriter type_writer; @@ -51,18 +54,6 @@ public override void WriteType (GenBase gen, string indent, GenerationInfo gen_i var cw = new CodeWriter (writer, indent); type_writer.Write (cw); } - - internal override void WriteClassHandle (ClassGen type, string indent, bool requireNew) => throw new NotImplementedException (); - internal override void WriteClassHandle (InterfaceGen type, string indent, string declaringType) => throw new NotImplementedException (); - internal override void WriteClassInvokerHandle (ClassGen type, string indent, string declaringType) => throw new NotImplementedException (); - internal override void WriteConstructorBody (Ctor ctor, string indent, StringCollection call_cleanup) => throw new NotImplementedException (); - internal override void WriteConstructorIdField (Ctor ctor, string indent) => throw new NotImplementedException (); - internal override void WriteFieldGetBody (Field field, string indent, GenBase type) => throw new NotImplementedException (); - internal override void WriteFieldIdField (Field field, string indent) => throw new NotImplementedException (); - internal override void WriteFieldSetBody (Field field, string indent, GenBase type) => throw new NotImplementedException (); - internal override void WriteInterfaceInvokerHandle (InterfaceGen type, string indent, string declaringType) => throw new NotImplementedException (); - internal override void WriteMethodBody (Method method, string indent, GenBase type) => throw new NotImplementedException (); - internal override void WriteMethodIdField (Method method, string indent) => throw new NotImplementedException (); } } diff --git a/tools/generator/Java.Interop.Tools.Generator.CodeGeneration/XamarinAndroidCodeGenerator.cs b/tools/generator/Java.Interop.Tools.Generator.CodeGeneration/XamarinAndroidCodeGenerator.cs deleted file mode 100644 index 54239ed0c..000000000 --- a/tools/generator/Java.Interop.Tools.Generator.CodeGeneration/XamarinAndroidCodeGenerator.cs +++ /dev/null @@ -1,259 +0,0 @@ -using System; -using System.ComponentModel.Design; -using System.IO; - -namespace MonoDroid.Generation { - - class XamarinAndroidCodeGenerator : CodeGenerator { - - public XamarinAndroidCodeGenerator (TextWriter writer, CodeGenerationOptions options) : base (writer, options) - { - } - - internal override void WriteClassHandle (ClassGen type, string indent, bool requireNew) - { - - writer.WriteLine ("{0}\tinternal static {1}IntPtr java_class_handle;", indent, requireNew ? "new " : string.Empty); - writer.WriteLine ("{0}\tinternal static {1}IntPtr class_ref {{", indent, requireNew ? "new " : string.Empty); - writer.WriteLine ("{0}\t\tget {{", indent); - writer.WriteLine ("{0}\t\t\treturn JNIEnv.FindClass (\"{1}\", ref java_class_handle);", indent, type.RawJniName); - writer.WriteLine ("{0}\t\t}}", indent); - writer.WriteLine ("{0}\t}}", indent); - writer.WriteLine (); - if (type.BaseGen != null && type.InheritsObject) { - writer.WriteLine ("{0}\tprotected override IntPtr ThresholdClass {{", indent); - writer.WriteLine ("{0}\t\tget {{ return class_ref; }}", indent); - writer.WriteLine ("{0}\t}}", indent); - writer.WriteLine (); - writer.WriteLine ("{0}\tprotected override global::System.Type ThresholdType {{", indent); - writer.WriteLine ("{0}\t\tget {{ return typeof ({1}); }}", indent, type.Name); - writer.WriteLine ("{0}\t}}", indent); - writer.WriteLine (); - } - } - - internal override void WriteClassHandle (InterfaceGen type, string indent, string declaringType) - { - writer.WriteLine ("{0}new static IntPtr class_ref = JNIEnv.FindClass (\"{1}\");", indent, type.RawJniName); - } - - internal override void WriteClassInvokerHandle (ClassGen type, string indent, string declaringType) - { - writer.WriteLine ("{0}protected override global::System.Type ThresholdType {{", indent); - writer.WriteLine ("{0}\tget {{ return typeof ({1}); }}", indent, declaringType); - writer.WriteLine ("{0}}}", indent); - writer.WriteLine (); - } - - internal override void WriteInterfaceInvokerHandle (InterfaceGen type, string indent, string declaringType) - { - writer.WriteLine ("{0}static IntPtr java_class_ref = JNIEnv.FindClass (\"{1}\");", indent, type.RawJniName); - writer.WriteLine (); - writer.WriteLine ("{0}protected override IntPtr ThresholdClass {{", indent); - writer.WriteLine ("{0}\tget {{ return class_ref; }}", indent); - writer.WriteLine ("{0}}}", indent); - writer.WriteLine (); - writer.WriteLine ("{0}protected override global::System.Type ThresholdType {{", indent); - writer.WriteLine ("{0}\tget {{ return typeof ({1}); }}", indent, declaringType); - writer.WriteLine ("{0}}}", indent); - writer.WriteLine (); - } - - internal override void WriteConstructorIdField (Ctor ctor, string indent) - { - writer.WriteLine ("{0}static IntPtr {1};", indent, ctor.ID); - } - - internal override void WriteConstructorBody (Ctor ctor, string indent, System.Collections.Specialized.StringCollection call_cleanup) - { - writer.WriteLine ("{0}if ({1} != IntPtr.Zero)", indent, Context.ContextType.GetObjectHandleProperty (opt, "this")); - writer.WriteLine ("{0}\treturn;", indent); - writer.WriteLine (); - foreach (string prep in ctor.Parameters.GetCallPrep (opt)) - writer.WriteLine ("{0}{1}", indent, prep); - writer.WriteLine ("{0}try {{", indent); - var oldindent = indent; - indent += "\t"; - WriteParameterListCallArgs (ctor.Parameters, indent, invoker:false); - writer.WriteLine ("{0}if (((object) this).GetType () != typeof ({1})) {{", indent, ctor.Name); - writer.WriteLine ("{0}\tSetHandle (", indent); - writer.WriteLine ("{0}\t\t\tglobal::Android.Runtime.JNIEnv.StartCreateInstance (((object) this).GetType (), \"{1}\"{2}),", - indent, - ctor.IsNonStaticNestedType ? "(" + ctor.Parameters.GetJniNestedDerivedSignature (opt) + ")V" : ctor.JniSignature, - ctor.Parameters.GetCallArgs (opt, invoker:false)); - writer.WriteLine ("{0}\t\t\tJniHandleOwnership.TransferLocalRef);", indent); - writer.WriteLine ("{0}\tglobal::Android.Runtime.JNIEnv.FinishCreateInstance ({1}, \"{2}\"{3});", - indent, - Context.ContextType.GetObjectHandleProperty (opt, "this"), - ctor.IsNonStaticNestedType ? "(" + ctor.Parameters.GetJniNestedDerivedSignature (opt) + ")V" : ctor.JniSignature, - ctor.Parameters.GetCallArgs (opt, invoker:false)); - writer.WriteLine ("{0}\treturn;", indent); - writer.WriteLine ("{0}}}", indent); - writer.WriteLine (); - writer.WriteLine ("{0}if ({1} == IntPtr.Zero)", indent, ctor.ID); - writer.WriteLine ("{0}\t{1} = JNIEnv.GetMethodID (class_ref, \"\", \"{2}\");", indent, ctor.ID, ctor.JniSignature); - writer.WriteLine ("{0}SetHandle (", indent); - writer.WriteLine ("{0}\t\tglobal::Android.Runtime.JNIEnv.StartCreateInstance (class_ref, {1}{2}),", - indent, ctor.ID, ctor.Parameters.GetCallArgs (opt, invoker:false)); - writer.WriteLine ("{0}\t\tJniHandleOwnership.TransferLocalRef);", indent); - writer.WriteLine ("{0}JNIEnv.FinishCreateInstance ({1}, class_ref, {2}{3});", - indent, - Context.ContextType.GetObjectHandleProperty (opt, "this"), - ctor.ID, - ctor.Parameters.GetCallArgs (opt, invoker:false)); - indent = oldindent; - writer.WriteLine ("{0}}} finally {{", indent); - foreach (string cleanup in call_cleanup) - writer.WriteLine ("{0}\t{1}", indent, cleanup); - writer.WriteLine ("{0}}}", indent); - } - - internal override void WriteMethodIdField (Method method, string indent) - { - writer.WriteLine ("{0}static IntPtr {1};", indent, method.EscapedIdName); - } - - void GenerateJNICall (Method method, string indent, string call, bool declare_ret) - { - if (method.IsVoid) - writer.WriteLine ("{0}{1};", indent, call); - else if (method.Parameters.HasCleanup) - writer.WriteLine ("{0}{1}__ret = {2};", indent, declare_ret ? opt.GetTypeReferenceName (method.RetVal) + " " : String.Empty, method.RetVal.FromNative (opt, call, true)); - else - writer.WriteLine ("{0}return {1};", indent, method.RetVal.FromNative (opt, call, true)); - } - - internal override void WriteMethodBody (Method method, string indent, GenBase type) - { - writer.WriteLine ("{0}if ({1} == IntPtr.Zero)", indent, method.EscapedIdName); - writer.WriteLine ("{0}\t{1} = JNIEnv.Get{2}MethodID (class_ref, \"{3}\", \"{4}\");", indent, method.EscapedIdName, method.IsStatic ? "Static" : String.Empty, method.JavaName, method.JniSignature); - bool use_non_virtual = method.IsVirtual && !method.IsAbstract; - foreach (string prep in method.Parameters.GetCallPrep (opt)) - writer.WriteLine ("{0}{1}", indent, prep); - writer.WriteLine ("{0}try {{", indent); - var oldindent = indent; - indent += "\t"; - WriteParameterListCallArgs (method.Parameters, indent, invoker: false); - if (method.IsStatic) { - GenerateJNICall (method, indent, "JNIEnv.CallStatic" + method.RetVal.CallMethodPrefix + "Method (class_ref, " + method.EscapedIdName + method.Parameters.GetCallArgs (opt, invoker:false) + ")", true); - } else if (use_non_virtual) { - writer.WriteLine (); - if (!method.IsVoid && method.Parameters.HasCleanup) - writer.WriteLine ("{0}{1} __ret;", indent, opt.GetTypeReferenceName (method.RetVal)); - writer.WriteLine ("{0}if (((object) this).GetType () == ThresholdType)", indent); - GenerateJNICall (method, indent + "\t", - "JNIEnv.Call" + method.RetVal.CallMethodPrefix + "Method (" + - method.DeclaringType.GetObjectHandleProperty (opt, "this") + - ", " + method.EscapedIdName + method.Parameters.GetCallArgs (opt, invoker:false) + ")", - declare_ret: false); - writer.WriteLine ("{0}else", indent); - GenerateJNICall (method, indent + "\t", - "JNIEnv.CallNonvirtual" + method.RetVal.CallMethodPrefix + "Method (" + - method.DeclaringType.GetObjectHandleProperty (opt, "this") + - ", ThresholdClass, " + - string.Format ("JNIEnv.GetMethodID (ThresholdClass, \"{0}\", \"{1}\")", method.JavaName, method.JniSignature) + - method.Parameters.GetCallArgs (opt, invoker:false) + ")", - false); - } else { - GenerateJNICall ( - method, - indent, - "JNIEnv.Call" + method.RetVal.CallMethodPrefix + "Method (" + - method.DeclaringType.GetObjectHandleProperty (opt, "this") + - ", " + method.EscapedIdName + - method.Parameters.GetCallArgs (opt, invoker:false) + ")", - declare_ret: true); - } - - if (!method.IsVoid && method.Parameters.HasCleanup) - writer.WriteLine ("{0}return __ret;", indent); - indent = oldindent; - writer.WriteLine ("{0}}} finally {{", indent); - foreach (string cleanup in method.Parameters.GetCallCleanup (opt)) - writer.WriteLine ("{0}\t{1}", indent, cleanup); - writer.WriteLine ("{0}}}", indent); - } - - internal override void WriteFieldIdField (Field field, string indent) - { - writer.WriteLine ("{0}static IntPtr {1};", indent, field.ID); - } - - internal override void WriteFieldGetBody (Field field, string indent, GenBase type) - { - writer.WriteLine ("{0}if ({1} == IntPtr.Zero)", indent, field.ID); - writer.WriteLine ("{0}\t{1} = JNIEnv.Get{2}FieldID (class_ref, \"{3}\", \"{4}\");", indent, field.ID, field.IsStatic ? "Static" : String.Empty, field.JavaName, field.Symbol.JniName); - string call = String.Format ("JNIEnv.Get{0}{1}Field ({2}, {3})", - field.IsStatic - ? "Static" - : String.Empty, - field.GetMethodPrefix, - field.IsStatic - ? "class_ref" - : type.GetObjectHandleProperty (opt, "this"), - field.ID); - - //var asym = Symbol as ArraySymbol; - if (field.Symbol.IsArray) { - writer.WriteLine ("{0}return global::Android.Runtime.JavaArray<{1}>.FromJniHandle ({2}, JniHandleOwnership.TransferLocalRef);", indent, opt.GetOutputName (field.Symbol.ElementType), call); - } - else if (field.Symbol.NativeType != field.Symbol.FullName) { - writer.WriteLine ("{0}{1} __ret = {2};", indent, field.Symbol.NativeType, call); - writer.WriteLine ("{0}return {1};", indent, field.Symbol.FromNative (opt, "__ret", true)); - } else { - writer.WriteLine ("{0}return {1};", indent, call); - } - } - - internal override void WriteFieldSetBody (Field field, string indent, GenBase type) - { - writer.WriteLine ("{0}if ({1} == IntPtr.Zero)", indent, field.ID); - writer.WriteLine ("{0}\t{1} = JNIEnv.Get{2}FieldID (class_ref, \"{3}\", \"{4}\");", indent, field.ID, field.IsStatic ? "Static" : String.Empty, field.JavaName, field.Symbol.JniName); - - string arg; - bool have_prep = false; - if (field.Symbol.IsArray) { - arg = opt.GetSafeIdentifier (TypeNameUtilities.GetNativeName ("value")); - writer.WriteLine ("{0}IntPtr {1} = global::Android.Runtime.JavaArray<{2}>.ToLocalJniHandle (value);", indent, arg, opt.GetOutputName (field.Symbol.ElementType)); - } else { - foreach (string prep in field.SetParameters.GetCallPrep (opt)) { - have_prep = true; - writer.WriteLine ("{0}{1}", indent, prep); - } - - arg = field.SetParameters [0].ToNative (opt); - if (field.SetParameters.HasCleanup && !have_prep) { - arg = opt.GetSafeIdentifier (TypeNameUtilities.GetNativeName ("value")); - writer.WriteLine ("{0}IntPtr {1} = JNIEnv.ToLocalJniHandle (value);", indent, arg); - } - } - - writer.WriteLine ("{0}try {{", indent); - - writer.WriteLine ("{0}\tJNIEnv.Set{1}Field ({2}, {3}, {4});", - indent, - field.IsStatic - ? "Static" - : String.Empty, - field.IsStatic - ? "class_ref" - : type.GetObjectHandleProperty (opt, "this"), - field.ID, - arg); - - writer.WriteLine ("{0}}} finally {{", indent); - if (field.Symbol.IsArray) { - writer.WriteLine ("{0}\tJNIEnv.DeleteLocalRef ({1});", indent, arg); - - } else { - foreach (string cleanup in field.SetParameters.GetCallCleanup (opt)) - writer.WriteLine ("{0}\t{1}", indent, cleanup); - if (field.SetParameters.HasCleanup && !have_prep) { - writer.WriteLine ("{0}\tJNIEnv.DeleteLocalRef ({1});", indent, arg); - } - } - writer.WriteLine ("{0}}}", indent); - } - } -} - diff --git a/tools/generator/Java.Interop.Tools.Generator.ObjectModel/ClassGen.cs b/tools/generator/Java.Interop.Tools.Generator.ObjectModel/ClassGen.cs index ccdcd174d..b70aa42a3 100644 --- a/tools/generator/Java.Interop.Tools.Generator.ObjectModel/ClassGen.cs +++ b/tools/generator/Java.Interop.Tools.Generator.ObjectModel/ClassGen.cs @@ -144,9 +144,7 @@ public override void Generate (CodeGenerationOptions opt, GenerationInfo gen_inf if (opt.CodeGenerationTarget != CodeGenerationTarget.JavaInterop1) { sw.WriteLine ("using Android.Runtime;"); } - if (opt.CodeGenerationTarget != CodeGenerationTarget.XamarinAndroid) { - sw.WriteLine ("using Java.Interop;"); - } + sw.WriteLine ("using Java.Interop;"); sw.WriteLine (); var hasNamespace = !string.IsNullOrWhiteSpace (Namespace); if (hasNamespace) { diff --git a/tools/generator/Java.Interop.Tools.Generator.ObjectModel/InterfaceGen.cs b/tools/generator/Java.Interop.Tools.Generator.ObjectModel/InterfaceGen.cs index 4b111554b..5a61a8fcc 100644 --- a/tools/generator/Java.Interop.Tools.Generator.ObjectModel/InterfaceGen.cs +++ b/tools/generator/Java.Interop.Tools.Generator.ObjectModel/InterfaceGen.cs @@ -89,9 +89,7 @@ public override void Generate (CodeGenerationOptions opt, GenerationInfo gen_inf if (opt.CodeGenerationTarget != CodeGenerationTarget.JavaInterop1) { sw.WriteLine ("using Android.Runtime;"); } - if (opt.CodeGenerationTarget != CodeGenerationTarget.XamarinAndroid) { - sw.WriteLine ("using Java.Interop;"); - } + sw.WriteLine ("using Java.Interop;"); sw.WriteLine (); var hasNamespace = !string.IsNullOrWhiteSpace (Namespace); if (hasNamespace) { diff --git a/tools/generator/Java.Interop.Tools.Generator.ObjectModel/Parameter.cs b/tools/generator/Java.Interop.Tools.Generator.ObjectModel/Parameter.cs index 1b99758cb..7bf81e1c0 100644 --- a/tools/generator/Java.Interop.Tools.Generator.ObjectModel/Parameter.cs +++ b/tools/generator/Java.Interop.Tools.Generator.ObjectModel/Parameter.cs @@ -44,8 +44,6 @@ public string GetCall (CodeGenerationOptions opt) var c = rgm != null ? opt.GetSafeIdentifier (rgm.ToInteroperableJavaObject (Name)) : ToNative (opt); - if (opt.CodeGenerationTarget == CodeGenerationTarget.XamarinAndroid) - return c; if (sym.NativeType != "IntPtr") return c; if (!NeedsPrep) diff --git a/tools/generator/Java.Interop.Tools.Generator.ObjectModel/ParameterList.cs b/tools/generator/Java.Interop.Tools.Generator.ObjectModel/ParameterList.cs index 859156341..4efc54e77 100644 --- a/tools/generator/Java.Interop.Tools.Generator.ObjectModel/ParameterList.cs +++ b/tools/generator/Java.Interop.Tools.Generator.ObjectModel/ParameterList.cs @@ -78,7 +78,7 @@ public string GetCallArgs (CodeGenerationOptions opt, bool invoker) { if (items.Count != 0) return ", __args"; - if (opt.CodeGenerationTarget == CodeGenerationTarget.XamarinAndroid || invoker) + if (invoker) return ""; return ", null"; }