CtClass javassistClass = ClassPool.getDefault().get(this.getClass().getName());
// build a class with synthetic method, field, ctor
javassistClass.setName(this.getClass().getName()+"Generated");
int syntheticModifier = Constants.ACC_SYNTHETIC | Modifier.PUBLIC;
javassistClass.addMethod(CtNewMethod.make(syntheticModifier, CtClass.intType, "syntheticDo", new CtClass[]{}, new CtClass[]{}, "{return 0;}", javassistClass));
CtField field = new CtField(CtClass.intType, "syntheticField", javassistClass);
field.setModifiers(syntheticModifier);
javassistClass.addField(field);
CtConstructor ctor = new CtConstructor(new CtClass[]{CtClass.intType}, javassistClass);
ctor.setModifiers(syntheticModifier);
ctor.setBody("{super();}");
javassistClass.addConstructor(ctor);