<p>-version 3.19
<ul>
-<li>JIRA JASSIST-158, 205, 206, 207, 212, 216.
+<li>JIRA JASSIST-158, 205, 206, 207, 211, 212, 216.
</ul>
</p>
if (notDo)
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);
patchGoto(breakList, bytecode.currentPc());
cc.writeFile();
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());
+ }
}