masesgroup/JNet

Update listeners generation to manage original class

masesdevelopers opened this issue · 4 comments

The problem is strictly related to listeners and comes from many things:

To avoid the problem the code shall be updated to:

Originally posted by @masesdevelopers in masesgroup/KNet#448 (comment)

The idea is to update JNetReflector to create a new class, beside each listener, which:

In case the listener interface is returned back from a method, create an extra method. beside the original one, which uses the new generated class to wrap the JVM reference.

Latest version of JCOBridge introduced a limitation on method CastTo which raises in

return entry.CastTo<ParameterizedType>().GetGenerics(genArguments, genClause, prefix, reportNative, usedInGenerics, camel, out mustBeAvoided);
the following exception System.InvalidOperationException: java/lang/reflect/Type cannot be converted to java/lang/reflect/ParameterizedType even if the previous test in
else if (entry.IsInstanceOf<ParameterizedType>())
passed.

The direct class e.g.

public partial class ActionListenerDirect : ActionListener
misses all members like IsBridgeInterface and so on, plus IsBridgeListener shall becomes false.

Meanwhile add the missing developed classes (see https://github.com/masesgroup/JNet/actions/runs/9080784354/job/24953109309)

, plus IsBridgeListener shall becomes false.

On IsBridgeListener cannot be done an override, however the side-by-side Direct class shall be used only as wrapper and never can be instantiated from CLR.

All developed classes under Java.Util.Function namespace shall have the Direct counterpart