Open monperrus opened 6 years ago
This tool compute diff on bytecode https://github.com/scala/jardiff
May be useful for this task.
Thanks @nharrand
I'm a bit puzzled by the usecase: if a user wants to write a transformation at the source code level, then he must know the source code level, so this one must be available? Or do you imagine the case of analyzing the code using a decompiler to write a transfo and then apply it to the jar?
Now I don't know much the field but I'm a bit afraid about the optimization realized by compilers. A naive example would be a for-loop changed as a while: then the user would write a transfo to catch that loop, except that it doesn't exist anymore in the binaries. Do you think this kind of case could occur?
Or do you imagine the case of analyzing the code using a decompiler to write a transfo and then apply it to the jar? Exactly! @nharrand is making great progress on the decompilation aspect of it.
Having AST generators #1960 would be super useful here
@andrewbwogi some related work: MetaWSL and meta-transformations in the fermaT transformation system (2005)
For the programmer, it is much easier to write a transformation at the source code level, because she is familiar with the language constructs. However, in many cases, it is better to be able to apply the transformations at the binary level (eg one could apply the transformation on binary code for which we don't have the source code). For doing this, there are different options:
The first option is the most fun: write a transformation at the source code level, and then compile the source-level transformation to a binary-level transformation (in our case writing a Spoon transformation and compile it to an ASM/Javassist transformation)
Are you ready to take on the challenge?