Open lburgazzoli opened 4 years ago
Thanks for your suggestion.
I'm not sure how we can easily add compilation products on the classpath for subsequent compilations. This seems to be a can of worms I'm not convinced we should open automatically.
However, perhaps there's a way to achieve this through CompileOptions
, manually. We pass along the -classpath
flag to the compiler. That flag is file based, listing some jar files. I'm not sure if it's possible to list individual classes and/or class loaders?
I'm happy to review specific suggestions, but cannot spend time on investigations of this topic, right now.
I'm not sure how we can easily add compilation products on the classpath for subsequent compilations. This seems to be a can of worms I'm not convinced we should open automatically.
Yeah I have realized that while writing the issue and I do agree that it should not be done open by default.
I'm happy to review specific suggestions, but cannot spend time on investigations of this topic, right now.
Wonder if something like:
String data = Files.readString(Path.of("data/MyData.java"));
String route = Files.readString(Path.of("data/MyRoutes.java"));
var unit = Reflect.compilationUnit(data, route);
var result = unit.onClass("my.example.MyRoutes").create().get();
could be acceptable
That's a different suggestion, which I can see more realistically as it is 1) indeed a missing feature, 2) not raising more questions than it answers :) I've created a new feature request for this: https://github.com/jOOQ/jOOR/issues/101
I was not aware that this was an option for you from your original feature request, where it may be possible that the two classes are not compiled at the same time.
Of course, if you are in full control of your classes, and when you want to compile them, then you can also nest the MyData
class in MyRoutes
and get things to work already now.
Yeah, the original requirement was based on the fact that the classes are compiled at different times, but after thinking a little bit more about my current set-up I can easily collect and compile them in a single step :)
Expected behavior and actual behavior:
Assuming I have some code like:
Where the class
MyData
is needed byMyRoutes
in this case for unmarshalling from json, then the code above fails with:I don't know if this is supported by jOOR.
Steps to reproduce the problem:
Versions: