Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yes, the "code" is - it has to be in order for it to be executed. My point is that method variable names are not normally visible.


I'm not sure I follow -- this is what comes up from a random commercial project (I don't believe it's a debug build): http://i.imgur.com/OhdNC5A.png

What part would you refer to as "method variable name"?


That's weird. By "method variable names" I mean local variables, i.e. those declared inside a method.

I'm not getting the same results as you with a little sample program I wrote - see: https://gist.github.com/JosephRedfern/662131ceb2119abf3e83. Field names and method names are preserved (which make sense), but local variable names are lost (which also makes sense to me!)

Are you sure that your example code doesn't include debug information?


You're looking at the bytecode. If you want full decompilation, use one of the tools mentioned here: http://stackoverflow.com/questions/272535/how-do-i-decompile...


I decompiled the dex file, but not the Java Class file.

I suppose this is diverging a little from the original comment (which was in the context of an Android application), but surely if running `strings` on the class file found the method, class and field names then it would also find the local variable name too, if it was there.

If I specifically compile the java file with `javac -g:vars DecompilationTest.java` then the local variable name IS included in the file. It is not by default.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: