Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 339837

Summary: [1.7][compiler] Multicatch syntax not rejected at 1.6-
Product: [Eclipse Project] JDT Reporter: Srikanth Sankaran <srikanth_sankaran>
Component: CoreAssignee: Satyam Kandula <satyam.kandula>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: amj87.iitr, Olivier_Thomann
Version: 3.7   
Target Milestone: 3.7.1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Proposed fix
none
Patch none

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.