diff --git a/tools/generator/InterfaceGen.cs b/tools/generator/InterfaceGen.cs index cc08830bc..337327a27 100644 --- a/tools/generator/InterfaceGen.cs +++ b/tools/generator/InterfaceGen.cs @@ -224,7 +224,7 @@ void GenerateInvoker (StreamWriter sw, string indent, CodeGenerationOptions opt) sw.WriteLine ("{0}internal class {1}Invoker : global::Java.Lang.Object, {1} {{", indent, Name); sw.WriteLine (); opt.CodeGenerator.WriteInterfaceInvokerHandle (this, sw, indent + "\t", opt, Name + "Invoker"); - sw.WriteLine ("{0}\tIntPtr class_ref;", indent); + sw.WriteLine ("{0}\tnew IntPtr class_ref;", indent); sw.WriteLine (); sw.WriteLine ("{0}\tpublic static {1} GetObject (IntPtr handle, JniHandleOwnership transfer)", indent, Name); sw.WriteLine ("{0}\t{{", indent); diff --git a/tools/generator/Tests/BaseGeneratorTest.cs b/tools/generator/Tests/BaseGeneratorTest.cs index 4a0283bd4..eed177534 100644 --- a/tools/generator/Tests/BaseGeneratorTest.cs +++ b/tools/generator/Tests/BaseGeneratorTest.cs @@ -30,6 +30,7 @@ public void Setup () protected CodeGeneratorOptions Options = null; protected Assembly BuiltAssembly = null; protected List AdditionalSourceDirectories; + protected bool AllowWarnings; public void Execute () { @@ -41,7 +42,7 @@ public void Execute () bool hasErrors; string compilerOutput; BuiltAssembly = Compiler.Compile (Options, "Mono.Android", AdditionalSourceDirectories, - out hasErrors, out compilerOutput); + out hasErrors, out compilerOutput, AllowWarnings); Assert.AreEqual (false, hasErrors, compilerOutput); Assert.IsNotNull (BuiltAssembly); } diff --git a/tools/generator/Tests/Compiler.cs b/tools/generator/Tests/Compiler.cs index f897acb8e..9c74b99e6 100644 --- a/tools/generator/Tests/Compiler.cs +++ b/tools/generator/Tests/Compiler.cs @@ -33,7 +33,7 @@ static CodeDomProvider GetCodeDomProvider () public static Assembly Compile (Xamarin.Android.Binder.CodeGeneratorOptions options, string assemblyFileName, IEnumerable AdditionalSourceDirectories, - out bool hasErrors, out string output) + out bool hasErrors, out string output, bool allowWarnings) { var generatedCodePath = options.ManagedCallableWrapperSourceOutputDirectory; var sourceFiles = Directory.EnumerateFiles (generatedCodePath, "*.cs", @@ -73,7 +73,7 @@ public static Assembly Compile (Xamarin.Android.Binder.CodeGeneratorOptions opti hasErrors = false; foreach (CompilerError message in results.Errors) { - hasErrors = hasErrors || (!message.IsWarning); + hasErrors |= !message.IsWarning || !allowWarnings; } output = string.Join (Environment.NewLine, results.Output.Cast ()); diff --git a/tools/generator/Tests/Interfaces.cs b/tools/generator/Tests/Interfaces.cs index d0c4c6754..da37b4d9b 100644 --- a/tools/generator/Tests/Interfaces.cs +++ b/tools/generator/Tests/Interfaces.cs @@ -9,6 +9,7 @@ public class Interfaces : BaseGeneratorTest [Test] public void Generated_OK () { + AllowWarnings = true; RunAllTargets ( outputRelativePath: "TestInterface", apiDescriptionFile: "expected/TestInterface/TestInterface.xml", diff --git a/tools/generator/Tests/NormalMethods.cs b/tools/generator/Tests/NormalMethods.cs index bf9bec07f..0d37526c3 100644 --- a/tools/generator/Tests/NormalMethods.cs +++ b/tools/generator/Tests/NormalMethods.cs @@ -9,6 +9,7 @@ public class NormalMethods : BaseGeneratorTest [Test] public void GeneratedOK () { + AllowWarnings = true; RunAllTargets ( outputRelativePath: "NormalMethods", apiDescriptionFile: "expected/NormalMethods/NormalMethods.xml", diff --git a/tools/generator/Tests/expected.ji/Adapters/Xamarin.Test.IAdapter.cs b/tools/generator/Tests/expected.ji/Adapters/Xamarin.Test.IAdapter.cs index 2d6187ef5..95f733283 100644 --- a/tools/generator/Tests/expected.ji/Adapters/Xamarin.Test.IAdapter.cs +++ b/tools/generator/Tests/expected.ji/Adapters/Xamarin.Test.IAdapter.cs @@ -32,7 +32,7 @@ protected override IntPtr ThresholdClass { get { return _members.ManagedPeerType; } } - IntPtr class_ref; + new IntPtr class_ref; public static IAdapter GetObject (IntPtr handle, JniHandleOwnership transfer) { diff --git a/tools/generator/Tests/expected.ji/Adapters/Xamarin.Test.ISpinnerAdapter.cs b/tools/generator/Tests/expected.ji/Adapters/Xamarin.Test.ISpinnerAdapter.cs index 9d04b4c0c..efb26daa0 100644 --- a/tools/generator/Tests/expected.ji/Adapters/Xamarin.Test.ISpinnerAdapter.cs +++ b/tools/generator/Tests/expected.ji/Adapters/Xamarin.Test.ISpinnerAdapter.cs @@ -32,7 +32,7 @@ protected override IntPtr ThresholdClass { get { return _members.ManagedPeerType; } } - IntPtr class_ref; + new IntPtr class_ref; public static ISpinnerAdapter GetObject (IntPtr handle, JniHandleOwnership transfer) { diff --git a/tools/generator/Tests/expected.ji/GenericArguments/Com.Google.Android.Exoplayer.Drm.IExoMediaDrm.cs b/tools/generator/Tests/expected.ji/GenericArguments/Com.Google.Android.Exoplayer.Drm.IExoMediaDrm.cs index e20848e86..99332d91a 100644 --- a/tools/generator/Tests/expected.ji/GenericArguments/Com.Google.Android.Exoplayer.Drm.IExoMediaDrm.cs +++ b/tools/generator/Tests/expected.ji/GenericArguments/Com.Google.Android.Exoplayer.Drm.IExoMediaDrm.cs @@ -37,7 +37,7 @@ protected override IntPtr ThresholdClass { get { return _members.ManagedPeerType; } } - IntPtr class_ref; + new IntPtr class_ref; public static IExoMediaDrmOnEventListener GetObject (IntPtr handle, JniHandleOwnership transfer) { @@ -217,7 +217,7 @@ protected override IntPtr ThresholdClass { get { return _members.ManagedPeerType; } } - IntPtr class_ref; + new IntPtr class_ref; public static IExoMediaDrm GetObject (IntPtr handle, JniHandleOwnership transfer) { diff --git a/tools/generator/Tests/expected.ji/NestedTypes/Xamarin.Test.NotificationCompatBase.cs b/tools/generator/Tests/expected.ji/NestedTypes/Xamarin.Test.NotificationCompatBase.cs index 8637c3507..e48e159b7 100644 --- a/tools/generator/Tests/expected.ji/NestedTypes/Xamarin.Test.NotificationCompatBase.cs +++ b/tools/generator/Tests/expected.ji/NestedTypes/Xamarin.Test.NotificationCompatBase.cs @@ -44,7 +44,7 @@ protected override IntPtr ThresholdClass { get { return _members.ManagedPeerType; } } - IntPtr class_ref; + new IntPtr class_ref; public static IFactory GetObject (IntPtr handle, JniHandleOwnership transfer) { diff --git a/tools/generator/Tests/expected.ji/TestInterface/Test.ME.IGenericInterface.cs b/tools/generator/Tests/expected.ji/TestInterface/Test.ME.IGenericInterface.cs index 831b1a05f..e065c3cf8 100644 --- a/tools/generator/Tests/expected.ji/TestInterface/Test.ME.IGenericInterface.cs +++ b/tools/generator/Tests/expected.ji/TestInterface/Test.ME.IGenericInterface.cs @@ -37,7 +37,7 @@ protected override IntPtr ThresholdClass { get { return _members.ManagedPeerType; } } - IntPtr class_ref; + new IntPtr class_ref; public static IGenericInterface GetObject (IntPtr handle, JniHandleOwnership transfer) { diff --git a/tools/generator/Tests/expected.ji/TestInterface/Test.ME.ITestInterface.cs b/tools/generator/Tests/expected.ji/TestInterface/Test.ME.ITestInterface.cs index 7ad9c9352..3f1ceb93b 100644 --- a/tools/generator/Tests/expected.ji/TestInterface/Test.ME.ITestInterface.cs +++ b/tools/generator/Tests/expected.ji/TestInterface/Test.ME.ITestInterface.cs @@ -98,7 +98,7 @@ protected override IntPtr ThresholdClass { get { return _members.ManagedPeerType; } } - IntPtr class_ref; + new IntPtr class_ref; public static ITestInterface GetObject (IntPtr handle, JniHandleOwnership transfer) { diff --git a/tools/generator/Tests/expected.ji/java.lang.Enum/Java.Lang.IComparable.cs b/tools/generator/Tests/expected.ji/java.lang.Enum/Java.Lang.IComparable.cs index feafedf01..20f968c8b 100644 --- a/tools/generator/Tests/expected.ji/java.lang.Enum/Java.Lang.IComparable.cs +++ b/tools/generator/Tests/expected.ji/java.lang.Enum/Java.Lang.IComparable.cs @@ -37,7 +37,7 @@ protected override IntPtr ThresholdClass { get { return _members.ManagedPeerType; } } - IntPtr class_ref; + new IntPtr class_ref; public static IComparable GetObject (IntPtr handle, JniHandleOwnership transfer) { diff --git a/tools/generator/Tests/expected/Adapters/Xamarin.Test.IAdapter.cs b/tools/generator/Tests/expected/Adapters/Xamarin.Test.IAdapter.cs index 42283f0a7..4e5def0a3 100644 --- a/tools/generator/Tests/expected/Adapters/Xamarin.Test.IAdapter.cs +++ b/tools/generator/Tests/expected/Adapters/Xamarin.Test.IAdapter.cs @@ -23,7 +23,7 @@ protected override IntPtr ThresholdClass { get { return typeof (IAdapterInvoker); } } - IntPtr class_ref; + new IntPtr class_ref; public static IAdapter GetObject (IntPtr handle, JniHandleOwnership transfer) { diff --git a/tools/generator/Tests/expected/Adapters/Xamarin.Test.ISpinnerAdapter.cs b/tools/generator/Tests/expected/Adapters/Xamarin.Test.ISpinnerAdapter.cs index 9030318b0..e72c86c1d 100644 --- a/tools/generator/Tests/expected/Adapters/Xamarin.Test.ISpinnerAdapter.cs +++ b/tools/generator/Tests/expected/Adapters/Xamarin.Test.ISpinnerAdapter.cs @@ -23,7 +23,7 @@ protected override IntPtr ThresholdClass { get { return typeof (ISpinnerAdapterInvoker); } } - IntPtr class_ref; + new IntPtr class_ref; public static ISpinnerAdapter GetObject (IntPtr handle, JniHandleOwnership transfer) { diff --git a/tools/generator/Tests/expected/GenericArguments/Com.Google.Android.Exoplayer.Drm.IExoMediaDrm.cs b/tools/generator/Tests/expected/GenericArguments/Com.Google.Android.Exoplayer.Drm.IExoMediaDrm.cs index 640be49c6..c0be423e5 100644 --- a/tools/generator/Tests/expected/GenericArguments/Com.Google.Android.Exoplayer.Drm.IExoMediaDrm.cs +++ b/tools/generator/Tests/expected/GenericArguments/Com.Google.Android.Exoplayer.Drm.IExoMediaDrm.cs @@ -28,7 +28,7 @@ protected override IntPtr ThresholdClass { get { return typeof (IExoMediaDrmOnEventListenerInvoker); } } - IntPtr class_ref; + new IntPtr class_ref; public static IExoMediaDrmOnEventListener GetObject (IntPtr handle, JniHandleOwnership transfer) { @@ -200,7 +200,7 @@ protected override IntPtr ThresholdClass { get { return typeof (IExoMediaDrmInvoker); } } - IntPtr class_ref; + new IntPtr class_ref; public static IExoMediaDrm GetObject (IntPtr handle, JniHandleOwnership transfer) { diff --git a/tools/generator/Tests/expected/NestedTypes/Xamarin.Test.NotificationCompatBase.cs b/tools/generator/Tests/expected/NestedTypes/Xamarin.Test.NotificationCompatBase.cs index a4f375d34..5e3c8549b 100644 --- a/tools/generator/Tests/expected/NestedTypes/Xamarin.Test.NotificationCompatBase.cs +++ b/tools/generator/Tests/expected/NestedTypes/Xamarin.Test.NotificationCompatBase.cs @@ -35,7 +35,7 @@ protected override IntPtr ThresholdClass { get { return typeof (IFactoryInvoker); } } - IntPtr class_ref; + new IntPtr class_ref; public static IFactory GetObject (IntPtr handle, JniHandleOwnership transfer) { diff --git a/tools/generator/Tests/expected/TestInterface/Test.ME.IGenericInterface.cs b/tools/generator/Tests/expected/TestInterface/Test.ME.IGenericInterface.cs index e9f632830..190f6165b 100644 --- a/tools/generator/Tests/expected/TestInterface/Test.ME.IGenericInterface.cs +++ b/tools/generator/Tests/expected/TestInterface/Test.ME.IGenericInterface.cs @@ -28,7 +28,7 @@ protected override IntPtr ThresholdClass { get { return typeof (IGenericInterfaceInvoker); } } - IntPtr class_ref; + new IntPtr class_ref; public static IGenericInterface GetObject (IntPtr handle, JniHandleOwnership transfer) { diff --git a/tools/generator/Tests/expected/TestInterface/Test.ME.ITestInterface.cs b/tools/generator/Tests/expected/TestInterface/Test.ME.ITestInterface.cs index 88deed9f7..73a2a585c 100644 --- a/tools/generator/Tests/expected/TestInterface/Test.ME.ITestInterface.cs +++ b/tools/generator/Tests/expected/TestInterface/Test.ME.ITestInterface.cs @@ -90,7 +90,7 @@ protected override IntPtr ThresholdClass { get { return typeof (ITestInterfaceInvoker); } } - IntPtr class_ref; + new IntPtr class_ref; public static ITestInterface GetObject (IntPtr handle, JniHandleOwnership transfer) { diff --git a/tools/generator/Tests/expected/java.lang.Enum/Java.Lang.IComparable.cs b/tools/generator/Tests/expected/java.lang.Enum/Java.Lang.IComparable.cs index 3c8d3694b..9d55ff188 100644 --- a/tools/generator/Tests/expected/java.lang.Enum/Java.Lang.IComparable.cs +++ b/tools/generator/Tests/expected/java.lang.Enum/Java.Lang.IComparable.cs @@ -28,7 +28,7 @@ protected override IntPtr ThresholdClass { get { return typeof (IComparableInvoker); } } - IntPtr class_ref; + new IntPtr class_ref; public static IComparable GetObject (IntPtr handle, JniHandleOwnership transfer) {