FaviconExceptionMapperFactory implements Opcodes { static byte[] create() throws IOException { ClassReader reader = new ClassReader(FaviconExceptionMapper.class.getClassLoader().getResourceAsStream(FaviconExceptionMapper.class.getName().replace('.', '/') + ".class")); ClassWriter writer = new ClassWriter(0); Remapper remapper = new Remapper() { @Override public String map(String typeName) { if (typeName.equals("org/wildfly/swarm/jaxrs/internal/FaviconExceptionMapper")) { return "org/wildfly/swarm/generated/FaviconExceptionMapper"; } return super.map(typeName); } }; RemappingClassAdapter adapter = new RemappingClassAdapter(writer, remapper); reader.accept(adapter, 0); writer.visitAnnotation("Ljavax/ws/rs/ext/Provider;", true).visitEnd(); writer.visitEnd(); return writer.toByteArray(); }    }
@Test public void testCreate() throws IOException { byte[] bytes = FaviconExceptionMapperFactory.create(); }