parboiled: JDK11 reporting illegal reflective access
WARNING: Illegal reflective access by org.parboiled.transform.AsmUtils (file:/home/aaime/.m2/repository/org/parboiled/parboiled-java/1.1.7/parboiled-java-1.1.7.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int)
WARNING: Illegal reflective access by org.parboiled.transform.AsmUtils (file:/home/aaime/.m2/repository/org/parboiled/parboiled-java/1.1.7/parboiled-java-1.1.7.jar) to method java.lang.ClassLoader.findLoadedClass(java.lang.String)
I’m going to upgrade to 1.2.0 soon, but checked the code, the access seems to be still there:
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 19
- Comments: 25 (8 by maintainers)
Just released parboiled 1.4.0 which should fix the problem on Java 17.
with OpenJDK 17 (next Long Term Support release), this will become more fun - https://openjdk.java.net/jeps/403:
it is very possible, that Java 12 will halt with this lib on classpath
Is there any fix for this? Is there a version of parboiled that doesn’t trigger warnings on Java 11 and also supports Java 8?
AsmUtils.loadClassutilizesdefineClasswhich doesn’t have JDK agnostic alternative so bundling the bytebuddy that hasClassInjectorfor this purpose would be a viable option. Another approach would be to indirectly provide the class injector as function.AsmUtils.findLoadedClassis even worse since to my knowledge there is no counterpart for that in JDK11. Luckily the already processed classes can be tracked in a class injector function.ASMSettingsalso dictates what JDK level can be used in Vars and Actions. I got constant pool errors with static interface methods since the version isn’t derived from the given parser class but instead hardcoded to JDK7.ClassFileVersionof bytebuddy has this kind of feature so it really would be a smart addition to the dependencies.This is how my
ParserTransformer.transformParserlooks when bytebuddy is applied via function. The actual workaround is in form of a gitst patch, but this is how I bypass the warning and more-over get my > JDK7 parser implementation to work.https://gist.github.com/TuomasKiviaho/3d6dae166e85c4aaba94afb0318b4e4d
PS. I’m personally not using
Parboiled.createParsersince the parser instance isn’t thread-safe. Hence the example only contains how to generate a working parser in whichever environment the bytebuddy is capable of supporting.Not sure if it is related, but I’m hitting a similar warning on 1.3.1 (Java 9)