// Set up a different classloader to load a different version of the class
String[] included = new String[]{CAR, CAR_EXT};
ClassLoader tccl = Thread.currentThread().getContextClassLoader();
ClassLoader cherryPickCl = new CherryPickClassLoader(included, null, tccl);
Thread.currentThread().setContextClassLoader(cherryPickCl);
ClassPool pool = ClassPool.getDefault();
// Insert a classpath so that Maven does not complain about not finding the class
pool.insertClassPath(new ClassClassPath(Car.class));
CtClass carCt = pool.get(CAR);
try {
carCt.addField(CtField.make("public int year;", carCt));
Class carClass = carCt.toClass();
if (isNewExternalizer) {
CtClass carExtCt = pool.get(CAR_EXT);
CtMethod writeObjMeth = carExtCt.getMethod("writeObject",
"(Ljava/io/ObjectOutput;Ljava/lang/Object;)V");
writeObjMeth.setBody("{\n" +
"$1.writeObject(((" + CAR + ") $2).plateNumber);\n" +
"$1.writeInt(((" + CAR + ") $2).year);\n" +