Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 344824

Summary: [1.7][compiler] Incorrect error range for unreachable catch block error in multi-catch
Product: [Eclipse Project] JDT Reporter: Ayushman Jain <amj87.iitr>
Component: CoreAssignee: Srikanth Sankaran <srikanth_sankaran>
Status: VERIFIED FIXED QA Contact:
Severity: minor    
Priority: P3 CC: Olivier_Thomann, srikanth_sankaran
Version: 3.7   
Target Milestone: 3.7.1   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Patch under test none

Description Ayushman Jain CLA 2011-05-05 07:15:05 EDT
BETA_JAVA7

For the following code snippet, the error marker is at an inappropriate location:

package multiCatch;

public class PreciseRethrow {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		try {
			throw new DaughterOfFoo();
		} catch (Foo e) {
			try {
				throw e; // used to throw Foo, now throws DaughterOfFoo
			} catch (Foo f) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (RuntimeException | SonOfFoo f) {
				
			}
		}

	}
}

Note that the error "Unreachable catch block for SonOfFoo" is marked at RuntimeException, whereas it should either be marked for the entire catch expression or only at "SonOfFoo"
Comment 1 Srikanth Sankaran CLA 2011-05-11 06:17:16 EDT
As Satyam is away, I'll follow up.
Comment 2 Srikanth Sankaran CLA 2011-05-11 08:16:08 EDT
Created attachment 195335 [details]
Patch under test
Comment 3 Srikanth Sankaran CLA 2011-05-11 09:18:15 EDT
Released in BETA_JAVA7 branch.
Comment 4 Olivier Thomann CLA 2011-06-28 10:01:51 EDT
Verified.