Browse Source

fixed JASSIST-211

tags/rel_3_19_0_ga
chibash 10 years ago
parent
commit
c135f69c8b
3 changed files with 20 additions and 2 deletions
  1. 1
    1
      Readme.html
  2. 1
    1
      src/main/javassist/compiler/CodeGen.java
  3. 18
    0
      src/test/javassist/JvstTest4.java

+ 1
- 1
Readme.html View File



<p>-version 3.19 <p>-version 3.19
<ul> <ul>
<li>JIRA JASSIST-158, 205, 206, 207, 212, 216.
<li>JIRA JASSIST-158, 205, 206, 207, 211, 212, 216.
</ul> </ul>
</p> </p>



+ 1
- 1
src/main/javassist/compiler/CodeGen.java View File

if (notDo) if (notDo)
bytecode.write16bit(pc, pc3 - pc + 1); bytecode.write16bit(pc, pc3 - pc + 1);


boolean alwaysBranch = compileBooleanExpr(true, expr);
boolean alwaysBranch = compileBooleanExpr(true, expr) && breakList.size() == 0;
bytecode.addIndex(pc2 - bytecode.currentPc() + 1); bytecode.addIndex(pc2 - bytecode.currentPc() + 1);


patchGoto(breakList, bytecode.currentPc()); patchGoto(breakList, bytecode.currentPc());

+ 18
- 0
src/test/javassist/JvstTest4.java View File

cc.writeFile(); cc.writeFile();
Object obj = make(cc.getName()); Object obj = make(cc.getName());
} }

public void testWhileTrueKO() throws Exception {
final ClassPool pool = ClassPool.getDefault();
final CtClass cc = pool.makeClass("test4.TestWhileTrueKO");
String source = "public void testWhile() { while(true) { break; } }";
cc.addMethod(CtMethod.make(source, cc));
cc.writeFile();
make(cc.getName());
}

public void testWhileTrueOK() throws Exception {
final ClassPool pool = ClassPool.getDefault();
final CtClass cc = pool.makeClass("test4.TestWhileTrueOK");
String source = "public void testWhile() { while(0==0) { break; }}";
cc.addMethod(CtMethod.make(source, cc));
cc.writeFile();
make(cc.getName());
}
} }

Loading…
Cancel
Save