ConstantPool cp = new ConstantPool();
ClassReader cr = new ClassReader(new FileInputStream(f));
ClassWriter cw = new ClassWriter(0);
ClassConstantsCollector ccc = new ClassConstantsCollector(cw, cp);
ClassOptimizer co = new ClassOptimizer(ccc, remapper);
cr.accept(co, ClassReader.SKIP_DEBUG);
Set constants = new TreeSet(new ConstantComparator());
constants.addAll(cp.values());
cr = new ClassReader(cw.toByteArray());