Storyyeller / Krakatau

Java decompiler, assembler, and disassembler
GNU General Public License v3.0
1.95k stars 220 forks source link

Force use shortnames #48

Open Sputuks3 opened 9 years ago

Sputuks3 commented 9 years ago

Is there a switch I can use to force the use of shortnames instead of fully qualified names when referring to non-object references? For example, I want View v instead of android.view.View v

Storyyeller commented 9 years ago

Not currently. The easiest way to do that would be to go to ast.py where it says

        if name.rpartition('.')[0] == 'java.lang':
            name = name.rpartition('.')[2]

And remove the if statement (i.e. just put name = name.rpartition('.')[2]).

I'm not sure if it's useful enough to warrant adding as a commandline option.

Sputuks3 commented 9 years ago

It would. Because there are times when this switch is needed. Ex. when obfuscation is used.

Storyyeller commented 9 years ago

Wouldn't obfuscation be the worst time for short names? Since in that case you'd typically have tons of different classes named a.

Sputuks3 commented 9 years ago

That's my point. Turned on by default with the option of turning it off when confident obfuscation is not used, as determined by user. Commenting and un-commenting the if statement is a cause of subtle bugs especially when a recompilation does not occur to overwrite.

Storyyeller commented 9 years ago

It seems to me like having it off by default would be more useful.

Konloch commented 9 years ago

In my opinion it should be the fully qualified name by default, however it would be useful if there was a command line flag to toggle it.