@Test public void testRun() throws IOException { UnreachedCode uc = new UnreachedCode(); uc.run(group); ClassFile cf = group.getClasses().get(0); Method method = cf.findMethod("entry"); Assert.assertFalse(method.getCode().getExceptions().getExceptions().isEmpty()); method = cf.findMethod("method1Unused"); Assert.assertNotNull(method); Assert.assertFalse(method.getCode().getInstructions().getInstructions().stream().filter(i -> !(i instanceof Label)).findAny().isPresent()); Assert.assertTrue(method.getCode().getExceptions().getExceptions().isEmpty()); cf.removeMethod(method); method = cf.findMethod("<init>"); Assert.assertNotNull(method); Assert.assertFalse(method.getCode().getInstructions().getInstructions().stream().filter(i -> !(i instanceof Label)).findAny().isPresent()); cf.removeMethod(method); }
@Override public void run(ClassGroup group) { group.buildClassGraph(); execution = new Execution(group); execution.populateInitialMethods(); execution.run(); int count = 0; for (ClassFile cf : group.getClasses()) { for (Method m : cf.getMethods()) { if (m.getCode() == null) continue; count += removeUnused(m); } } logger.info("Removed {} unused instructions", count); }
UnreachedCode implements Deobfuscator { @Override public void run(ClassGroup group) { group.buildClassGraph(); execution = new Execution(group); execution.populateInitialMethods(); execution.run(); int count = 0; for (ClassFile cf : group.getClasses()) { for (Method m : cf.getMethods()) { if (m.getCode() == null) continue; count += removeUnused(m); } } logger.info("Removed {} unused instructions", count); } }
UnreachedCode implements Deobfuscator { @Override public void run(ClassGroup group) { group.buildClassGraph(); execution = new Execution(group); execution.populateInitialMethods(); execution.run(); int count = 0; for (ClassFile cf : group.getClasses()) { for (Method m : cf.getMethods()) { if (m.getCode() == null) continue; count += removeUnused(m); } } logger.info("Removed {} unused instructions", count); }  }
UnreachedCode implements Deobfuscator { @Override public void run(ClassGroup group) { group.buildClassGraph(); execution = new Execution(group); execution.populateInitialMethods(); execution.run(); int count = 0; for (ClassFile cf : group.getClasses()) { for (Method m : cf.getMethods()) { if (m.getCode() == null) continue; count += removeUnused(m); } } logger.info("Removed {} unused instructions", count); }  @Override void run(ClassGroup group); }
UnreachedCode implements Deobfuscator { @Override public void run(ClassGroup group) { group.buildClassGraph(); execution = new Execution(group); execution.populateInitialMethods(); execution.run(); int count = 0; for (ClassFile cf : group.getClasses()) { for (Method m : cf.getMethods()) { if (m.getCode() == null) continue; count += removeUnused(m); } } logger.info("Removed {} unused instructions", count); }  @Override void run(ClassGroup group);  }