This is what I've done to circumvent this issue. For my project to work, I need the
-parameters option and I also like the
-preserveAllLocals for debugging.
As IntelliJ accepts a custom ECJ jar, I figured I'd recompile ECJ with the options hardcoded to get around that bug. Unfortunately, the documentation is quite sparse and doesn't show an easy way to build ecj.jar.
I've decided to modify the jar instead! There is a neat tool called Recaf that does just that, decompiles a jar and allow you to easily modify it and repackage it. Neat!
- Head to mvn repo to download the latest jar
- Download recaf fat jar and execute it with
java -jar recaf-2.21.13-J8-jar-with-dependencies.jar
- Open the class
- For some reason, Recaf couldn't properly decompiled the class so I went to the Eclipse JDT core repo to fetch the real source code (you could also fetch it from the source jar to use the exact version, it would be more robust than what I did). MAKE SURE the main class is the one bundled in the jar!
- At the end of the
configuremethod of the class, add this :
- Save the file
- File -> Export program -> choose a jar name (
java -jar ecj-patched.jarwill now complain about invalid signature of the class, easy to fix with
zip -d ecj-patched.jar 'META-INF/.SF' 'META-INF/.RSA' 'META-INF/*SF'
Now, just use this patched jar in IntelliJ and this should work!