A: 除了在命令行用-Xobfuscate参数控制符号混淆级别外,还可以在源代码中使用符号保留指令来控制那些符号需要保留,符号保留指令是一个Java文档注释指令,可以插入在类和类成员的文档注释中,例如: /** * This class should preserve. * @preserve */ public class Foo { /** * You can specify which field should be preserved. * @preserve */ private int x;
/** * This field is not preserved. */ private int y;
/** * You can also preserve methods. * @preserve */ public void hello() {}
/** * This method is not preserved. */ private void collect() {} } 假如没有@preserve指令,则根据混淆级别及成员的访问级别来确定符号是否保留。
public class AboutBox extends JDialog { public AboutBox() { initform(); }
JPanel panel1 = new JPanel(); JButton button1 = new JButton(); JLabel jLabel2 = new JLabel(); JTextArea jTextArea1 = new JTextArea();
/** * NOTE: The following code is required by the form designer. * It can be modified using the form editor. Do not * modify it using the code editor. */