/** * Move code-related attributes from one method to another. */ private static void transferCodeAttributes(BCMethod from, BCMethod to) { Code code = from.getCode(false); if (code != null) { to.addAttribute(code); from.removeCode(); } Exceptions exceps = from.getExceptions(false); if (exceps != null) to.addAttribute(exceps); }
/** * Move code-related attributes from one method to another. */ private static void transferCodeAttributes(BCMethod from, BCMethod to) { Code code = from.getCode(false); if (code != null) { to.addAttribute(code); from.removeCode(); } Exceptions exceps = from.getExceptions(false); if (exceps != null) to.addAttribute(exceps); }
/** * Move code-related attributes from one method to another. */ private static void transferCodeAttributes(BCMethod from, BCMethod to) { Code code = from.getCode(false); if (code != null) { to.addAttribute(code); from.removeCode(); } Exceptions exceps = from.getExceptions(false); if (exceps != null) to.addAttribute(exceps); }
/** * Move code-related attributes from one method to another. */ private static void transferCodeAttributes(BCMethod from, BCMethod to) { Code code = from.getCode(false); if (code != null) { to.addAttribute(code); from.removeCode(); } Exceptions exceps = from.getExceptions(false); if (exceps != null) to.addAttribute(exceps); }
/** * Move code-related attributes from one method to another. */ private static void transferCodeAttributes(BCMethod from, BCMethod to) { Code code = from.getCode(false); if (code != null) { to.addAttribute(code); from.removeCode(); } Exceptions exceps = from.getExceptions(false); if (exceps != null) to.addAttribute(exceps); }
/** * Write unmanaged fields to the stream (pcWriteUnmanaged). */ private void addWriteUnmanaged(Collection unmgd, boolean parentDetachable) throws NoSuchMethodException { Class[] outargs = new Class[]{ ObjectOutput.class }; BCMethod meth = _pc.declareMethod(PRE + "WriteUnmanaged", void.class, outargs); meth.makeProtected(); Exceptions exceps = meth.getExceptions(true); exceps.addException(IOException.class); Code code = meth.getCode(true); // super.writeUnmanaged (out); if (parentDetachable) { loadManagedInstance(code, false); code.aload().setParam(0); code.invokespecial().setMethod(getType(_meta. getPCSuperclassMetaData()), PRE + "WriteUnmanaged", void.class, outargs); } // write declared unmanaged serializable fields BCField field; for (Iterator itr = unmgd.iterator(); itr.hasNext();) { field = (BCField) itr.next(); writeExternal(code, field.getName(), field.getType(), null); } code.vreturn(); code.calculateMaxStack(); code.calculateMaxLocals(); }
/** * Write unmanaged fields to the stream (pcWriteUnmanaged). */ private void addWriteUnmanaged(Collection unmgd, boolean parentDetachable) throws NoSuchMethodException { Class[] outargs = new Class[]{ ObjectOutput.class }; BCMethod meth = _pc.declareMethod(PRE + "WriteUnmanaged", void.class, outargs); meth.makeProtected(); Exceptions exceps = meth.getExceptions(true); exceps.addException(IOException.class); Code code = meth.getCode(true); // super.writeUnmanaged (out); if (parentDetachable) { loadManagedInstance(code, false); code.aload().setParam(0); code.invokespecial().setMethod(getType(_meta. getPCSuperclassMetaData()), PRE + "WriteUnmanaged", void.class, outargs); } // write declared unmanaged serializable fields BCField field; for (Iterator itr = unmgd.iterator(); itr.hasNext();) { field = (BCField) itr.next(); writeExternal(code, field.getName(), field.getType(), null); } code.vreturn(); code.calculateMaxStack(); code.calculateMaxLocals(); }
/** * Write unmanaged fields to the stream (pcWriteUnmanaged). */ private void addWriteUnmanaged(Collection unmgd, boolean parentDetachable) throws NoSuchMethodException { Class[] outargs = new Class[]{ ObjectOutput.class }; BCMethod meth = _pc.declareMethod(PRE + "WriteUnmanaged", void.class, outargs); meth.makeProtected(); Exceptions exceps = meth.getExceptions(true); exceps.addException(IOException.class); Code code = meth.getCode(true); // super.writeUnmanaged (out); if (parentDetachable) { loadManagedInstance(code, false); code.aload().setParam(0); code.invokespecial().setMethod(getType(_meta. getPCSuperclassMetaData()), PRE + "WriteUnmanaged", void.class, outargs); } // write declared unmanaged serializable fields BCField field; for (Iterator itr = unmgd.iterator(); itr.hasNext();) { field = (BCField) itr.next(); writeExternal(code, field.getName(), field.getType(), null); } code.vreturn(); code.calculateMaxStack(); code.calculateMaxLocals(); }
inargs); meth.makeProtected(); Exceptions exceps = meth.getExceptions(true); exceps.addException(IOException.class); exceps.addException(ClassNotFoundException.class);
inargs); meth.makeProtected(); Exceptions exceps = meth.getExceptions(true); exceps.addException(IOException.class); exceps.addException(ClassNotFoundException.class);
/** * 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", Object.class, new Class[] { Proxy.class, boolean.class }); code.areturn(); code.calculateMaxLocals(); code.calculateMaxStack(); }
/** * 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", Object.class, new Class[] { Proxy.class, boolean.class }); code.areturn(); code.calculateMaxLocals(); code.calculateMaxStack(); }
/** * 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", Object.class, new Class[] { Proxy.class, boolean.class }); code.areturn(); code.calculateMaxLocals(); code.calculateMaxStack(); }
/** * 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", Object.class, new Class[] { Proxy.class, boolean.class }); code.areturn(); code.calculateMaxLocals(); code.calculateMaxStack(); }
/** * 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", Object.class, new Class[] { Proxy.class, boolean.class }); code.areturn(); code.calculateMaxLocals(); code.calculateMaxStack(); }
private void addWriteExternalFields() throws NoSuchMethodException { Class<?>[] outargs = new Class[]{ ObjectOutput.class }; BCMethod meth = _pc.declareMethod("writeExternalFields", void.class, outargs); meth.setAccessFlags(Constants.ACCESS_PROTECTED); Exceptions exceps = meth.getExceptions(true); exceps.addException(IOException.class); Code code = meth.getCode(true); Class<?> sup = _meta.getPCSuperclass(); if (sup != null) { // add a call to super.readExternalFields() loadManagedInstance(code, false); code.aload().setParam(0); code.invokespecial().setMethod(sup, "writeExternalFields", void.class, outargs); } FieldMetaData[] fmds = _meta.getDeclaredFields(); for (int i = 0; i < fmds.length; i++) { if (!fmds[i].isTransient()) { writeExternal(code, fmds[i].getName(), fmds[i].getDeclaredType(), fmds[i]); } } // return code.vreturn(); code.calculateMaxStack(); code.calculateMaxLocals(); }
private void addReadExternalFields() throws NoSuchMethodException { Class<?>[] inargs = new Class[]{ ObjectInput.class }; BCMethod meth = _pc.declareMethod("readExternalFields", void.class, inargs); meth.setAccessFlags(Constants.ACCESS_PROTECTED); Exceptions exceps = meth.getExceptions(true); exceps.addException(IOException.class); exceps.addException(ClassNotFoundException.class); Code code = meth.getCode(true); Class<?> sup = _meta.getPCSuperclass(); if (sup != null) { //add a call to super.readExternalFields() loadManagedInstance(code, false); code.aload().setParam(0); code.invokespecial().setMethod(sup, "readExternalFields", void.class, inargs); } // read managed fields FieldMetaData[] fmds = _meta.getDeclaredFields(); for (int i = 0; i < fmds.length; i++) { if (!fmds[i].isTransient()) { readExternal(code, fmds[i].getName(), fmds[i].getDeclaredType(), fmds[i]); } } code.vreturn(); code.calculateMaxStack(); code.calculateMaxLocals(); }
private void addReadExternalFields() throws NoSuchMethodException { Class<?>[] inargs = new Class[]{ ObjectInput.class }; BCMethod meth = _pc.declareMethod("readExternalFields", void.class, inargs); meth.setAccessFlags(Constants.ACCESS_PROTECTED); Exceptions exceps = meth.getExceptions(true); exceps.addException(IOException.class); exceps.addException(ClassNotFoundException.class); Code code = meth.getCode(true); Class<?> sup = _meta.getPCSuperclass(); if (sup != null) { //add a call to super.readExternalFields() loadManagedInstance(code, false); code.aload().setParam(0); code.invokespecial().setMethod(sup, "readExternalFields", void.class, inargs); } // read managed fields FieldMetaData[] fmds = _meta.getDeclaredFields(); for (int i = 0; i < fmds.length; i++) { if (!fmds[i].isTransient()) { readExternal(code, fmds[i].getName(), fmds[i].getDeclaredType(), fmds[i]); } } code.vreturn(); code.calculateMaxStack(); code.calculateMaxLocals(); }
private void addWriteExternalFields() throws NoSuchMethodException { Class<?>[] outargs = new Class[]{ ObjectOutput.class }; BCMethod meth = _pc.declareMethod("writeExternalFields", void.class, outargs); meth.setAccessFlags(Constants.ACCESS_PROTECTED); Exceptions exceps = meth.getExceptions(true); exceps.addException(IOException.class); Code code = meth.getCode(true); Class<?> sup = _meta.getPCSuperclass(); if (sup != null) { // add a call to super.readExternalFields() loadManagedInstance(code, false); code.aload().setParam(0); code.invokespecial().setMethod(sup, "writeExternalFields", void.class, outargs); } FieldMetaData[] fmds = _meta.getDeclaredFields(); for (int i = 0; i < fmds.length; i++) { if (!fmds[i].isTransient()) { writeExternal(code, fmds[i].getName(), fmds[i].getDeclaredType(), fmds[i]); } } // return code.vreturn(); code.calculateMaxStack(); code.calculateMaxLocals(); }
private void addReadExternalFields() throws NoSuchMethodException { Class<?>[] inargs = new Class[]{ ObjectInput.class }; BCMethod meth = _pc.declareMethod("readExternalFields", void.class, inargs); meth.setAccessFlags(Constants.ACCESS_PROTECTED); Exceptions exceps = meth.getExceptions(true); exceps.addException(IOException.class); exceps.addException(ClassNotFoundException.class); Code code = meth.getCode(true); Class<?> sup = _meta.getPCSuperclass(); if (sup != null) { //add a call to super.readExternalFields() loadManagedInstance(code, false); code.aload().setParam(0); code.invokespecial().setMethod(sup, "readExternalFields", void.class, inargs); } // read managed fields FieldMetaData[] fmds = _meta.getDeclaredFields(); for (int i = 0; i < fmds.length; i++) { if (!fmds[i].isTransient()) { readExternal(code, fmds[i].getName(), fmds[i].getDeclaredType(), fmds[i]); } } code.vreturn(); code.calculateMaxStack(); code.calculateMaxLocals(); }