Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 339837 - [1.7][compiler] Multicatch syntax not rejected at 1.6-
Summary: [1.7][compiler] Multicatch syntax not rejected at 1.6-
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.7.1   Edit
Assignee: Satyam Kandula CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-14 00:34 EDT by Srikanth Sankaran CLA
Modified: 2011-08-05 02:54 EDT (History)
2 users (show)

See Also:


Attachments
Proposed fix (3.57 KB, patch)
2011-03-14 10:12 EDT, Olivier Thomann CLA
no flags Details | Diff
Patch (3.56 KB, patch)
2011-03-15 09:54 EDT, Satyam Kandula CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Srikanth Sankaran CLA 2011-03-14 00:34:52 EDT
BETA_JAVA7 branch as of 14 March 2011.

The eclipse compiler fails to reject the new multi catch syntax
on a 1.6 (or below) compliant project.

The following should be rejected, but it is not:

public class X {
	public static void main(String [] args) {
		try  {
		} catch (NullPointerException | IllegalArgumentException e) {
			
		} 
	}
}
Comment 1 Olivier Thomann CLA 2011-03-14 10:12:51 EDT
Created attachment 191118 [details]
Proposed fix

Working on 339864, I fixed this issue to see if this would fix the other one.
Regression tests need to be added.
Comment 2 Satyam Kandula CLA 2011-03-14 11:27:25 EDT
Shouldn't the message be something like "Multi-catch parameters not allowed for source level below 1.7". Using "Multi-catch" instead of Disjunctive could be better for the users. 

Otherwise, the patch looks good to me. I will add the test for this.
Comment 3 Olivier Thomann CLA 2011-03-14 11:43:00 EDT
(In reply to comment #2)
> Shouldn't the message be something like "Multi-catch parameters not allowed for
> source level below 1.7". Using "Multi-catch" instead of Disjunctive could be
> better for the users. 
Sure. Please also update the method name inside ProblemReporter to reflect this change.
Comment 4 Satyam Kandula CLA 2011-03-15 09:54:12 EDT
Created attachment 191213 [details]
Patch

Patch updated with the error message as "Multi-catch" instead of Disjunctive type. 
Doesn't have the test yet.
Comment 5 Satyam Kandula CLA 2011-03-15 10:00:37 EDT
Released in BETA_JAVA7 branch. 
Will add the test as part of bug 340022.
Comment 6 Ayushman Jain CLA 2011-06-29 07:07:42 EDT
Verified using Eclipse Java 7 Support(Beta) feature patch v20110623-0900.