!include once #1019934 // BCEL import org.apache.bcel.classfile.Attribute; import org.apache.bcel.classfile.SourceFile; import org.apache.bcel.generic.*; static void bcelRoundtrip(InputStream classFile, S fileName, IVF modifier, OutputStream newClassFile) { JavaClass c = new ClassParser(classFile, fileName).parse(); ClassGen g = new ClassGen(c); modifier?.get(g); for (Attribute attr : g.getAttributes()) if (attr instanceof SourceFile) { g.removeAttribute(attr); break; } g.addAttribute(new SourceFile( g.getConstantPool().addUtf8("SourceFile"), 2, nameIndex, g.getConstantPool().getConstantPool())); c = g.getJavaClass(); c.dump(newClassFile); }