java-deobfuscator / deobfuscator

The real deal
https://javadeobfuscator.com
Apache License 2.0
1.54k stars 288 forks source link

Obfuscator with "$" #986

Open Midaco-YT opened 7 months ago

Midaco-YT commented 7 months ago

hello I had a question. is there an obfuscator who obfuscates with "$" if yes how to remove them? and replace some argument to Object

like this

@Override

public boolean equals(final Object o) {
    if (o == this) {
        return true;
    }
    if (!(o instanceof Pair)) {
        return false;
    }
    final Pair<?> other = (Pair<?>)o;
    if (!other.canEqual(this)) {
        return false;
    }
    final Object this$left = this.getLeft();
    final Object other$left = other.getLeft();
    Label_0065: {
        if (this$left == null) {
            if (other$left == null) {
                break Label_0065;
            }
        }
        else if (this$left.equals(other$left)) {
            break Label_0065;
        }
        return false;
    }
    final Object this$right = this.getRight();
    final Object other$right = other.getRight();
    if (this$right == null) {
        if (other$right == null) {
            return true;
        }
    }
    else if (this$right.equals(other$right)) {
        return true;
    }
    return false;
}
Janmm14 commented 7 months ago

That is no obfuscation. This is just a local variable named with a $ sign. Such code might be automatically generated by project-lombok or other tools.

Obfuscators would not leave meaningful names like "left", "right", "this" or "other" inside local variable names. They would either remove all local variable name information or fill it with garbage.

Midaco-YT commented 7 months ago

How can I put them back the way they were? and the same for "Object" it’s not normally object but something else

Janmm14 commented 7 months ago

This is only possible to handle manually. Or try to use another decompiler or tell the decompiler to not use existing local variable info (might backfire in other places).

The reason that there is "Object" is very likely due to generic erasure if that equals method was not originally created by an automatictool like lombok. Generic types are a source code / compilation construct and afaik optional generic extra information cannot be safed in class files for local variables.