ConfigFieldsDefiner extends PrototypicalClassAdapter { public static byte[] define(String className, File classFile, Map<String, ?> config) { if(className == null || classFile == null || config == null || config.isEmpty()) { return null; } try { ConfigClassScanner configClassScanner = scanConfigurableClass(className, classFile); checkConfig(className, config, configClassScanner); final int writerFlags = ClassWriter.COMPUTE_MAXS; ConfigFieldsDefiner adapter = new ConfigFieldsDefiner( writerFlags, className, configClassScanner, config); ClassAdapterRunner runner = ClassAdapterRunner.create(adapter, classFile); byte[] bytecode = runner.run(); return bytecode; } catch (Exception e) { e.printStackTrace(); throw e; } } private  ConfigFieldsDefiner(
      int classWriterFlags, 
      String className, 
      ConfigClassScanner configScanner,
      Map<String, ?> config); static byte[] define(String className, File classFile, Map<String, ?> config); static Type toPrimitiveType(Class<?> klass); @Override FieldVisitor visitField(int access, String name, String desc,
      String signature, Object value); @Override MethodVisitor visitMethod(int access, String name, String desc, 
      String signature, String[] exceptions); @Override void visitEnd();  }
@Test public void smokeTestRedefinition() { Map<String, String> config = new HashMap<>(); final String field = "UNDEFINED"; final String value = "blah"; config.put(field, value); ConfigFieldsDefiner.define(className, classFile, config); }