| Summary: | [1.7][compiler] Inconsistent source pinpointing in multi-catch blocks | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Srikanth Sankaran <srikanth_sankaran> | ||||
| Component: | Core | Assignee: | Satyam Kandula <satyam.kandula> | ||||
| Status: | VERIFIED FIXED | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | amj87.iitr | ||||
| Version: | 3.7 | ||||||
| Target Milestone: | 3.7.1 | ||||||
| Hardware: | PC | ||||||
| OS: | Windows XP | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
Created attachment 191721 [details]
Proposed patch
Made changes as to pinpoint the error like the preferred behavior.
Released in BETA_JAVA7 branch Verified using Eclipse Java 7 Support(Beta) feature patch v20110623-0900. |
The following program shows two nearly identical error messages, but see that the source range highlighted is inconsistent. // --------------- 8<---------------------- import java.io.*; public class X { public static void main(String[] args) { try { System.out.println(); Reader r = new FileReader(args[0]); r.read(); } catch(RuntimeException | Exception e) { e.printStackTrace(); } catch(FileNotFoundException | IOException e) { e.printStackTrace(); } } } class Y { public static void main(String[] args) { try { throw new DaughterOfFoo(); } catch(SonOfFoo | DaughterOfFoo e) { e.printStackTrace(); } } } class Foo extends Exception {} class SonOfFoo extends Foo {} class DaughterOfFoo extends Foo {} // -----------------------------8<---------------------- Junits already exist :) org.eclipse.jdt.core.tests.compiler.regression.TryStatement17Test.test010() shows the preferred behavior while org.eclipse.jdt.core.tests.compiler.regression.TryStatement17Test.test003() shows the less desirable behavior.