public bool ContainsMethod(Method method, bool check_ifaces, bool check_base_ifaces) { // background: bug #10123. // Visibility check was introduced - and required so far - to block "public overrides protected" methods // (which is allowed in Java but not in C#). // The problem is, it does not *always* result in error and generates callable code, and we depend on // that fact in several classes that implements some interface that requires "public Object clone()". // // This visibility inconsistency results in 1) error for abstract methods and 2) warning for virtual methods. // Hence, for abstract methods we dare to ignore visibility difference and treat it as override, // *then* C# compiler will report this inconsistency as error that users need to fix manually, but // with obvious message saying "it is because of visibility consistency", // not "abstract member not implemented" (it is *implemented* in different visibility and brings confusion). // For virtual methods, just check the visibility difference and treat as different method. // Regardless of whether it is actually an override or not, we just invoke Java method. if (jni_sig_hash.ContainsKey(method.JavaName + method.JniSignature)) { var bm = jni_sig_hash [method.JavaName + method.JniSignature]; if (bm.Visibility == method.Visibility || bm.IsAbstract) { return(true); } } if (check_ifaces) { foreach (ISymbol isym in Interfaces) { InterfaceGen igen = (isym is GenericSymbol ? (isym as GenericSymbol).Gen : isym) as InterfaceGen; if (igen != null && igen.ContainsMethod(method, true)) { return(true); } } } return(BaseSymbol != null && BaseSymbol.ContainsMethod(method, check_base_ifaces, check_base_ifaces)); }