Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 344824 - [1.7][compiler] Incorrect error range for unreachable catch block error in multi-catch
Summary: [1.7][compiler] Incorrect error range for unreachable catch block error in mu...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 minor (vote)
Target Milestone: 3.7.1   Edit
Assignee: Srikanth Sankaran CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-05 07:15 EDT by Ayushman Jain CLA
Modified: 2011-08-05 02:54 EDT (History)
2 users (show)

See Also:


Attachments
Patch under test (3.55 KB, patch)
2011-05-11 08:16 EDT, Srikanth Sankaran CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.