diff --git a/tools/generator/Java.Interop.Tools.Generator.Importers/CecilApiImporter.cs b/tools/generator/Java.Interop.Tools.Generator.Importers/CecilApiImporter.cs index 1cfa86492..d7df3baee 100644 --- a/tools/generator/Java.Interop.Tools.Generator.Importers/CecilApiImporter.cs +++ b/tools/generator/Java.Interop.Tools.Generator.Importers/CecilApiImporter.cs @@ -191,7 +191,7 @@ public static Method CreateMethod (GenBase declaringType, MethodDefinition m) IsAbstract = m.IsAbstract, IsAcw = reg_attr != null, IsFinal = m.IsFinal, - IsInterfaceDefaultMethod = GetJavaDefaultInterfaceMethodAttribute (m.CustomAttributes) != null, + IsInterfaceDefaultMethod = IsDefaultInterfaceMethod (declaringType, m), IsReturnEnumified = GetGeneratedEnumAttribute (m.MethodReturnType.CustomAttributes) != null, IsStatic = m.IsStatic, IsVirtual = m.IsVirtual, @@ -248,5 +248,16 @@ static string GetObsoleteComment (CustomAttribute attribute) => static CustomAttribute GetRegisterAttribute (Collection attributes) => attributes.FirstOrDefault (a => a.AttributeType.FullNameCorrected () == "Android.Runtime.RegisterAttribute"); + + static bool IsDefaultInterfaceMethod (GenBase declaringType, MethodDefinition method) + { + if (!(declaringType is InterfaceGen)) + return false; + + if (GetJavaDefaultInterfaceMethodAttribute (method.CustomAttributes) != null) + return true; + + return !method.IsAbstract && !method.IsStatic; + } } }