<ul> | <ul> | ||||
<li>The source code repository has been moved to <a href="https://github.com/jboss-javassist/javassist">GitHub</a></li>. | <li>The source code repository has been moved to <a href="https://github.com/jboss-javassist/javassist">GitHub</a></li>. | ||||
<li>JIRA JASSIST-181, 183, 184, 189, 162, 185, 186, 190. | |||||
<li>JIRA JASSIST-181, 183, 184, 189, 162, 185, 186, 190, 199. | |||||
</ul> | </ul> | ||||
<p>-version 3.17.1 on December 3, 2012 | <p>-version 3.17.1 on December 3, 2012 |
throws BadBytecode | throws BadBytecode | ||||
{ | { | ||||
make(code, blocks[0]); | make(code, blocks[0]); | ||||
findDeadCatchers(code, blocks); | |||||
try { | try { | ||||
fixTypes(code, blocks); | fixTypes(code, blocks); | ||||
} catch (NotFoundException e) { | } catch (NotFoundException e) { | ||||
destTypes[i] = srcTypes[i]; | destTypes[i] = srcTypes[i]; | ||||
} | } | ||||
// Phase 1.5 | |||||
/* | |||||
* Javac may generate an exception handler that catches only an exception | |||||
* thrown within the handler itself. It is dead code. | |||||
*/ | |||||
private void findDeadCatchers(byte[] code, TypedBlock[] blocks) throws BadBytecode { | |||||
int len = blocks.length; | |||||
for (int i = 0; i < len; i++) { | |||||
TypedBlock block = blocks[i]; | |||||
if (block.localsTypes == null) { // if block is dead code | |||||
BasicBlock.Catch handler = block.toCatch; | |||||
while (handler != null) | |||||
if (handler.body == block) { | |||||
BasicBlock.Catch handler2 | |||||
= new BasicBlock.Catch(block, handler.typeIndex, null); | |||||
traceException(code, handler2); | |||||
break; | |||||
} | |||||
else | |||||
handler = handler.next; | |||||
} | |||||
} | |||||
} | |||||
// Phase 2 | // Phase 2 | ||||
/* | /* |
String s2 = field2.getAnnotation(test4.JIRA181.Condition2.class).toString(); | String s2 = field2.getAnnotation(test4.JIRA181.Condition2.class).toString(); | ||||
assertEquals("@test4.JIRA181$Condition2(condition=test4.JIRA181<T>.B[].class)", s2); | assertEquals("@test4.JIRA181$Condition2(condition=test4.JIRA181<T>.B[].class)", s2); | ||||
} | } | ||||
} | |||||
public void testJIRA195() throws Exception { | |||||
CtClass cc = sloader.get("test4.JIRA195"); | |||||
CtMethod mth = cc.getDeclaredMethod("test"); | |||||
mth.getMethodInfo().rebuildStackMap(cc.getClassPool()); | |||||
cc.writeFile(); | |||||
Object obj = make(cc.getName()); | |||||
assertEquals(4, invoke(obj, "run")); | |||||
} | |||||
} |