* Add a writeReplace implementation that serializes to a non-proxy type
* unless detached and this is a build-time generated class.
*/
private void addWriteReplaceMethod(BCClass bc, boolean runtime) {
BCMethod m = bc.declareMethod("writeReplace", Object.class, null);
m.makeProtected();
m.getExceptions(true).addException(ObjectStreamException.class);
Code code = m.getCode(true);
code.aload().setThis();
code.constant().setValue(!runtime);
code.invokestatic().setMethod(Proxies.class, "writeReplace",