Skip to content

Commit

Permalink
Update on #552
Browse files Browse the repository at this point in the history
  • Loading branch information
masesdevelopers committed Sep 27, 2024
1 parent e254674 commit 6424962
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/net/JNetReflector/InternalMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ static void PrepareSingleClass(this Class jClass, IEnumerable<Class> 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;
Expand Down Expand Up @@ -2127,7 +2127,7 @@ static string AnalyzeMethods(this Class classDefinition, IEnumerable<Class> 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);

Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 6424962

Please sign in to comment.