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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tools/generator/InterfaceGen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion tools/generator/Tests/BaseGeneratorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public void Setup ()
protected CodeGeneratorOptions Options = null;
protected Assembly BuiltAssembly = null;
protected List<string> AdditionalSourceDirectories;
protected bool AllowWarnings;

public void Execute ()
{
Expand All @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions tools/generator/Tests/Compiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ static CodeDomProvider GetCodeDomProvider ()

public static Assembly Compile (Xamarin.Android.Binder.CodeGeneratorOptions options,
string assemblyFileName, IEnumerable<string> 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",
Expand Down Expand Up @@ -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<string> ());

Expand Down
1 change: 1 addition & 0 deletions tools/generator/Tests/Interfaces.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class Interfaces : BaseGeneratorTest
[Test]
public void Generated_OK ()
{
AllowWarnings = true;
RunAllTargets (
outputRelativePath: "TestInterface",
apiDescriptionFile: "expected/TestInterface/TestInterface.xml",
Expand Down
1 change: 1 addition & 0 deletions tools/generator/Tests/NormalMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class NormalMethods : BaseGeneratorTest
[Test]
public void GeneratedOK ()
{
AllowWarnings = true;
RunAllTargets (
outputRelativePath: "NormalMethods",
apiDescriptionFile: "expected/NormalMethods/NormalMethods.xml",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down