aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/javassist
diff options
context:
space:
mode:
authorchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2003-05-18 15:34:30 +0000
committerchiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2003-05-18 15:34:30 +0000
commit0ed1ede707440a9a981c2e0cfd5421b0ba0e364d (patch)
treea4bc692f36e0ad999d9a92434311cff59e445caf /src/main/javassist
parent088718bd207fd72ef411870a36ff0c09eaa153dc (diff)
downloadjavassist-0ed1ede707440a9a981c2e0cfd5421b0ba0e364d.tar.gz
javassist-0ed1ede707440a9a981c2e0cfd5421b0ba0e364d.zip
fixed a bug in CtBehavior#setBody().
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@19 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
Diffstat (limited to 'src/main/javassist')
-rw-r--r--src/main/javassist/compiler/CodeGen.java24
-rw-r--r--src/main/javassist/compiler/Javac.java2
2 files changed, 14 insertions, 12 deletions
diff --git a/src/main/javassist/compiler/CodeGen.java b/src/main/javassist/compiler/CodeGen.java
index e0b2dfa4..35ca2605 100644
--- a/src/main/javassist/compiler/CodeGen.java
+++ b/src/main/javassist/compiler/CodeGen.java
@@ -267,18 +267,18 @@ public abstract class CodeGen extends Visitor implements Opcode, TokenId {
}
}
- private boolean needsSuperCall(Stmnt body) {
- if (body.getOperator() == BLOCK) {
- Stmnt first = (Stmnt)body.head();
- if (first != null && first.getOperator() == EXPR) {
- ASTree expr = first.head();
- if (expr != null && expr instanceof Expr
- && ((Expr)expr).getOperator() == CALL) {
- ASTree target = ((Expr)expr).head();
- if (target instanceof Keyword) {
- int token = ((Keyword)target).get();
- return token != THIS && token != SUPER;
- }
+ private boolean needsSuperCall(Stmnt body) throws CompileError {
+ if (body.getOperator() == BLOCK)
+ body = (Stmnt)body.head();
+
+ if (body != null && body.getOperator() == EXPR) {
+ ASTree expr = body.head();
+ if (expr != null && expr instanceof Expr
+ && ((Expr)expr).getOperator() == CALL) {
+ ASTree target = ((Expr)expr).head();
+ if (target instanceof Keyword) {
+ int token = ((Keyword)target).get();
+ return token != THIS && token != SUPER;
}
}
}
diff --git a/src/main/javassist/compiler/Javac.java b/src/main/javassist/compiler/Javac.java
index 9ff801ef..de322cdf 100644
--- a/src/main/javassist/compiler/Javac.java
+++ b/src/main/javassist/compiler/Javac.java
@@ -170,6 +170,8 @@ public class Javac {
/**
* Compiles a method (or constructor) body.
+ *
+ * @src a single statement or a block.
*/
public Bytecode compileBody(CtBehavior method, String src)
throws CompileError