yWorks/yGuard

Keep method params

Fargys1879 opened this issue · 4 comments

How configure in gradle to keep method params?

yGuard does not remove method parameters. If shrinking is enabled (which I recommend against), yGuard may remove unused methods but not individual parameters. If only renaming is enabled (but no shrinking), only certain attributes like LineNumberTable are removed but no method parameters. (Which attributes are removed may be configured using the attribute element.)

The problem is that it renames the parameters.Is it possible to somehow prohibit renaming parameters?

Actually, yGuard does not rename method parameters, but it does remove the LocalVariableTable attribute by default (and I think parameter names are stored in said attribute). If you want to retain the LocalVariableTable attribute, configure your obfuscation task appropriately (using the attribute element I mentioned in my previous comment).

Edit:
I am probably mistaken about the LocalVariableTable attribute. Method parameter names should be stored in the MethodParameters attribute, see The MethodParameters attribute. However, the MethodParameters attribute is only generated if you use the -parameters compiler flag. And you need to explicitly retain the MethodParameters attribute in the same way you would have to retain the LocalVariableTable attribute (or any other byte code attribute that yGuard removes).

Thank's! It Solve my problem
keep { 'attribute'( name: 'MethodParameters' )......