This is an additional information to the tip “decompile a java class”
http://www.mindfiresolutions.com/Decompile-a-Java-Class-1219.php
We may notice some oddly-named “val$” fields and extra constructor arguments in the decompiled Java code by JAD decomiler.e.g,
public void defineAnonymousInnerClass(String name)
{
new Thread(name) { //extra constructor argument "name"
public void run() {
System.out.println(this.val$name); //"this.val$" is extra
}
}
.start();
}
In the above example, the argument to the Thread constuctor and “this.val$” to the field name is added by the compiler to the generated bytecodes.Hence these extra things are reflected in the decompiled code.
Here is the tip to restore these codes :
1.remove the constructor arguments
2.add “final” to the variables’ declaration.
3.remove this.val$ before the field names.
restored codes:
public void defineAnonymousInnerClass(final String name)
{
new Thread() {
public void run() {
System.out.println(name);
}
}
.start();
}
Now it is ready to work