diff --git a/tests/generator-Tests/Unit-Tests/DefaultInterfaceMethodsTests.cs b/tests/generator-Tests/Unit-Tests/DefaultInterfaceMethodsTests.cs index 25f737f5c..39f40d380 100644 --- a/tests/generator-Tests/Unit-Tests/DefaultInterfaceMethodsTests.cs +++ b/tests/generator-Tests/Unit-Tests/DefaultInterfaceMethodsTests.cs @@ -431,5 +431,36 @@ public void DontInvalidateInterfaceDueToStaticOrDefaultMethods () Assert.False (generated.Contains ("StaticMethod")); Assert.False (generated.Contains ("DefaultMethod")); } + + [Test] + public void GenerateProperNestedInterfaceSignatures () + { + // https://github.com/xamarin/java.interop/issues/661 + // Ensure that when we write the invoker type for a nested default interface method + // we use `/` to denote nested as needed by Type.GetType () + var xml = @" + + + + + + + + + + + + "; + + var gens = ParseApiDefinition (xml); + var iface = gens[1].NestedTypes.OfType ().Single (); + + generator.WriteInterface (iface, string.Empty, new GenerationInfo (string.Empty, string.Empty, "MyAssembly")); + + var generated = writer.ToString (); + + Assert.True (generated.Contains ("GetOnActivityDestroyed_IHandler:Com.Xamarin.Android.Application/IActivityLifecycleInterface, MyAssembly")); + Assert.False (generated.Contains ("GetOnActivityDestroyed_IHandler:Com.Xamarin.Android.Application.IActivityLifecycleInterface, MyAssembly")); + } } } diff --git a/tools/generator/Java.Interop.Tools.Generator.ObjectModel/Method.cs b/tools/generator/Java.Interop.Tools.Generator.ObjectModel/Method.cs index 6ad71a4e0..cc745390c 100644 --- a/tools/generator/Java.Interop.Tools.Generator.ObjectModel/Method.cs +++ b/tools/generator/Java.Interop.Tools.Generator.ObjectModel/Method.cs @@ -126,7 +126,7 @@ internal string GetAdapterName (CodeGenerationOptions opt, string adapter) } // Connectors for DIM are defined on the interface, not the implementing type - public string GetConnectorNameFull (CodeGenerationOptions opt) => ConnectorName + (opt.SupportDefaultInterfaceMethods && IsInterfaceDefaultMethod ? $":{DeclaringType.FullName}, " + (AssemblyName ?? opt.AssemblyName) : string.Empty); + public string GetConnectorNameFull (CodeGenerationOptions opt) => ConnectorName + (opt.SupportDefaultInterfaceMethods && IsInterfaceDefaultMethod ? $":{DeclaringType.AssemblyQualifiedName}, " + (AssemblyName ?? opt.AssemblyName) : string.Empty); internal string GetDelegateType (CodeGenerationOptions opt) => opt.GetJniMarshalDelegate (this);