Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using JNet 1.5.5 some limits or constraints of JNetReflector are raised #178

Closed
masesdevelopers opened this issue May 27, 2023 · 6 comments · Fixed by #181
Closed

Using JNet 1.5.5 some limits or constraints of JNetReflector are raised #178

masesdevelopers opened this issue May 27, 2023 · 6 comments · Fixed by #181
Assignees
Labels
bug Something isn't working JNetReflector JNetReflector related issue

Comments

@masesdevelopers
Copy link
Contributor

          Using [JNet 1.5.0](https://github.com/masesgroup/JNet/releases/tag/V1.5.5.0) some limits or constraints of JNetReflector are raised:
  • A class containing main method is reflected using JVMBridgeMain<TClass>, but fields and methods are not available; plus it is not possible to allocate it to use dynamic behavior to access fields and mehods
  • Some language keyword, e.g. event, are not replaced with new one if used in the reflected code

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

@masesdevelopers masesdevelopers changed the title Using [JNet 1.5.0](https://github.com/masesgroup/JNet/releases/tag/V1.5.5.0) some limits or constraints of JNetReflector are raised: Using JNet 1.5.5 some limits or constraints of JNetReflector are raised: May 27, 2023
@masesdevelopers masesdevelopers self-assigned this May 27, 2023
@masesdevelopers masesdevelopers added bug Something isn't working JNetReflector JNetReflector related issue labels May 27, 2023
@masesdevelopers masesdevelopers changed the title Using JNet 1.5.5 some limits or constraints of JNetReflector are raised: Using JNet 1.5.5 some limits or constraints of JNetReflector are raised May 27, 2023
masesdevelopers added a commit to masesdevelopers/JNet that referenced this issue May 31, 2023
…NetBridgeMain, remove keyword from argument names, improved management of generic super-classes, improved management of generics in constructor arguments
masesdevelopers added a commit to masesdevelopers/JNet that referenced this issue May 31, 2023
@masesdevelopers
Copy link
Contributor Author

masesdevelopers commented Jun 2, 2023

Other limitations raised are:

  • Iterator<E> shall be managed like it is done for Iterable<E>
  • A class reported to be Listener does not contains nested classes
  • In some packages (e.g. org.apache.kafka.connect.storage) the classes are created, but AllPackageClasses.cs not contains all classes
  • Add a new switch to rename a class which clash with namespace: current feature does not work if the class name clash happens between different JARs or modules
  • When a namespace is avoided (e.g. org.apache.kafka.common.internals) some methods still reports types from that namespace
  • Some Iterable classes (e.g. ConsumerRecords) inherits from Java.Lang.Iterable<K, V> which is syntactically wrong, the correct superclass is Java.Lang.Iterable<ConsumerRecord<K, V>>
  • Some generic return types are not reported in the right way: e.g. KafkaProducer.Metrics() reports Java.Util.Map, it must be like Java.Util.Map<MetricName, Metric>
  • Some where clause are applied, but the constraints are related to the interfaces which are not reported in the class definition, but as operator associated to the class: the conditions break the applicability of where clause

masesdevelopers added a commit to masesdevelopers/KafkaBridge that referenced this issue Jun 2, 2023
@masesdevelopers
Copy link
Contributor Author

Other limitations raised are:

* In some packages (e.g. `org.apache.kafka.connect.storage`) the classes are created, but `AllPackageClasses.cs` not contains all classes

This issue depends on package name shared between multiple JARs; so when latest JAR is analyzed it overwrites the previous AllPackageClasses.cs file, leaving the some orphan class in the folder

@masesdevelopers
Copy link
Contributor Author

masesdevelopers commented Jun 5, 2023

Other limitations raised are:

* A class reported to be Listener does not contains nested classes

Waiting for #137: create empty classes for listener which accepts nested classes

masesdevelopers added a commit to masesdevelopers/JNet that referenced this issue Jun 5, 2023
@masesdevelopers
Copy link
Contributor Author

masesdevelopers commented Jun 6, 2023

Other limitations raised are:
* Some where clause are applied, but the constraints are related to the interfaces which are not reported in the class definition, but as operator associated to the class: the conditions break the applicability of where clause

Some steps will be done:

  1. associate a C# interface to any JVM Class reported to be an interface
  2. modify the where clause to accept the newly created interfaces, adding the new constraint to be sure the type is the class associated to the interface

@masesdevelopers
Copy link
Contributor Author

Other limitations raised are:

* `Iterator<E>` shall be managed like it is done for `Iterable<E>`

* Some Iterable classes (e.g. `ConsumerRecords`) inherits from `Java.Lang.Iterable<K, V>` which is syntactically wrong, the correct superclass is `Java.Lang.Iterable<ConsumerRecord<K, V>>`

The following piece of code
https://github.com/masesgroup/JNet/blob/44acc282db09b92ddad136faa7bd0eacdefdbff4/src/net/JNetReflector/InternalExtensions.cs#LL903C1-L914C22

does not manage generic Java.Lang.Iterable in the right way, shall be analyzed the GenericInterface.

masesdevelopers added a commit to masesdevelopers/JNet that referenced this issue Jun 10, 2023
… Java interface

masesgroup#137: created the stub methods of the listener interface, first step to introduce auto generated Listeners
masesdevelopers added a commit to masesdevelopers/JNet that referenced this issue Jun 10, 2023
masesdevelopers added a commit to masesdevelopers/JNet that referenced this issue Jun 10, 2023
masesdevelopers added a commit to masesdevelopers/JNet that referenced this issue Jun 10, 2023
masesdevelopers added a commit to masesdevelopers/JNet that referenced this issue Jun 10, 2023
masesdevelopers added a commit to masesdevelopers/JNet that referenced this issue Jun 10, 2023
masesdevelopers added a commit to masesdevelopers/JNet that referenced this issue Jun 10, 2023
… of generic type defined for Iterator and Iterable
masesdevelopers added a commit to masesdevelopers/JNet that referenced this issue Jun 10, 2023
masesdevelopers added a commit to masesdevelopers/JNet that referenced this issue Jun 10, 2023
…end it

masesgroup#178 (comment): classes with a single interface which isn't a listener inherits from interface implementation class
@masesdevelopers
Copy link
Contributor Author

Other limitations raised are:

* When a namespace is avoided (e.g. `org.apache.kafka.common.internals`) some methods still reports types from that namespace

The problem comes from two main reason:

  1. when a base class is retrieved, if it is a super class it is checked, but if the type is defined from the single interface the type is not checked
  2. if ta type is a generic, it is checked only the outer type, not the inner type(s)

masesdevelopers added a commit to masesdevelopers/JNet that referenced this issue Jun 12, 2023
masesdevelopers added a commit to masesdevelopers/JNet that referenced this issue Jun 12, 2023
masesdevelopers added a commit to masesdevelopers/JNet that referenced this issue Jun 12, 2023
masesdevelopers added a commit to masesdevelopers/JNet that referenced this issue Jun 12, 2023
masesdevelopers added a commit to masesdevelopers/JNet that referenced this issue Jun 12, 2023
masesdevelopers added a commit that referenced this issue Jun 12, 2023
* #178: update JNetReflector to manage Main-Class with new IJNetBridgeMain, remove keyword from argument names, improved management of generic super-classes, improved management of generics in constructor arguments

* #178: upgrade code after change into JNetReflector

* Added build and create to the list of names to be avoided in Properties

* #178 (comment): added switch to rename classes, better management of return type in generics

* #178 (comment)

* #178 (comment)

* #178 (comment): created interfaces for each Class that is a Java interface
#137: created the stub methods of the listener interface, first step to introduce auto generated Listeners

* #178 (comment): added where clause based on interfaces and forced the new constraint

* #178 (comment): when a constraint is a native type it is removed

* #178 (comment): fixed not matching declaration

* #178 (comment): removed many warning during compilation related to newly added interfaces

* Update classes with warning removal

* #178 (comment): update where clause generation when a generic class depends on itself when extended

* #178 (comment): added switches related to interface generation

* #178 (comment): management of Iterator and update retriever of generic type defined for Iterator and Iterable

* #178 (comment): fixed generation of avoid interfaces

* #137: concrete classes implementing a Listener does not extend it
#178 (comment): classes with a single interface which isn't a listener inherits from interface implementation class

* #137 (comment): Use always JVMBridgeException when there is an exception type in parameters to have an unified approach between listeners and methods

* Code update for #137 (comment)

* Folder structure review: Extensions moved under Specific

* #178 (comment): limited super interfaces

* #178 (comment): solved base class inheritance from avoided types

* #178 (comment): JVMInterfaceName shall use GetGenerics to get the real type

* #178 (comment): added avoidance check of inner types

* #178 (comment): Added namespace to IJNetBridgeMain
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working JNetReflector JNetReflector related issue
Projects
None yet
1 participant