protected Class<?> defineClass(String name, byte[] ba) { Class<?> c; _.Var<ClassWriter> cw = _.val(null); ByteCodeVisitor enhancer = enhancerManager.generalEnhancer(name, cw); if (null == enhancer) { c = defineClassX(name, ba, 0, ba.length, DOMAIN); } else { ClassWriter w = new ClassWriter(ClassWriter.COMPUTE_MAXS); cw.set(w); enhancer.commitDownstream(); ClassReader r; r = new ClassReader(ba); try { r.accept(enhancer, 0); byte[] baNew = w.toByteArray(); c = defineClassX(name, baNew, 0, baNew.length, DOMAIN); } catch (RuntimeException e) { throw e; } catch (Error e) { throw e; } catch (Exception e) { throw E.unexpected("Error processing class " + name); } } return c; }