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
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,23 @@ static bool CompareTypes (TypeReference iType, TypeReference tType)
return true;
}

bool IsInOverrides (MethodDefinition iMethod, MethodDefinition tMethod)
{
if (!tMethod.HasOverrides)
return false;

foreach (var o in tMethod.Overrides)
if (o != null && iMethod == o.Resolve ())
return true;

return false;
}

bool HaveSameSignature (TypeReference iface, MethodDefinition iMethod, MethodDefinition tMethod)
{
if (IsInOverrides (iMethod, tMethod))
return true;

if (iMethod.Name != tMethod.Name && (iMethod.DeclaringType == null || (iMethod.DeclaringType.DeclaringType == null ? (string.Format ("{0}.{1}", iface.FullName, iMethod.Name) != tMethod.Name) : (string.Format ("{0}.{1}.{2}", iMethod.DeclaringType.DeclaringType, iface.Name, iMethod.Name) != tMethod.Name))))
return false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
public interface Cursor {
void method();
int methodWithRT ();
int methodWithCursor (Cursor cursor);
int methodWithParams (int number, String text);
int methodWithParams (int number, String text, float real);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ public interface Cursor {
void newMethod();
int methodWithRT ();
int newMethodWithRT ();
int methodWithCursor (Cursor cursor);
int methodWithParams (int number, String text);
int newMethodWithParams (int number, String text);
int methodWithParams (int number, String text, float real);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Library
{
public class MyClrCursor : Java.Lang.Object, ICursor
public class MyClrCursor : Java.Lang.Object, global::Test.Bindings.ICursor
{
public void Method ()
{
Expand All @@ -23,6 +23,13 @@ public int MethodWithRT ()
{
return 3;
}

int global::Test.Bindings.ICursor.MethodWithCursor (global::Test.Bindings.ICursor cursor)
{
var a = 2;
var b = 2;
return a + b;
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,11 @@ public void JavaAbstractMethodTest ()
if (e.GetType ().ToString () != "Java.Lang.AbstractMethodError")
throw e;
}

var mi = ic.GetType ().GetMethod ("MethodWithCursor");

if (mi != null && mi.GetMethodBody ().LocalVariables.Count == 0)
throw new Exception ("FixAbstractMethodStep broken, MethodWithRT added, while it should not be");
}

// Context https://bugzilla.xamarin.com/show_bug.cgi?id=36036
Expand Down