Bug 348186

Summary: [compiler] Improve wording for the warning for masked/hidden catch block
Product: [Eclipse Project] JDT Reporter: Ayushman Jain <amj87.iitr>
Component: CoreAssignee: Ayushman Jain <amj87.iitr>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: deepakazad, satyam.kandula, srikanth_sankaran
Version: 3.7Flags: srikanth_sankaran: review+
Target Milestone: 3.8 M3   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
proposed fix none

Description Ayushman Jain CLA 2011-06-03 05:31:50 EDT
BETA_JAVA7

void foo() {
		try {
			throw new FileNotFoundException();

		} catch (FileNotFoundException ex) {

		} catch (IOException ex) {   // see warning here

		}
	}

In the above case, the warning says "Unreachable catch block for IOException. Only more specific exceptions are thrown and handled by previous catch block(s)."

This kind of implies that the exceptions are being thrown AND handled by prev. catch blocks. But should actually be

"Unreachable catch block for IOException. Only more specific exceptions are thrown and they are handled by previous catch block(s).
Comment 1 Ayushman Jain CLA 2011-06-03 05:45:39 EDT
Sorry this is not a precise rethrow problem. My bad. Changing bug description. Targetting 3.8. This will be fixed on HEAD.
Comment 2 Ayushman Jain CLA 2011-09-29 04:25:52 EDT
Created attachment 204265 [details]
proposed fix

Fixed message and updated tests
Comment 3 Ayushman Jain CLA 2011-09-29 04:27:21 EDT
Fixed in HEAD with commit 283ea669e65ae7c25e43949f506630d59e6cdb74
Comment 4 Ayushman Jain CLA 2011-09-29 05:40:46 EDT
Oops, forgot to get this reviewed. Srikanth, let me know if the new diagnostic message "Unreachable catch block for IOException. Only more specific exceptions are thrown and they are handled by previous catch block(s)." is ok.
Comment 5 Srikanth Sankaran CLA 2011-09-30 00:51:38 EDT
Agree with the change.
Comment 6 Srikanth Sankaran CLA 2011-10-24 02:20:11 EDT
Verified for 3.8 M3 using build id: N20111022-2000.

(Can we have full test cases in comment#0 please ?)