From: chiba Date: Sun, 15 Feb 2004 12:40:52 +0000 (+0000) Subject: If a newly created method does not have a throws clause, an empty X-Git-Tag: rel_3_17_1_ga~542 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7b2f9feef79052893b40168b2b9c6d413971346b;p=javassist.git If a newly created method does not have a throws clause, an empty Exceptions attribute had been added. This problem has been fixed. git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@69 30ef5769-5b8d-40dd-aea6-55b5d6557bb3 --- diff --git a/src/main/javassist/ByteArrayClassPath.java b/src/main/javassist/ByteArrayClassPath.java index d001ce87..5e30249d 100644 --- a/src/main/javassist/ByteArrayClassPath.java +++ b/src/main/javassist/ByteArrayClassPath.java @@ -43,6 +43,7 @@ import java.net.MalformedURLException; * @see javassist.ClassPath * @see ClassPool#insertClassPath(ClassPath) * @see ClassPool#appendClassPath(ClassPath) + * @see ClassPool#makeClass(InputStream) */ public class ByteArrayClassPath implements ClassPath { protected String classname; diff --git a/src/main/javassist/ClassPool.java b/src/main/javassist/ClassPool.java index 68796a40..4e00b335 100644 --- a/src/main/javassist/ClassPool.java +++ b/src/main/javassist/ClassPool.java @@ -662,6 +662,7 @@ public class ClassPool { * @param classfile class file. * @exception RuntimeException if there is a frozen class with the * the same name. + * @see javassist.ByteArrayClassPath */ public CtClass makeClass(InputStream classfile) throws IOException, RuntimeException diff --git a/src/main/javassist/CtBehavior.java b/src/main/javassist/CtBehavior.java index ea256482..01f907cf 100644 --- a/src/main/javassist/CtBehavior.java +++ b/src/main/javassist/CtBehavior.java @@ -109,6 +109,8 @@ public abstract class CtBehavior extends CtMember { /** * Obtains exceptions that this method/constructor may throw. + * + * @return a zero-length array if there is no throws clause. */ public CtClass[] getExceptionTypes() throws NotFoundException { String[] exceptions; @@ -126,7 +128,7 @@ public abstract class CtBehavior extends CtMember { */ public void setExceptionTypes(CtClass[] types) throws NotFoundException { declaringClass.checkModify(); - if (types == null) { + if (types == null || types.length == 0) { methodInfo.removeExceptionsAttribute(); return; } diff --git a/src/main/javassist/CtClass.java b/src/main/javassist/CtClass.java index 268c40f1..4c6f7bd7 100644 --- a/src/main/javassist/CtClass.java +++ b/src/main/javassist/CtClass.java @@ -40,6 +40,10 @@ public abstract class CtClass { /** * Prints the version number and the copyright notice. + * + *

The following command invokes this method: + * + *

*/ public static void main(String[] args) { System.out.println("Javassist version " + CtClass.version); diff --git a/src/main/javassist/package.html b/src/main/javassist/package.html index 1b6e4b94..f5b66b98 100644 --- a/src/main/javassist/package.html +++ b/src/main/javassist/package.html @@ -2,13 +2,21 @@ The Javassist Core API. -

Javassist (Java programming assistant) is yet another -reflective system for Java. It is a class library for editing +

Javassist (Java programming assistant) makes bytecode +engineering simple. It is a class library for editing bytecode in Java; it enables Java programs to define a new class at runtime and to modify a given class file when the JVM loads it.

The most significant class of this package is CtClass. See the description of this class first. +

To know the version number of this package, type the following command: + +

+ +

It prints the version number on the console. +