I'm evaluating if polyglot applications using GraalVM could be a solution for our next project. The goal would be to reuse the existing Java data model in C++ at 'develop time' (C++ IDE). Ideally with documentation (Javadoc), code completion and the ability to debug into the Java classes. So the key question is: Is it possible to work seamlessly with a Java data model in C++ IDE using GraalVM? Or (if not) what is the least painful way to do so?
After searching around I now get the feeling that this won't work without generating a C/C++ representation of the Java classes. If this is the right place to look at (feel free to point me to better/correct resources) and I'm getting it right Build a Native Shared Library and Java Native Interface (JNI) in Native Image seems to suggest code generation of some sort is inevitable.
To elaborate more on this:
- I hoped that GraalVM would provide something to also remove the language barrier at development time (Developing source code in the IDE), but this seems not to be the case, right?
- I hoped that there wouldn't be the need to generate additional code at all, but the only help I can get from GraalVM would be calling something like
native-image -jar <jarfile> --sharedfor getting C header files (so yes, code generation, but at least I don't have to implement one by myself). - It's clear to me, that the C++ IDE needs to know somehow how the data model looks like (classes and their structure). I hoped that GraalVM would perhaps introduce a new mechanism implemented in IDEs to access libraries in other languages. Instead of including classic header files the workflow would be to load a Java JAR into a 'GraalVM instance' managed by the C++ IDE and the C++ IDE communicates with this 'GraalVM instance' and retrieves the header data from there, e.g. So you would put something like "#include graal://com.example.fancyLibrary:1.0" into your C++ code instead of using 'normal' header files.