apache / incubator-kie-issues

Apache License 2.0
12 stars 1 forks source link

Revisiting DMN Editor Import Java Classes feature #782

Open yesamer opened 9 months ago

yesamer commented 9 months ago

To know more about the feature, I invite you to take a look at my below blog post. https://blog.kie.org/2022/05/dmn-types-from-java-classes.html

The architecture behind that feature has some weak points, in detail:

Based on the above reasons, we decided to temporarily not enable the "Import Java Classes" in the new DMN Editor, to investigate and assess a more robust solution, which is the scope of this ticket.

Possible solutions so far:

  1. Continuing with the current approach. With the cost to pay to keep the JDT.LS dependency updated. In addition, I suspect we'll need to base our code on tycho 4.x and JDK 17 to stay updated. In addition, this will not work on KIE Sandbox. 1b. Using the same approach, but using https://marketplace.visualstudio.com/items?itemName=Oracle.oracle-java extension instead of the "Java Language VSCode extension". In my opinion, this leads to the same drawbacks as the previous point.
  2. Implementing a specific service on the "extended-services" modules, that returns the list of the Java Classes and their public methods present in the user's project. "extended-services" acts like a backend for KIE Canvas (and in the future for the VSCode extension), it should be feasible implementing such a feature. A possible limitation is related to the Quakus native mode: in such a case, reflection has some limitations.
  3. Using a Java parser that reads the Java Classes AST and returns the requested info (Java class names and public methods). A NodeJS library for that already exists (here), I tested it in this repo https://github.com/yesamer/java-parser-poc. This approach has a lot of limitations.
  4. ...?

Another point to underline is that the feature is a key one for the Test Scenario too, as we need it for RULE-based Test Scenario.

yesamer commented 8 months ago

@tiagobento I updated the above description, discarding the 3rd solution option and adding another problem I faced with the current architecture in the last few days.

However, I think we need to make a decision about the direction of this feature, based on our future tooling strategy. The key point is: Should we have this feature working on VSCode only, or do we need it in the Sandbox too? Before replying, consider that such functionality is required by RULE-based scesim, and might be very useful in the case of a DRL editor. Relying on the current solution means not having that feature enabled in the Sandbox. I guess that clarifying this point can drive us to choose the better solution. Considering the problems we had maintaining the current architecture and the fact it works on VSCode only, I would prefer to explore the second solution.