From 642496268b6da4b4ca8fbcc5ea1df98f4dc1895a Mon Sep 17 00:00:00 2001 From: masesdevelopers <94312179+masesdevelopers@users.noreply.github.com> Date: Fri, 27 Sep 2024 16:49:52 +0200 Subject: [PATCH] Update on #552 --- src/net/JNetReflector/InternalMethods.cs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/net/JNetReflector/InternalMethods.cs b/src/net/JNetReflector/InternalMethods.cs index 6a945b852a..df95dd5d19 100644 --- a/src/net/JNetReflector/InternalMethods.cs +++ b/src/net/JNetReflector/InternalMethods.cs @@ -870,7 +870,7 @@ static void PrepareSingleClass(this Class jClass, IEnumerable classDefini var clsName = jClass.JVMListenerClassName(); var fullInterfaces = jClass.Name.Replace(SpecialNames.NestedClassSeparator, SpecialNames.NamespaceSeparator); - var javaClassMethodBlock = jClass.AnalyzeJavaMethods(isInterfaceJavaListener, isGeneric).AddTabLevel(1); + var javaClassMethodBlock = jClass.AnalyzeJavaMethods(fullInterfaces, isInterfaceJavaListener, isGeneric).AddTabLevel(1); string singleJavaListenerTemplate = Template.GetTemplate(Template.SingleListenerJavaFileTemplate); string constructorExceptions = string.Empty; @@ -2127,7 +2127,7 @@ static string AnalyzeMethods(this Class classDefinition, IEnumerable clas return returnStr; } - static string AnalyzeJavaMethods(this Class classDefinition, bool isInterfaceJavaListener, bool isGeneric) + static string AnalyzeJavaMethods(this Class classDefinition, string extendingInterface, bool isInterfaceJavaListener, bool isGeneric) { ReportTrace(ReflectionTraceLevel.Info, "******************* Analyze Java Methods of {0} *******************", classDefinition.GenericString); @@ -2279,9 +2279,8 @@ static string AnalyzeJavaMethods(this Class classDefinition, bool isInterfaceJav string execStub; if (isVoidMethod) { - if (method.IsDefault) + if (method.IsDefault && isInterfaceJavaListener) { - var extendingInterface = method.DeclaringClass.Name.Replace(SpecialNames.NestedClassSeparator, SpecialNames.NamespaceSeparator); execStub = string.Format(AllPackageClasses.ClassStub.MethodStub.SUPERINTERFACE_VOID_DEFAULT_EXECUTION_FORMAT, eventHandlerName, executionParamsString.Length == 0 ? string.Empty : ", " + executionParamsString, extendingInterface, methodNameOrigin, executionParamsString); @@ -2306,9 +2305,8 @@ static string AnalyzeJavaMethods(this Class classDefinition, bool isInterfaceJav } else { - if (method.IsDefault) + if (method.IsDefault && isInterfaceJavaListener) { - var extendingInterface = method.DeclaringClass.Name.Replace(SpecialNames.NestedClassSeparator, SpecialNames.NamespaceSeparator); execStub = string.Format(AllPackageClasses.ClassStub.MethodStub.SUPERINTERFACE_TYPED_DEFAULT_EXECUTION_FORMAT, eventHandlerName, executionParamsString.Length == 0 ? string.Empty : ", " + executionParamsString, returnType, extendingInterface, methodNameOrigin, executionParamsString); @@ -2342,9 +2340,8 @@ static string AnalyzeJavaMethods(this Class classDefinition, bool isInterfaceJav subClassBlock.AppendLine(singleMethod); - if (method.IsDefault) + if (method.IsDefault && isInterfaceJavaListener) { - var extendingInterface = method.DeclaringClass.Name.Replace(SpecialNames.NestedClassSeparator, SpecialNames.NamespaceSeparator); execStub = string.Format(isVoidMethod ? AllPackageClasses.ClassStub.MethodStub.SUPERINTERFACE_VOID_LISTENER_EXECUTION_FORMAT : AllPackageClasses.ClassStub.MethodStub.SUPERINTERFACE_TYPED_LISTENER_EXECUTION_FORMAT, extendingInterface, methodNameOrigin, executionParamsString.Length == 0 ? string.Empty : executionParamsString);