This repository contains tests for the CFR java decompiler (and any other decompiler, but you know you want CFR), hosted at benf.org/other/cfr, and in github at cfr.
CFR is proudly, unabashedly, unashamedly, written in Java 6. For reasons. It's the future, you know.
.... but it decompiles Java 13. (And Kotlin/Scala/etc etc, if you want java back).
as such, it's easier to keep all the multi-javac versioning carefully to one side.
Before we start, an apology. This 'framework' is something I've knocked up to suit me. It's not amazingly pretty. End Apology.
- Clone this repo ;)
- Clone cfr
- Make sure you've got
diff
on your path. (Linux/OSX you're fine, windows you'll need (eg) this and make sure diff.exe is on your path. - Build cfr. (but don't change it yet, we're going to generate a baseline)
- ... and set up an environment variable CFR_TARGET, which points to the root of the output in target/classes
- Build cfr_tests
- Install all verions of the JDK. Go on. 6 onwards.
- Set up your maven settings.xml to contain ${JAVA_6_HOME} .... ${JAVA_12_HOME} etc. A template settings.xml file which you can fill in and put in ~/.m2 (or c:\users\whoeveryouare.m2) is here
- Run compile.bat / compile.sh. This will compile the tests under lots of flavours of JDK, and create lots of directories under
output
- Generate a baseline.
-
python regtest.py --target java_6 --force y
will generate the baseline for java 6.
-
- Break CFR.
- No, go on. Perhaps swap the lhs and rhs in the TernaryExpression constructor. That sounds like fun!
- Run the tests again.
-
python regtest.py --target java_6
(without the force argument, of course!) - Wonder at the damage that you hath wrought.
- You should get a bunch of complaints. You really don't want to accept them.
-
- Fix CFR
- Generate baselines for all the other java versions you care about (please, at least 6,8 and 13), and 'hardcoded'.
Job done!