From 101093aee064da4c027ee4020c46a21279839389 Mon Sep 17 00:00:00 2001 From: Joao Matos Date: Fri, 24 Nov 2017 14:34:06 +0000 Subject: [PATCH] [java] Rewrite method identifier method to handle more cases. --- binder/Generators/Java/JavaSources.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/binder/Generators/Java/JavaSources.cs b/binder/Generators/Java/JavaSources.cs index 9eaa523..4ecbfd0 100644 --- a/binder/Generators/Java/JavaSources.cs +++ b/binder/Generators/Java/JavaSources.cs @@ -277,13 +277,19 @@ namespace Embeddinator.Generators return true; } + static Declaration GetRootAssociatedDecl(Declaration decl) + { + while (decl.AssociatedDeclaration != null) + decl = decl.AssociatedDeclaration; + + return decl; + } + public static string GetMethodIdentifier(Method method) { var name = method.Name; - var @class = method.Namespace as Class; - - var associated = method.AssociatedDeclaration ?? method; + var associated = GetRootAssociatedDecl(method); if (associated.DefinitionOrder != 0) name += $"_{associated.DefinitionOrder}";