Bug 36339

Summary: Try codegen issues slightly incorrect ANY exception handler
Product: [Eclipse Project] JDT Reporter: Philipe Mulet <philippe_mulet>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 2.1   
Target Milestone: 3.0 M1   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Philipe Mulet CLA 2003-04-10 06:44:13 EDT
Build R2.1

When generating subroutine invocations during return (inside try/finally) 
bytecode sequences, once JSR bytecode has returned, the trailing code until 
return/branch bytecode should not be inside the JSR-finally ANY exception 
handler, since any failure at this point would re-run the finally block through 
the exception handler.

Our current exception handling is ranging from try start to catch-end, and 
should better exclude portions of the bytecode:

e.g.
static int foo(boolean bool) {
  int j;
  try {
    if (bool) return 1;
    j = 2;
  } finally {
    j = 3;
  }
  return j;
}

0	iload_0
1	ifeq 9
4	jsr 20
7	iconst_1 // should be excluded from ANY exception handler range
8	ireturn  // should be excluded from ANY exception handler range
9	iconst_2
10	istore_1
11	goto 25
14	astore_3
15	jsr 20
18	aload_3
19	athrow
20	astore_2
21	iconst_3
22	istore_1
23	ret 2
25	jsr 20
28	iload_1
29	ireturn

Exception Table:
	[pc: 0, pc: 14] -> 14 when : any
Comment 1 Philipe Mulet CLA 2003-04-10 06:45:18 EDT
Also, the natural exit (25	jsr 20
), should be associated with an ANY exception handler as well.
Comment 2 Philipe Mulet CLA 2003-04-18 04:35:29 EDT
Fixed. Added sequence of any exception handlers (and SubRoutineStatement 
intermediate node).
Comment 3 David Audel CLA 2003-06-05 10:29:42 EDT
Verified.