This dialog box is accessed from the SmartAgents button in the Conversion Settings dialog box.
Smart Agents work only in JAVA conversion mode.
The Smart Agents make the converted file easier to read and closer to the original java source code. All Smart Agents should normally be set (this is the default).
If no Smart Agents are set, the conversion is syntactically correct and the output produced is closer to what is actually compiled for the Java Virtual Machine but it is more difficult to read.
Unnecessary Fully Qualified Names
The Java Virtual Machine uses fully qualified names. This is syntactically correct but Java allows unqualified names to be understood in source code:
java.lang.
qualifier does not need to specified. For example, the identifier name java.lang.Integer.myInteger
can be replaced by myInteger
.myClass.fieldName
can be replaced by fieldName
.super
keyword can be used to replace a fully qualified super class name. For example, mySuperClass.fieldName
can be replaced by super.fieldName
.class myPackage.myClass {
...
int myPackage.myClass.fieldName = 5;
...
}
package myPackage;
class myClass {
...
int fieldName = 5;
...
}
The Java Virtual Machine requires each method to be terminated with a return
instruction. While this is syntactically correct and does no harm, it is unnecessary in the source code because a return;
is understood in the closing brace of the method. For example:
void method() {
...
return;
}
is replaced by:
void method() {
...
}
Note that this Smart Agent does not affect methods that return a parameter. For example, there is no change to:
int method() {
...
return x;
}
Some source code expressions within a method can cause a Java compiler to generate temporary local variables. While this process happens transparently, it nevertheless generates a real local variable in the class file. When converting to a Java source file, ClassCracker generates a default name in the variable declaration section of the method. The names generated by ClassCracker are of the form locVar_#
where # is a consecutive number.
If these local variables are not expressly referenced within the method's code (which is usually the case) they can be removed from the declaration section. This Smart Agent removes such unreferenced local variables.
Declared 'Exception' Local Variables
Local variables belonging to the Exception class and its subclasses are often declared as a formal parameter in a catch statement. Alternatively, they can be declared together with the other local variables in the variable declaration section of the method.
This Smart Agent removes 'Exception' local variables from the variable declaration section of the method if they are already declared in a catch statement.
The Java Virtual Machine is not aware of the + string concatenation operator. When a Java source file is compiled, this operator is first converted by the compiler to the String.concat()
method and this is what is stored in the class file.
When ClassCracker decompiles the class file, the String.concat()
method is returned. This Smart Agent replaces the String.concat()
method with the + string concatenation operator.
This Smart Agent also simplifies string expressions containing the StringBuffer class which is sometimes generated by Java compilers.