: junc++ion overview

JunC++ion Features

JunC++ion consists of two major pieces that are delivered to you out of the box: the code generator and the runtime library. In addition to these two pieces there are the proxy types that are generated for your specific integration problem. All three pieces have distinctive features you should look for when comparing JunC++ion to alternative integration approaches.

Code Generator Features

Feature
Explanation
"Smart" Code Generator
The code generator understands the relationships between Java types. When you import a Java type, it automatically enables other Java types that are required on the other side to make that type useful (for example method argument types of enabled methods). When you instruct the code generator to disable a particular type, it automatically disables all dependent elements (methods, fields) that rely on the presence of that type.
Good Heuristics
If you make no modifications to the default generation settings, you will probably end up with something that is right for you or at least almost right for you.
Highly Customizable
You can disable (almost) any type, any method, any field from becoming available on the other side.
Template-Based
You can enhance or completely change what the code generator generates by modifying the default blue-prints from which it generates source or build files. You can even add your own blue-prints!
Extensible
You can add your own templates and have them generate once per type or per project.
Automation Features
The code generator can persist the state of a project in a model file and then allow you to reopen it in the GUI or use it as part of an automated, command line-based build. You can use variables in your model file to make code generation portable across build hosts.
ANT Integration
ANT is a very powerful, portable Java-based build system and the custom tasks for code generation and compilation allow you to create portable, automated, end-to-end integration builds.
Build Support
The code generator can optionally generate makefiles, build batch files, and Visual Studio project files.
API Documentation
The code generator can optionally generate API documentation. It can generate a complete API reference manual even without access to the Java sources, but the results are even better if you can make the Java sourcefiles available to the code generator.
Special Native Method Support
The code generator can optionally generate method stubs and default implementations for Java native methods. The generated methods are exception-safe and can be implemented in terms of C++ proxy types.

 

Generated Code Features

Feature
Explanation
Platform- and Compiler-Portable
The generated code is as portable as we can possibly make it. This includes workarounds for compiler bugs that you have probably never run into in your hand-written code. Having us encounter and work around these issues is invaluable.
As lightweight as Possible
The C++ proxy types delegate as much as possible to the runtime library to keep the proxy classes as small as possible.
Hi-fidelity Conversion
The generated code exposes Java packages as namespaces, Java fields as fields, Java methods as methods and Java types as types. Use it with very little instruction necessary.
Exception-Safe
The C++ proxy types can be used in the presence of native exceptions without leaking objects on the Java side. Java exceptions are thrown as native exceptions and can be caught as native exceptions.
Multithread-Ready

The C++ proxy types can safely and easily be used in multithreaded runtime environments. We do not claim total thread safety because we intentionally did not synchronize write access to the proxy instances for performance reasons.

That being said and assuming you take care of write synchronization, you can safely use proxy objects on multiple threads.

Callback Support
Certain Java interfaces can be used as a callback interfaces. This means that you can implement the Java interface on the native side and have the Java side call your implementation asynchronously (EventListeners, MessageListeners, etc.)
Fewest Possible Surprises
It is impossible to have C++ proxy types that are totally without surprises. For example, your native language may have different reserved names than Java, so sometimes a valid Java name needs to be changed on the native side to ensure a successful compilation. The C++ proxy types have extremely few such surprises.
Highly Usable Types
The generated code is just about as usable as the underlying Java types and we just keep adding C++ features like STL iterator support for Java collections.

 

Runtime Features

Feature
Explanation
Works With Virtually Any JRE
As long as your Java Runtime Environment supports JNI, it will work in an integrated application. We have tested with JVMs from different vendors, including Oracle, Azul, and IBM, as well as open source implementations like OpenJDK.
Extremely High Performance
Even though JNI has a bad reputation, it is really quite fast. There is inevitable overhead, but you will be very positively surprised by the performance of your integrated application.
Mature Configuration framework
You need to tell your native code where to find the Java parts of the application and how to initialize the JVM or connect to the shared JVM server. You have extreme flexibility, from hardcoding the settings, over using XML config files, all the way to self-configuring DLLs via configuration callbacks.
No Server Necessary
Your finished integrated solution can be totally self-contained without any additional "moving pieces" required.
"xcopy" Deployable
Just copy or move the integrated solution and double-click the executable. If you configured things correctly, it will still work, no registration steps necessary.