6

It is very annoying to have the whole app add an @Param() annotation with the variable name for each variable name. It is also frustrating when you change the variable name and have to change the name inside @Param

Is there any good way to annotate a method so the compiler knows to keep the meta information of variable names around?

I notice in eclipse compiler, I am getting arg0, arg1 back and this is in debug mode as I step through my code. How to set it so the actual variable names are coming through?

Lastly, I took a peak at how Play 1.3 was handling this and it was using javassist and bytecode stuff (which I prefer to keep out of the app) but was still unsure how that is working. Does anyone know how I could do it that way(more for learning than anything)

thanks, Dean

Dean Hiller
  • 19,235
  • 25
  • 129
  • 212
  • adding a bounty if someone can at least describe the play1.3 stuff and what they did to keep variable names working. – Dean Hiller Jun 14 '16 at 02:27

1 Answers1

4

In my understanding you try to preserve the variable names in the fingerprint of a method. If it is right there is a solution for you:

Shortly: add -g:wars to the compiling command line or in Eclipse check out the following setting: Eclipse -> project properties -> Java compiler -> Add variable attributes to generated class files. Source

Community
  • 1
  • 1
Hash
  • 4,647
  • 5
  • 21
  • 39