diff --git a/Readme.html b/Readme.html index 4699d715..9c88637d 100644 --- a/Readme.html +++ b/Readme.html @@ -137,7 +137,7 @@

3. sample/reflect/*.java

Compare this result with that of the regular execution without reflection: @@ -151,7 +151,7 @@

3. sample/reflect/*.java

To do this, type the commands:

Then, @@ -292,14 +292,18 @@

Changes

  • The return type of CtClass.stopPruning() was changed from void to boolean.
  • toMethod() in javassist.CtConstructor has been implemented. -
  • javassist.preproc package was elminated and the source was - moved to the sample directory. - - -

    - version 3.1 - -

    - version 3.1 RC2 in September 7, 2005 diff --git a/build.xml b/build.xml index b7562364..1f78b28a 100644 --- a/build.xml +++ b/build.xml @@ -109,18 +109,18 @@ to ${build.classes.dir}. excludepackagenames="javassist.compiler.*,javassist.convert.*" sourcepath="src/main" defaultexcludes="yes" + locale="en_US" + charset="iso-8859-1" destdir="html" author="true" version="true" use="true" - Locale="en_US" - charset="iso-8859-1" - Public="true" + public="true" nohelp="true" windowtitle="Javassist API"> Javassist]]> Javassist, a Java-bytecode translator toolkit. -Copyright (C) 1999-2005 Shigeru Chiba. All Rights Reserved.]]> +Copyright (C) 1999-2006 Shigeru Chiba. All Rights Reserved.]]> @@ -151,7 +151,8 @@ Copyright (C) 1999-2005 Shigeru Chiba. All Rights Reserved.]]> - ** please run sample-rmi and sample-evolve separately ** + ** please run sample-rmi, sample-evolve, and + sample-hotswap (or -hotswap5) separately ** @@ -161,7 +162,7 @@ Copyright (C) 1999-2005 Shigeru Chiba. All Rights Reserved.]]> - + @@ -212,6 +213,7 @@ Copyright (C) 1999-2005 Shigeru Chiba. All Rights Reserved.]]> ** JAVA_HOME/lib/tools.jar must be included in CLASS_PATH + ** for JDK 1.4 @@ -221,6 +223,7 @@ Copyright (C) 1999-2005 Shigeru Chiba. All Rights Reserved.]]> ** JAVA_HOME/lib/tools.jar must be included in CLASS_PATH + ** for JDK 1.5 or later diff --git a/sample/duplicate/DuplicatedObject.java b/sample/duplicate/DuplicatedObject.java index 5995abcc..7161493c 100644 --- a/sample/duplicate/DuplicatedObject.java +++ b/sample/duplicate/DuplicatedObject.java @@ -1,6 +1,6 @@ package sample.duplicate; -import javassist.reflect.*; +import javassist.tools.reflect.*; public class DuplicatedObject extends Metaobject { private DuplicatedObject backup; diff --git a/sample/duplicate/Main.java b/sample/duplicate/Main.java index e152a23e..064f13cd 100644 --- a/sample/duplicate/Main.java +++ b/sample/duplicate/Main.java @@ -3,7 +3,7 @@ /* Runtime metaobject (JDK 1.2 or later only). - With the javassist.reflect package, the users can attach a metaobject + With the javassist.tools.reflect package, the users can attach a metaobject to an object. The metaobject can control the behavior of the object. For example, you can implement fault tolerancy with this ability. One of the implementation techniques of fault tolernacy is to make a copy @@ -30,15 +30,15 @@ Runtime metaobject (JDK 1.2 or later only). % java sample.duplicate.Main You would see two balls in a window. This is because - sample.duplicate.Viewer is loaded by javassist.reflect.Loader so that + sample.duplicate.Viewer is loaded by javassist.tools.reflect.Loader so that a metaobject would be attached. */ public class Main { public static void main(String[] args) throws Throwable { - javassist.reflect.Loader cl = new javassist.reflect.Loader(); + javassist.tools.reflect.Loader cl = new javassist.tools.reflect.Loader(); cl.makeReflective("sample.duplicate.Ball", "sample.duplicate.DuplicatedObject", - "javassist.reflect.ClassMetaobject"); + "javassist.tools.reflect.ClassMetaobject"); cl.run("sample.duplicate.Viewer", args); } } diff --git a/sample/evolve/DemoServer.java b/sample/evolve/DemoServer.java index dd64c550..b334bccb 100644 --- a/sample/evolve/DemoServer.java +++ b/sample/evolve/DemoServer.java @@ -1,6 +1,6 @@ package sample.evolve; -import javassist.web.*; +import javassist.tools.web.*; import java.io.*; /** diff --git a/sample/evolve/Evolution.java b/sample/evolve/Evolution.java index ecae0921..e804ff46 100644 --- a/sample/evolve/Evolution.java +++ b/sample/evolve/Evolution.java @@ -60,9 +60,9 @@ public void onLoad(ClassPool _pool, String classname) private void onLoadUpdatable(String classname) throws NotFoundException, CannotCompileException { // if the class is a concrete class, - // classname is $. + // classname is $$. - int i = classname.lastIndexOf('$'); + int i = classname.lastIndexOf("$$"); if (i <= 0) return; @@ -72,7 +72,7 @@ private void onLoadUpdatable(String classname) throws NotFoundException, int version; try { - version = Integer.parseInt(classname.substring(i + 1)); + version = Integer.parseInt(classname.substring(i + 2)); } catch (NumberFormatException e) { throw new NotFoundException(classname, e); diff --git a/sample/evolve/VersionManager.java b/sample/evolve/VersionManager.java index 184397fd..efecee19 100644 --- a/sample/evolve/VersionManager.java +++ b/sample/evolve/VersionManager.java @@ -41,7 +41,7 @@ private static Class getUpdatedClass(String qualifiedClassname) else version = ((Integer)found).intValue() + 1; - Class c = Class.forName(qualifiedClassname + '$' + version); + Class c = Class.forName(qualifiedClassname + "$$" + version); versionNo.put(qualifiedClassname, new Integer(version)); return c; } diff --git a/sample/hotswap/Test.java b/sample/hotswap/Test.java index e15afc9a..651d2184 100644 --- a/sample/hotswap/Test.java +++ b/sample/hotswap/Test.java @@ -1,5 +1,5 @@ import java.io.*; -import javassist.tools.HotSwapper; +import javassist.util.HotSwapper; public class Test { public static void main(String[] args) throws Exception { diff --git a/sample/reflect/Main.java b/sample/reflect/Main.java index d9733abc..972e8964 100644 --- a/sample/reflect/Main.java +++ b/sample/reflect/Main.java @@ -1,6 +1,6 @@ package sample.reflect; -import javassist.reflect.Loader; +import javassist.tools.reflect.Loader; /* The "verbose metaobject" example (JDK 1.2 or later only). @@ -14,7 +14,7 @@ To run, - % java javassist.reflect.Loader sample.reflect.Main Joe + % java javassist.tools.reflect.Loader sample.reflect.Main Joe Compare this result with that of the regular execution without reflection: @@ -25,7 +25,7 @@ public static void main(String[] args) throws Throwable { Loader cl = (Loader)Main.class.getClassLoader(); cl.makeReflective("sample.reflect.Person", "sample.reflect.VerboseMetaobj", - "javassist.reflect.ClassMetaobject"); + "javassist.tools.reflect.ClassMetaobject"); cl.run("sample.reflect.Person", args); } diff --git a/sample/reflect/Person.java b/sample/reflect/Person.java index 445d3807..90ccb18f 100644 --- a/sample/reflect/Person.java +++ b/sample/reflect/Person.java @@ -4,8 +4,8 @@ package sample.reflect; -import javassist.reflect.Metalevel; -import javassist.reflect.Metaobject; +import javassist.tools.reflect.Metalevel; +import javassist.tools.reflect.Metaobject; public class Person { public String name; diff --git a/sample/reflect/VerboseMetaobj.java b/sample/reflect/VerboseMetaobj.java index 91dba579..cc47999c 100644 --- a/sample/reflect/VerboseMetaobj.java +++ b/sample/reflect/VerboseMetaobj.java @@ -1,6 +1,6 @@ package sample.reflect; -import javassist.reflect.*; +import javassist.tools.reflect.*; public class VerboseMetaobj extends Metaobject { public VerboseMetaobj(Object self, Object[] args) { diff --git a/sample/rmi/CountApplet.java b/sample/rmi/CountApplet.java index 0bebdaf9..e4ee0ee2 100644 --- a/sample/rmi/CountApplet.java +++ b/sample/rmi/CountApplet.java @@ -3,9 +3,9 @@ import java.applet.*; import java.awt.*; import java.awt.event.*; -import javassist.rmi.ObjectImporter; -import javassist.rmi.ObjectNotFoundException; -import javassist.web.Viewer; +import javassist.tools.rmi.ObjectImporter; +import javassist.tools.rmi.ObjectNotFoundException; +import javassist.tools.web.Viewer; public class CountApplet extends Applet implements ActionListener { private Font font; diff --git a/sample/rmi/Counter.java b/sample/rmi/Counter.java index f8a0fcf5..0920ca73 100644 --- a/sample/rmi/Counter.java +++ b/sample/rmi/Counter.java @@ -1,6 +1,6 @@ package sample.rmi; -import javassist.rmi.AppletServer; +import javassist.tools.rmi.AppletServer; import java.io.IOException; import javassist.CannotCompileException; import javassist.NotFoundException; diff --git a/sample/rmi/start.html b/sample/rmi/start.html index 696b629c..33321ad1 100644 --- a/sample/rmi/start.html +++ b/sample/rmi/start.html @@ -12,4 +12,4 @@

    If you don't want to use a web browser, do as follows: -

      % java javassist.web.Viewer localhost 5001 sample.rmi.CountApplet
    +
      % java javassist.tools.web.Viewer localhost 5001 sample.rmi.CountApplet
    diff --git a/sample/rmi/webdemo.html b/sample/rmi/webdemo.html index d313ec3c..a2b595ce 100644 --- a/sample/rmi/webdemo.html +++ b/sample/rmi/webdemo.html @@ -6,7 +6,7 @@

    Remote Method Invocation

    local object. The applet can communicate through a socket with the host that executes the web server distributing that applet. However, the applet cannot directly call a method on an object if the object is -on a remote host. The javassist.rmi package provides +on a remote host. The javassist.tools.rmi package provides a mechanism for the applet to transparently access the remote object. The rules that the applet must be subject to are simpler than the standard Java RMI. @@ -36,7 +36,7 @@

    1. Sample applet

    Figure 1: Applet

    -import javassist.rmi.ObjectImporter;
    +import javassist.tools.rmi.ObjectImporter;
     
     public class CountApplet extends Applet implements ActionListener {
       private Font font;
    @@ -106,7 +106,7 @@ 

    1. Sample applet

    }
    -

    Note that the javassist.rmi package does not require +

    Note that the javassist.tools.rmi package does not require the Counter class to be an interface unlike the Java RMI, with which Counter must be an interface and it must be implemented by another class. @@ -167,7 +167,7 @@

    2. Features

    With the Java RMI or Voyager, the applet programmer must define an interface for every remote object class and access the remote object through that interface. -On the other hand, the javassist.rmi package does not +On the other hand, the javassist.tools.rmi package does not require the programmer to follow that programming convention. It is suitable for writing simple distributed programs like applets. diff --git a/src/main/javassist/CtClass.java b/src/main/javassist/CtClass.java index 74ab0d3e..d4178e7f 100644 --- a/src/main/javassist/CtClass.java +++ b/src/main/javassist/CtClass.java @@ -703,7 +703,7 @@ public CtMethod[] getMethods() { * * @param name method name * @param desc method descriptor - * @see CtBehavior.getSignature() + * @see CtBehavior#getSignature() * @see javassist.bytecode.Descriptor */ public CtMethod getMethod(String name, String desc) diff --git a/src/main/javassist/CtMethod.java b/src/main/javassist/CtMethod.java index 043c8d3b..abb42b88 100644 --- a/src/main/javassist/CtMethod.java +++ b/src/main/javassist/CtMethod.java @@ -118,7 +118,7 @@ public CtMethod(CtMethod src, CtClass declaring, ClassMap map) * * @param src the source text. * @param declaring the class to which the created method is added. - * @see CtNewMethod.make(String, CtClass) + * @see CtNewMethod#make(String, CtClass) */ public static CtMethod make(String src, CtClass declaring) throws CannotCompileException diff --git a/src/main/javassist/bytecode/Bytecode.java b/src/main/javassist/bytecode/Bytecode.java index a1f74c6d..b2a0ee23 100644 --- a/src/main/javassist/bytecode/Bytecode.java +++ b/src/main/javassist/bytecode/Bytecode.java @@ -1339,7 +1339,7 @@ public void addPutstatic(CtClass c, String name, String desc) { * Appends PUTSTATIC. * * @param classname the fully-qualified name of the target class. - * @param filedName the field name. + * @param fieldName the field name. * @param desc the descriptor of the field type. */ public void addPutstatic(String classname, String fieldName, String desc) { diff --git a/src/main/javassist/bytecode/Descriptor.java b/src/main/javassist/bytecode/Descriptor.java index ef194b7f..39577ce2 100644 --- a/src/main/javassist/bytecode/Descriptor.java +++ b/src/main/javassist/bytecode/Descriptor.java @@ -717,7 +717,6 @@ public boolean hasNext() { /** * Returns the first character of the current element. - * @return */ public char currentChar() { return desc.charAt(curPos); } diff --git a/src/main/javassist/bytecode/annotation/package.html b/src/main/javassist/bytecode/annotation/package.html index 6cf7e538..d0656db6 100644 --- a/src/main/javassist/bytecode/annotation/package.html +++ b/src/main/javassist/bytecode/annotation/package.html @@ -1,6 +1,6 @@ -Annotations API. +Bytecode-level Annotations API.

    This package provides low-level API for editing annotations attributes. diff --git a/src/main/javassist/expr/MethodCall.java b/src/main/javassist/expr/MethodCall.java index 7bc2c388..9fd29e2a 100644 --- a/src/main/javassist/expr/MethodCall.java +++ b/src/main/javassist/expr/MethodCall.java @@ -120,7 +120,7 @@ public CtMethod getMethod() throws NotFoundException { * The method signature is represented by a character string * called method descriptor, which is defined in the JVM specification. * - * @see javassist.CtBehavior.getSignature() + * @see javassist.CtBehavior#getSignature() * @see javassist.bytecode.Descriptor * @since 3.1 */ diff --git a/src/main/javassist/tools/package.html b/src/main/javassist/tools/package.html index 1566e121..bee6208d 100644 --- a/src/main/javassist/tools/package.html +++ b/src/main/javassist/tools/package.html @@ -1,6 +1,6 @@ -Utility classes. +Covenient tools. diff --git a/src/main/javassist/reflect/CannotCreateException.java b/src/main/javassist/tools/reflect/CannotCreateException.java similarity index 96% rename from src/main/javassist/reflect/CannotCreateException.java rename to src/main/javassist/tools/reflect/CannotCreateException.java index a0933830..efa14111 100644 --- a/src/main/javassist/reflect/CannotCreateException.java +++ b/src/main/javassist/tools/reflect/CannotCreateException.java @@ -13,7 +13,7 @@ * License. */ -package javassist.reflect; +package javassist.tools.reflect; /** * Signals that ClassMetaobject.newInstance() fails. diff --git a/src/main/javassist/reflect/CannotInvokeException.java b/src/main/javassist/tools/reflect/CannotInvokeException.java similarity index 88% rename from src/main/javassist/reflect/CannotInvokeException.java rename to src/main/javassist/tools/reflect/CannotInvokeException.java index c778e89d..d283d6d7 100644 --- a/src/main/javassist/reflect/CannotInvokeException.java +++ b/src/main/javassist/tools/reflect/CannotInvokeException.java @@ -13,7 +13,7 @@ * License. */ -package javassist.reflect; +package javassist.tools.reflect; import java.lang.reflect.InvocationTargetException; import java.lang.IllegalAccessException; @@ -22,9 +22,9 @@ * Thrown when method invocation using the reflection API has thrown * an exception. * - * @see javassist.reflect.Metaobject#trapMethodcall(int, Object[]) - * @see javassist.reflect.ClassMetaobject#trapMethodcall(int, Object[]) - * @see javassist.reflect.ClassMetaobject#invoke(Object, int, Object[]) + * @see javassist.tools.reflect.Metaobject#trapMethodcall(int, Object[]) + * @see javassist.tools.reflect.ClassMetaobject#trapMethodcall(int, Object[]) + * @see javassist.tools.reflect.ClassMetaobject#invoke(Object, int, Object[]) */ public class CannotInvokeException extends RuntimeException { diff --git a/src/main/javassist/reflect/CannotReflectException.java b/src/main/javassist/tools/reflect/CannotReflectException.java similarity index 90% rename from src/main/javassist/reflect/CannotReflectException.java rename to src/main/javassist/tools/reflect/CannotReflectException.java index 036ebf49..30c448b3 100644 --- a/src/main/javassist/reflect/CannotReflectException.java +++ b/src/main/javassist/tools/reflect/CannotReflectException.java @@ -13,7 +13,7 @@ * License. */ -package javassist.reflect; +package javassist.tools.reflect; import javassist.CannotCompileException; @@ -24,7 +24,7 @@ * either ClassMetaobject or Metaobject. * * @author Brett Randall - * @see javassist.reflect.Reflection#makeReflective(CtClass,CtClass,CtClass) + * @see javassist.tools.reflect.Reflection#makeReflective(CtClass,CtClass,CtClass) * @see javassist.CannotCompileException */ public class CannotReflectException extends CannotCompileException { diff --git a/src/main/javassist/reflect/ClassMetaobject.java b/src/main/javassist/tools/reflect/ClassMetaobject.java similarity index 99% rename from src/main/javassist/reflect/ClassMetaobject.java rename to src/main/javassist/tools/reflect/ClassMetaobject.java index 61328452..d0a645cc 100644 --- a/src/main/javassist/reflect/ClassMetaobject.java +++ b/src/main/javassist/tools/reflect/ClassMetaobject.java @@ -13,7 +13,7 @@ * License. */ -package javassist.reflect; +package javassist.tools.reflect; import java.lang.reflect.*; import java.util.Arrays; @@ -35,8 +35,8 @@ *

      ClassMetaobject cm = ((Metalevel)reflectiveObject)._getClass();
        * 
    * - * @see javassist.reflect.Metaobject - * @see javassist.reflect.Metalevel + * @see javassist.tools.reflect.Metaobject + * @see javassist.tools.reflect.Metalevel */ public class ClassMetaobject implements Serializable { /** diff --git a/src/main/javassist/reflect/Compiler.java b/src/main/javassist/tools/reflect/Compiler.java similarity index 92% rename from src/main/javassist/reflect/Compiler.java rename to src/main/javassist/tools/reflect/Compiler.java index 734f598b..7e1fb943 100644 --- a/src/main/javassist/reflect/Compiler.java +++ b/src/main/javassist/tools/reflect/Compiler.java @@ -13,7 +13,7 @@ * License. */ -package javassist.reflect; +package javassist.tools.reflect; import javassist.CtClass; import javassist.ClassPool; @@ -31,7 +31,7 @@ class CompiledClass { *

    This translator directly modifies class files on a local disk so that * the classes represented by those class files are reflective. * After the modification, the class files can be run with the standard JVM - * without javassist.reflect.Loader + * without javassist.tools.reflect.Loader * or any other user-defined class loader. * *

    The modified class files are given as the command-line parameters, @@ -63,9 +63,9 @@ class CompiledClass { *

    Note that if the super class is also made reflective, it must be done * before the sub class. * - * @see javassist.reflect.Metaobject - * @see javassist.reflect.ClassMetaobject - * @see javassist.reflect.Reflection + * @see javassist.tools.reflect.Metaobject + * @see javassist.tools.reflect.ClassMetaobject + * @see javassist.tools.reflect.Reflection */ public class Compiler { @@ -100,12 +100,12 @@ private static void processClasses(CompiledClass[] entries, int n) String metaobj, classobj; if (entries[i].metaobject == null) - metaobj = "javassist.reflect.Metaobject"; + metaobj = "javassist.tools.reflect.Metaobject"; else metaobj = entries[i].metaobject; if (entries[i].classobject == null) - classobj = "javassist.reflect.ClassMetaobject"; + classobj = "javassist.tools.reflect.ClassMetaobject"; else classobj = entries[i].classobject; @@ -156,7 +156,7 @@ else if (a.charAt(0) == '-') } private static void help(PrintStream out) { - out.println("Usage: java javassist.reflect.Compiler"); + out.println("Usage: java javassist.tools.reflect.Compiler"); out.println(" ( [-m ] [-c ])+"); } } diff --git a/src/main/javassist/reflect/Loader.java b/src/main/javassist/tools/reflect/Loader.java similarity index 82% rename from src/main/javassist/reflect/Loader.java rename to src/main/javassist/tools/reflect/Loader.java index 76dce4d6..36189edf 100644 --- a/src/main/javassist/reflect/Loader.java +++ b/src/main/javassist/tools/reflect/Loader.java @@ -13,7 +13,7 @@ * License. */ -package javassist.reflect; +package javassist.tools.reflect; import javassist.CannotCompileException; import javassist.NotFoundException; @@ -29,10 +29,10 @@ *