DA,
I have tried Jarg. This application was working on simple jar.
But I have problem on progarm as follows:
import java.lang.reflect.Method;
public class Test {
public Test() {
Class[] cl = { };
Method[] mt = this.getClass().getDeclaredMethods();
Object[] param = { };
for (int im=0;im<mt.length;im++) {
try {
String name = mt[im].getName();
if (name.startsWith("init_")) {
mt[im].invoke(this,param);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
private void init_Hello() {
System.out.println("Hello Init");
}
public static void main(String[] args) {
new Test();
}
}
I made the jar of the progarm and ran the Jarg. The process seemed succesfully, but "Hello Init" was never printed when program executed afterward, bacause init_Hello method was removed by Jarg.
I used -verboseufm option on Jarg and obviously method init_Hello was removed because init_Hello was reported as unused method.
Perhaps Jarg has to be added with -normum option for no remove unused methods.
TY,
joy
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Some other tools cope with reflection by allowing the user to offer a list of elements which should have not have their names modified by the compression stages.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
DA,
I have tried Jarg. This application was working on simple jar.
But I have problem on progarm as follows:
import java.lang.reflect.Method;
public class Test {
public Test() {
Class[] cl = { };
Method[] mt = this.getClass().getDeclaredMethods();
Object[] param = { };
for (int im=0;im<mt.length;im++) {
try {
String name = mt[im].getName();
if (name.startsWith("init_")) {
mt[im].invoke(this,param);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
private void init_Hello() {
System.out.println("Hello Init");
}
public static void main(String[] args) {
new Test();
}
}
I made the jar of the progarm and ran the Jarg. The process seemed succesfully, but "Hello Init" was never printed when program executed afterward, bacause init_Hello method was removed by Jarg.
I used -verboseufm option on Jarg and obviously method init_Hello was removed because init_Hello was reported as unused method.
Perhaps Jarg has to be added with -normum option for no remove unused methods.
TY,
joy
since you used reflection, it is by definition passing java dependency checking, why do you use reflection?
Some other tools cope with reflection by allowing the user to offer a list of elements which should have not have their names modified by the compression stages.