0

Short summary of question Preserving parameter/argument names in compiled java classes

In order to preserve argument names one has to compile the Java source using javac -g:vars as compiler options

I do normally compile using Ant javac task. How do I adapt it in order to preserve method argument names?

Current code follows:

<javac includeantruntime="false" srcdir="src" destdir="build/compiled" deprecation="on" target="1.7" source="1.7" debug="true" verbose="false" classpathref="project.classpath" encoding="utf-8" />
usr-local-ΕΨΗΕΛΩΝ
  • 26,101
  • 30
  • 154
  • 305

1 Answers1

2

Since the javac developers decided to tie it to the g switch the debug and debuglevel attributes should work

<javac debug="true" debuglevel="vars" .... />

In general you can always use a nested compilerarg to pass in arbitrary additional command line arguments. In your case

<javac includeantruntime="false" srcdir="src" destdir="build/compiled" deprecation="on" target="1.7" source="1.7" debug="true" verbose="false" classpathref="project.classpath" encoding="utf-8">
    <compilerarg value="-g:vars"/>
</javac>

should do.

Stefan Bodewig
  • 3,260
  • 15
  • 22