public override void ProcessType(TypeDefinition type) { // If this isn't a JLO or IJavaObject implementer, // then we don't need to MarkJavaObjects if (!type.ImplementsIJavaObject ()) return; PreserveJavaObjectImplementation (type); if (IsImplementor (type)) PreserveImplementor (type); // If a user overrode a method, we need to preserve it, // because it won't be referenced anywhere, but it will // be called from Java if (IsUserType (type) && type.HasMethods) { foreach (var method in type.Methods.Where (m => m.Overrides != null)) PreserveMethod (type, method); } }
protected override void DoAdditionalTypeProcessing(TypeDefinition type) { // If we are preserving a Mono.Android interface, // preserve all members on the interface. if (!type.IsInterface) return; // Mono.Android interfaces will always inherit IJavaObject if (!type.ImplementsIJavaObject ()) return; foreach (MethodReference method in type.Methods) MarkMethod (method); // We also need to preserve the interface adapter string adapter; if (!TryGetRegisterMember (type, out adapter)) return; // This is a fast path for finding the adapter type var adapter_type = type.DeclaringType.GetNestedType (adapter); // It wasn't in the same containing type, look through the whole assembly if (adapter_type == null) adapter_type = type.Module.FindType (adapter); if (adapter_type == null) return; MarkType (adapter_type); // We also need to preserve every member on the interface adapter foreach (MethodReference m in adapter_type.Methods) MarkMethod (m); }