Add support for Java 9+
This Merge Request aims to update DiSL in order to support the latest versions of Java, such as Java 9, 10, 11, 12, 13, 14, and 15.
ant
uses now the Java version defined by the host machine and changes command-line parameters accordingly based on it. The same happens in test runners and in the Python script to run the examples. Runtime checks are also performed into the agent.
Here is a list of changes and new implementations that have been done to achieve this goal.
-
jvmti
andjni
headers have been updated. - Replaced
protobuf-javalite
withprotobuf-java
since the first causes compilation error using Java 9+ (https://github.com/protocolbuffers/protobuf/pull/6699). - As the release notes underline: "The default behavior has changed so that the ClassFileLoadHook event is not sent during the primordial phase". This means that some classes are not processed as before since the callback of this event is the one responsible to instrument the code. For this reason, a new capability
can_generate_early_class_hook_events
has been handled. -
-Xbootclasspath/p
has been removed and replaced with a new option--patch-module
. - Because of the new module system and the removal of
-Xbootclasspath/p
option, adjustments to theBypassCheck
class visibility needed to be done. It is now patched into thejava.base
module and the agent is responsible to make it visible to all other modules in the application during class file loading (usingAddModuleExports
). - From Java 15, lambdas seem to be treated as Hidden Classes. For this reason,
LambdaShadowClass::getCanonicalName
has been modified to returnnull
. - Python script has been updated to use the new command-line options (
--patch-module
).
Continuous integration has been modified to use also Java 9, 10, 11, 12, 13, 14, and 15 with OpenJDK since the old image has no updates available and Oracle JDK has been relicensed. The new images are implemented in the docker
folder and have been published on the docker hub (mbasso/disl-ci) instead of the gitlab registry (gitlab.ow2.org:4567/disl/disl/disl-ci). This is because access and publish permissions are needed, so external collaborators cannot do it.