unenhanced);
if (conf.getRuntimeUnenhancedClassesConstant()
== RuntimeUnenhancedClasssesModes.WARN)
log.warn(msg);
else
throw new UserException(msg);
}
return null;
}
boolean redefine = ClassRedefiner.canRedefineClasses();
if (redefine)
log.info(_loc.get("enhance-and-subclass-no-redef-start",
classes));
else
log.info(_loc.get("enhance-and-subclass-and-redef-start",
classes));
final Map<Class, byte[]> map = new HashMap<Class, byte[]>();
final List subs = new ArrayList(classes.size());
final List ints = new ArrayList(classes.size());
Set<Class> unspecified = null;
for (Iterator iter = classes.iterator(); iter.hasNext(); ) {
final Class cls = (Class) iter.next();
final PCEnhancer enhancer = new PCEnhancer(conf, cls);
enhancer.setBytecodeWriter(new BytecodeWriter() {
public void write(BCClass bc) throws IOException {
ManagedClassSubclasser.write(bc, enhancer, map,
cls, subs, ints);
}
});
if (redefine)
enhancer.setRedefine(true);
enhancer.setCreateSubclass(true);
enhancer.setAddDefaultConstructor(true);
// set this before enhancement as well as after since enhancement
// uses a different metadata repository, and the metadata config
// matters in the enhancement contract. Don't do any warning here,
// since we'll issue warnings when we do the final metadata
// reconfiguration at the end of this method.
configureMetaData(enhancer.getMetaData(), conf, redefine, false);
unspecified = collectRelatedUnspecifiedTypes(enhancer.getMetaData(),
classes, unspecified);
enhancer.run();
try {
enhancer.record();
} catch (IOException e) {
// our impl of BytecodeWriter doesn't throw IOException
throw new InternalException(e);
}
}
if (unspecified != null && !unspecified.isEmpty())
throw new UserException(_loc.get("unspecified-unenhanced-types",
classes, unspecified));
ClassRedefiner.redefineClasses(conf, map);
for (Class cls : map.keySet()) {
setIntercepting(conf, envLoader, cls);