How to remove debug information in its .class file (using xtend 2.x)

1.7k views Asked by At

I noticed that when I updated xtend from 1.20 to 2.0, the .class file is significantly larger. One difference I saw is that there are debug information in the .class files which I do not really care for. There is also an additional entry in the .class file called SMAP.

I am using the MWE2 Workflow to generate the .class files. Is there a way to disable this?

2

There are 2 answers

2
Sebastian Zarnekow On BEST ANSWER

Xtend 2.x is compiled to Java source code where Xtend 1.x was an interpreted language. Compiling to Java has the advantage of a significant performance improvement at runtime and seemless integration with other JVM languages. To allow debugging Xtend, SMAP information is installed into the bytecode, too. With that you can choose if you want to debug the generated Java sources or directly the Xtend code. If you focussing on smaller class files for some reason, you may want to install Xtend as the primary source information. This will remove the Java debug information and only keep a small portion of Xtend debug info. You may also want to remove all the synthetic local variables from the class files. Check you Eclipse compiler settings under Xtend -> compiler.

0
Kayaman On

You can compile with javac's -g:none parameter to generate no debugging information. This should also prevent Source Map from being generated.