From 37712645ade4a363aa5f02752c46a9f6fd3b9dc3 Mon Sep 17 00:00:00 2001 From: chiba Date: Tue, 18 May 2004 08:43:47 +0000 Subject: [PATCH] minor and final changes for 3.0 beta git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@106 30ef5769-5b8d-40dd-aea6-55b5d6557bb3 --- src/main/javassist/ClassPool.java | 6 ++-- src/main/javassist/CtNewMethod.java | 35 ++++++++++++++++++++-- src/main/javassist/rmi/ObjectImporter.java | 4 +-- 3 files changed, 37 insertions(+), 8 deletions(-) diff --git a/src/main/javassist/ClassPool.java b/src/main/javassist/ClassPool.java index 58a68f27..ce64c847 100644 --- a/src/main/javassist/ClassPool.java +++ b/src/main/javassist/ClassPool.java @@ -227,8 +227,8 @@ public class ClassPool { * * @see CtClass#forName(String) * @see CtClass#toClass() - * @see #toClass() - * @see #forName(String) + * @see ClassPool#toClass(CtClass) + * @see ClassPool#forName(String) */ public static class SimpleLoader extends ClassLoader { /** @@ -438,7 +438,7 @@ public class ClassPool { * * @param classname a fully-qualified class name. * @return null if the class file could not be found. - * @see CtClassType#getURL() + * @see CtClass#getURL() */ public URL find(String classname) { return source.find(classname); diff --git a/src/main/javassist/CtNewMethod.java b/src/main/javassist/CtNewMethod.java index 2f8624d4..eb65b73e 100644 --- a/src/main/javassist/CtNewMethod.java +++ b/src/main/javassist/CtNewMethod.java @@ -82,7 +82,8 @@ public class CtNewMethod { } /** - * Creates a public method. + * Creates a public (non-static) method. The created method cannot + * be changed to a static method later. * * @param returnType the type of the returned value. * @param mname the method name. @@ -94,14 +95,42 @@ public class CtNewMethod { * does nothing except returning zero or null. * @param declaring the class to which the created method is added. */ - public static CtMethod make(CtClass returnType, String mname, - CtClass[] parameters, CtClass[] exceptions, + public static CtMethod make(CtClass returnType, + String mname, CtClass[] parameters, + CtClass[] exceptions, + String body, CtClass declaring) + throws CannotCompileException + { + return make(Modifier.PUBLIC, returnType, mname, parameters, exceptions, + body, declaring); + } + + /** + * Creates a method. + * + * @param modifiers access modifiers. + * @param returnType the type of the returned value. + * @param mname the method name. + * @param parameters a list of the parameter types. + * @param exceptions a list of the exception types. + * @param body the source text of the method body. + * It must be a block surrounded by {}. + * If it is null, the created method + * does nothing except returning zero or null. + * @param declaring the class to which the created method is added. + * + * @see Modifier + */ + public static CtMethod make(int modifiers, CtClass returnType, + String mname, CtClass[] parameters, + CtClass[] exceptions, String body, CtClass declaring) throws CannotCompileException { try { CtMethod cm = new CtMethod(returnType, mname, parameters, declaring); + cm.setModifiers(modifiers); cm.setExceptionTypes(exceptions); cm.setBody(body); return cm; diff --git a/src/main/javassist/rmi/ObjectImporter.java b/src/main/javassist/rmi/ObjectImporter.java index 61ecb170..96e1eb95 100644 --- a/src/main/javassist/rmi/ObjectImporter.java +++ b/src/main/javassist/rmi/ObjectImporter.java @@ -75,8 +75,8 @@ public class ObjectImporter implements java.io.Serializable { private String servername, orgServername; private int port, orgPort; - private byte[] lookupCommand = "POST /lookup HTTP/1.0".getBytes(); - private byte[] rmiCommand = "POST /rmi HTTP/1.0".getBytes(); + protected byte[] lookupCommand = "POST /lookup HTTP/1.0".getBytes(); + protected byte[] rmiCommand = "POST /rmi HTTP/1.0".getBytes(); /** * Constructs an object importer. -- 2.39.5