diff --git a/src/net/JNetReflector/InternalMethods.cs b/src/net/JNetReflector/InternalMethods.cs index cd6376c1f7..3a17c73aa5 100644 --- a/src/net/JNetReflector/InternalMethods.cs +++ b/src/net/JNetReflector/InternalMethods.cs @@ -29,6 +29,7 @@ using System.Diagnostics; using System.Threading; using System.Threading.Tasks; +using System.Reflection; namespace MASES.JNetReflector { @@ -1426,7 +1427,7 @@ static string AnalyzeMethods(this Class classDefinition, IEnumerable clas else { methodCounter[methodNameOrigin] = ++methodIndexer; - eventHandlerName += paramCount; + eventHandlerName = methodIndexer == 0 ? eventHandlerName : (methodIndexer == 1 ? eventHandlerName + paramCount : eventHandlerName + paramCount + $"_{methodIndexer}"); } List genericArguments = new List(); @@ -1780,7 +1781,7 @@ static string AnalyzeMethods(this Class classDefinition, IEnumerable clas string CLRListenerEventArgsType = string.Empty; string executionPropertyParams = string.Empty; string listenerHandlerType = string.Empty; - string baseHandlerName = methodIndexer == 0 ? methodName : methodName + paramCount; + string baseHandlerName = methodIndexer == 0 ? methodName : (methodIndexer == 1 ? methodName + paramCount : methodName + paramCount + $"_{methodIndexer}"); if (forListener) { executionStub = isVoidMethod ? string.Empty : "return default;"; @@ -1922,7 +1923,7 @@ static string AnalyzeJavaMethods(this Class classDefinition, bool isGeneric) else { methodCounter[methodNameOrigin] = ++methodIndexer; - eventHandlerName += paramCount; + eventHandlerName = methodIndexer == 0 ? eventHandlerName : (methodIndexer == 1 ? eventHandlerName + paramCount : eventHandlerName + paramCount + $"_{methodIndexer}"); } string returnType = method.GenericReturnType.TypeName; diff --git a/src/net/JNetReflector/Templates/Templates.cs b/src/net/JNetReflector/Templates/Templates.cs index 17bcc62555..cb998f9234 100644 --- a/src/net/JNetReflector/Templates/Templates.cs +++ b/src/net/JNetReflector/Templates/Templates.cs @@ -194,7 +194,7 @@ public class MethodStub public const string LISTENER_HANDLER_EXECUTION = "METHOD_STUB_LISTENER_HANDLER_EXECUTION_PLACEHOLDER"; public const string LISTENER_HANDLER_NAME = "METHOD_STUB_LISTENER_HANDLER_NAME_PLACEHOLDER"; public const string LISTENER_FIRST_PARAMETER = "METHOD_STUB_LISTENER_FIRST_PARAMETER_PLACEHOLDER"; - public const string SINGLE_LISTENER_HANDLER_FORMAT = " AddEventHandler(\"{0}\", new System.EventHandler>(METHOD_STUB_LISTENER_HANDLER_NAME_PLACEHOLDEREventHandler)); OnMETHOD_STUB_METHOD_NAME_PLACEHOLDER = METHOD_STUB_METHOD_NAME_PLACEHOLDER;"; + public const string SINGLE_LISTENER_HANDLER_FORMAT = " AddEventHandler(\"{0}\", new System.EventHandler>(METHOD_STUB_LISTENER_HANDLER_NAME_PLACEHOLDEREventHandler)); OnMETHOD_STUB_LISTENER_HANDLER_NAME_PLACEHOLDER = METHOD_STUB_METHOD_NAME_PLACEHOLDER;"; public const string EXECUTION_FORMAT = "{0}{1}{2}(\"{3}\"{4});"; public const string SINGLE_ARRAY_EXECUTION_FORMAT = "new object[] {{ {0} }}"; public const string STATIC_EXECUTION_FORMAT = "{0}{1}{2}(LocalBridgeClazz, \"{3}\"{4});";