<li>javassist.expr.Expr.indexOfBytecode() has been added.
<li>javassist.Loader has been modified so that getPackage() returns
a package object.
+ <li>Now, the compiler can correctly compile a try statement.
</ul>
<p>- version 2.5.1 in May, 2003.
Fabian Crabus, Bo Norregaard Jorgensen, Bob Lee, Bill Burke,
Remy Sanlaville, Muga Nishizawa, Alexey Loubyansky, Saori Oki,
Andreas Salathe, Dante Torres estrada, S. Pam, Nuno Santos,
-Denis Taye, Colin Sampaleanu, Robert Bialek, and Asato Shimotaki
-for their contributions.
+Denis Taye, Colin Sampaleanu, Robert Bialek, Asato Shimotaki,
+and Howard Lewis Ship for their contributions.
<p><br>
/**
* Returns a <code>java.lang.Class</code> object that has been loaded
- * by <code>writeAsClass()</code>. Note that such an object cannot be
+ * by <code>writeAsClass()</code>. That object cannot be
* obtained by <code>java.lang.Class.forName()</code> because it has
- * been loaded by an internal class loader.
+ * been loaded by an internal class loader of Javassist.
*
* @see #writeAsClass(String)
* @see javassist.CtClass#toClass()
int start = bytecode.currentPc();
body.accept(this);
int end = bytecode.currentPc();
+ if (start == end)
+ throw new CompileError("empty try block");
bytecode.addOpcode(Opcode.GOTO);
int pc = bytecode.currentPc();
decl.setClassName(javaToJvmName(type.getName()));
bytecode.addExceptionHandler(start, end, bytecode.currentPc(),
type);
- if (block != null) {
- bytecode.addAstore(var);
+ bytecode.growStack(1);
+ bytecode.addAstore(var);
+ if (block != null)
block.accept(this);
- }
bytecode.addOpcode(Opcode.GOTO);
bytecode.addIndex(pc - bytecode.currentPc());