aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2004-02-15 12:40:52 +0000
committerchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2004-02-15 12:40:52 +0000
commit7b2f9feef79052893b40168b2b9c6d413971346b (patch)
tree0c58ea6c6299740fbbe1aab47f7d1a00fa3d746b
parent100b440ac93f02f249a1e9492fcac5372ebe397a (diff)
downloadjavassist-7b2f9feef79052893b40168b2b9c6d413971346b.tar.gz
javassist-7b2f9feef79052893b40168b2b9c6d413971346b.zip
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
-rw-r--r--src/main/javassist/ByteArrayClassPath.java1
-rw-r--r--src/main/javassist/ClassPool.java1
-rw-r--r--src/main/javassist/CtBehavior.java4
-rw-r--r--src/main/javassist/CtClass.java4
-rw-r--r--src/main/javassist/package.html12
5 files changed, 19 insertions, 3 deletions
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.
+ *
+ * <p>The following command invokes this method:
+ *
+ * <ul><pre>java -jar javassist.jar</pre></ul>
*/
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 @@
<body>
The Javassist Core API.
-<p>Javassist (<i>Java</i> programming <i>assist</i>ant) is yet another
-reflective system for Java. It is a class library for editing
+<p>Javassist (<i>Java</i> programming <i>assist</i>ant) 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.
<p>The most significant class of this package is <code>CtClass</code>.
See the description of this class first.
+<p>To know the version number of this package, type the following command:
+
+<ul><pre>
+java -jar javassist.jar
+</pre></ul>
+
+<p>It prints the version number on the console.
+
</body>
</html>