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. */