/** * Add an exception to those thrown by this method. */ public void addException(Class type) { addException(type.getName()); }
/** * Add an exception to those thrown by this method. */ public void addException(Class type) { addException(type.getName()); }
/** * Add an exception to those thrown by this method. */ public void addException(BCClass type) { addException(type.getName()); }
/** * Add an exception to those thrown by this method. */ public void addException(BCClass type) { addException(type.getName()); }
/** * Set the checked exceptions thrown by this method. Use null or an * empty array for none. */ public void setExceptions(String[] exceptions) { if (exceptions != null) { for (int i = 0; i < exceptions.length; i++) if (exceptions[i] == null) throw new NullPointerException("exceptions[" + i + "] = null"); } clear(); if (exceptions != null) for (int i = 0; i < exceptions.length; i++) addException(exceptions[i]); }
/** * Set the checked exceptions thrown by this method. Use null or an * empty array for none. */ public void setExceptions(String[] exceptions) { if (exceptions != null) { for (int i = 0; i < exceptions.length; i++) if (exceptions[i] == null) throw new NullPointerException("exceptions[" + i + "] = null"); } clear(); if (exceptions != null) for (int i = 0; i < exceptions.length; i++) addException(exceptions[i]); }
meth.makeProtected(); Exceptions exceps = meth.getExceptions(true); exceps.addException(IOException.class); exceps.addException(ClassNotFoundException.class); Code code = meth.getCode(true);
meth.makeProtected(); Exceptions exceps = meth.getExceptions(true); exceps.addException(IOException.class); exceps.addException(ClassNotFoundException.class); Code code = meth.getCode(true);
/** * 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(); }
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 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(); }
/** * 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(); }