diff options
author | chiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2004-10-16 16:59:27 +0000 |
---|---|---|
committer | chiba <chiba@30ef5769-5b8d-40dd-aea6-55b5d6557bb3> | 2004-10-16 16:59:27 +0000 |
commit | d77cb45569d6b8080103a65418a3440524e17d65 (patch) | |
tree | 37d8c8234165833905a226d3cc280eb974a57d7e /src/main/javassist/expr | |
parent | 8256ce571f48777d61742849a6e317189fde52d8 (diff) | |
download | javassist-d77cb45569d6b8080103a65418a3440524e17d65.tar.gz javassist-d77cb45569d6b8080103a65418a3440524e17d65.zip |
Expr.where() throws an exception if the expression is in a static initializer.
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@141 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
Diffstat (limited to 'src/main/javassist/expr')
-rw-r--r-- | src/main/javassist/expr/Expr.java | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/main/javassist/expr/Expr.java b/src/main/javassist/expr/Expr.java index 882f8cb4..50d25d52 100644 --- a/src/main/javassist/expr/Expr.java +++ b/src/main/javassist/expr/Expr.java @@ -69,9 +69,13 @@ public abstract class Expr implements Opcode { MethodInfo mi = thisMethod; CtBehavior[] cb = thisClass.getDeclaredBehaviors(); for (int i = cb.length - 1; i >= 0; --i) - if (cb[i].getMethodInfo() == mi) + if (cb[i].getMethodInfo2() == mi) return cb[i]; + CtConstructor init = thisClass.getClassInitializer(); + if (init.getMethodInfo2() == mi) + return init; + throw new RuntimeException("fatal: not found"); } |