clightning4j / JRPClightning

:zap: Java framework for C-Lightning to work with the RPC interface, and also the library simplifies the work to develop custom plugins with Java, Kotlin, and all the languages that supports the Java dependencies :zap:
https://clightning4j.github.io/JRPClightning/
GNU General Public License v2.0
16 stars 9 forks source link

feat: support multiple classes extending `CLightningPlugin` #83

Closed theborakompanioni closed 1 year ago

theborakompanioni commented 1 year ago

Currently, and if I am not mistaken, the library only supports a single Plugin class on the whole classpath. In some cases it is desirable to have multiple classes extending CLightningPlugin, even if only one is actually active (by invoking start()).

The reasons seems to be that CLightningPlugin#registerMethod collects all classes containing any of the annotations (Subscription, Hook, etc.) and subsequently tries to invoke it on the currently active plugin object, even if it might not have the method defined itself.

I assume the plugin still works and will just report false or duplicate information in the getmanifest response. Would it be desirable to report the correct information and support multiple classes?

vincenzopalazzo commented 1 year ago

I assume the plugin still works and will just report false or duplicate information in the getmanifest response. Would it be desirable to report the correct information and support multiple classes?

I the time I did not think about this, and I guess this could be a very good bug fix! Do you have already some idea on how to fix it?