From: chiba Date: Sat, 16 Oct 2004 16:59:27 +0000 (+0000) Subject: Expr.where() throws an exception if the expression is in a static initializer. X-Git-Tag: rel_3_17_1_ga~475 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d77cb45569d6b8080103a65418a3440524e17d65;p=javassist.git 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 --- diff --git a/Readme.html b/Readme.html index 5b85662f..8fd543d1 100644 --- a/Readme.html +++ b/Readme.html @@ -569,7 +569,7 @@ Andreas Salathe, Dante Torres estrada, S. Pam, Nuno Santos, Denis Taye, Colin Sampaleanu, Robert Bialek, Asato Shimotaki, Howard Lewis Ship, Richard Jones, Marjan Sterjev, Bruce McDonald, Mark Brennan, Vlad Skarzhevskyy, -Brett Randall, Tsuyoshi Murakami, and Nathan Meyers +Brett Randall, Tsuyoshi Murakami, Nathan Meyers, and Yoshiyuki Usui for their contributions.


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"); }