| Summary: | [1.7][compiler] Weird error message in rethrow site | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| 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: | Olivier_Thomann, satyam.kandula, stephan.herrmann | ||||||||
| Version: | 3.7 | Flags: | srikanth_sankaran:
review+
|
||||||||
| Target Milestone: | 3.7.1 | ||||||||||
| Hardware: | PC | ||||||||||
| OS: | Windows XP | ||||||||||
| Whiteboard: | |||||||||||
| Attachments: |
|
||||||||||
|
Description
Srikanth Sankaran
Created attachment 195499 [details]
Patch under consideration
Srikanth, I knew exactly what is happening and hence fixed this up. Please review.
Even with precise exception analysis, JDK7 does not flag the first
catch block as unreachable.
public class X {
void foo() {
try {
goo();
} catch(SubTypeOfSpecialException e) {
} catch (SpecialException e) {
}
}
void goo() throws SpecialException {
}
}
class SpecialException extends Exception {}
class SubTypeOfSpecialException extends SpecialException {}
Eclipse conforms at the moment.
(In reply to comment #2) > Even with precise exception analysis, JDK7 does not flag the first > catch block as unreachable. Satyam pointed out my muddled thinking, this block can of course be reached based on what actually gets thrown. So comment#2 should be ignored. Created attachment 195578 [details]
Patch under consideration
Srikanth has pointed out that the earlier patch haven't considered InitializationFlowContext. The earlier patch though will not cause problems, but it is not clean. In this patch, I am passing a new parameter which will tell the exception that the particular catch block will process.
Srikanth, please review.
Satyam, I believe the last test (test027) should be a conform test and not a negative test. (In reply to comment #5) > Satyam, > > I believe the last test (test027) should be a conform test and not a negative > test. Yes, I will change it accordingly. Thanks. Patch looks good. Please release after (a) making the change suggested in comment# 4. (b) I think it is better to short circuit the call to org.eclipse.jdt.internal.compiler.lookup.CatchParameterBinding.setPreciseType(TypeBinding) if caughtException is null. Created attachment 195717 [details]
Proposed patch
Patch with Olivier's and Srikanth's comments.
Released in BETA_JAVA7 branch Verified using patch feature 1.0.0-20110623-0900 |