Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Objectteams » Prepare ObjectTeams for Java 9 and beyond
Prepare ObjectTeams for Java 9 and beyond [message #1784184] Fri, 23 March 2018 09:29 Go to next message
Lars Schütze is currently offline Lars SchützeFriend
Messages: 43
Registered: March 2012
Location: Germany

Hi all,

I am using Object Teams currently in the context of a Java 9 application.
Object Teams plugins are compiled with Java 7 and 8, except the runtime, which I also compile with Java 9.

When building my application which is using ObjectTeams and is compiled with Java 9 I have to change my script executing the project as follows:

Without changing my JVM parameters I get the following error:

Error: A JNI error has occurred, please check your installation and try again
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.IllegalAccessError: superinterface check failed: class sun.launcher.LauncherHelper (in module java.base) cannot access class org.objectteams.IBoundBase2 (in unnamed module @0x64616ca2) because module java.base does not read unnamed module @0x64616ca2

Okay, that is because I did not provide a But also, because the project does not provide a, where it exports the module so I can export it transitively (if needed).

So, I have to add the JVM parameter MODULES="--add-reads=java.base=ALL-UNNAMED" to make it run.

Now I get the following warnings:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.eclipse.objectteams.otredyn.bytecode.asm.verify.OTCheckClassAdapter$ShyLoader (file:/Users/lschuetze/Development/repos/role-benchmarks/benchmarks/objectteams-compiler-work/invy/build/objectteams-benchmark.jar) to method java.lang.ClassLoader.findLoadedClass(java.lang.String)
WARNING: Please consider reporting this to the maintainers of org.eclipse.objectteams.otredyn.bytecode.asm.verify.OTCheckClassAdapter$ShyLoader
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

The following code is responsible for the warning:

if (findLoadedClass == null) {
findLoadedClass = ClassLoader.class.getDeclaredMethod("findLoadedClass", String.class);

As it tells you, in future Java releases this illegal reflective access could be forbidden completely and maybe also not be configurable through JVM parameters.

Since in the future more and more software will be written that leverages the modules system is there a plan to support that in the near/far future? For example I could think of a possible generation of using the data from

[Updated on: Mon, 26 March 2018 10:18]

Report message to a moderator

Re: Prepare ObjectTeams for Java 9 and beyond [message #1811350 is a reply to message #1784184] Sat, 31 August 2019 17:58 Go to previous message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1843
Registered: July 2009
Senior Member
I have finally(!!) started to take action in this regard. is the umbrella where this work is tracked.

It's first child ( has been fixed just now, and avoids the issue regarding sun.launcher.LauncherHelper.
If similar things happen with other system classes, clients can actually avoid the issue by declaring "weavable regions", see org.eclipse.objectteams.otredyn.bytecode.asm.WeavableRegionReader

Regarding the illegal access from ShyLoader I'll dig through the archives of jigsaw-dev mailinglist. I seem to recall that a related question has been discussed there...
Previous Topic:OTJ related JDT patch offered as update on clean 4.8.0 M4 w/o OTJ installed
Next Topic:Multiple inheritance in OT/J
Goto Forum:

Current Time: Wed Jan 19 14:58:27 GMT 2022

Powered by FUDForum. Page generated in 0.01395 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top