- System.out.println(" pruning " + clazz.getClassName() + "." + methods[i].getName());
- if (!deleteMethods) {
- MethodGen mg = new MethodGen(methods[i], clazz.getClassName(), newcpg);
- mg.removeExceptions();
- InstructionList il = new InstructionList();
- mg.setInstructionList(il);
-
- InstructionHandle ih_0 = il.append(factory.createNew("java.lang.UnsatisfiedLinkError"));
- il.append(InstructionConstants.DUP);
- il.append(factory.createInvoke("java.lang.UnsatisfiedLinkError",
- "<init>", Type.VOID, Type.NO_ARGS, Constants.INVOKESPECIAL));
- il.append(InstructionConstants.ATHROW);
-
- mg.setMaxStack();
- mg.setMaxLocals();
- mg.removeExceptions();
- mg.removeLocalVariables();
- mg.removeExceptionHandlers();
- mg.removeLineNumbers();
-
- cg.replaceMethod(methods[i], mg.getMethod());
- il.dispose();
- } else {
- cg.removeMethod(methods[i]);
- }
+ System.out.println(" pruning " +(constructed?"":"unconstructed")+ " method " +
+ clazz.getClassName() + "." + methods[i].getName());
+ // FIXME: try deleteMethods
+ if (deleteMethods) { cg.removeMethod(methods[i]); continue; }
+ MethodGen mg = new MethodGen(methods[i], clazz.getClassName(), newcpg);
+ mg.removeExceptions();
+ InstructionList il = new InstructionList();
+ mg.setInstructionList(il);
+ InstructionHandle ih_0 = il.append(factory.createNew("java.lang.UnsatisfiedLinkError"));
+ il.append(InstructionConstants.DUP);
+ il.append(factory.createInvoke("java.lang.UnsatisfiedLinkError",
+ "<init>", Type.VOID, Type.NO_ARGS, Constants.INVOKESPECIAL));
+ il.append(InstructionConstants.ATHROW);
+ mg.setMaxStack();
+ mg.setMaxLocals();
+ mg.removeExceptions();
+ mg.removeLocalVariables();
+ mg.removeExceptionHandlers();
+ mg.removeLineNumbers();
+ cg.replaceMethod(methods[i], mg.getMethod());
+ il.dispose();