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

Bug 315491

Summary: @SuiteClasses annotation parser accepts final comma but should not
Product: [Eclipse Project] JDT Reporter: Missing name <avantnoisebot>
Component: APTAssignee: Generic inbox for the JDT-APT component <jdt-apt-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: enhancement    
Priority: P3 CC: eclipse
Version: 3.6   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X   
Whiteboard:

Description Missing name CLA 2010-06-02 16:29:28 EDT
The parsing of @SuiteClasses does not behave properly when the last entry ends with a comma:

@SuiteClasses({
    foo.class,
    bar.class,
    bazz.class,
})

The Eclipse compiler does not flag an error here, but should.  Unlike array initializers, the final comma is not legal in this context, or at least is not considered legal by the Sun and Apple compilers.


-- Configuration Details --
Product: Eclipse 1.3.0.20100526-1935 (org.eclipse.epp.package.java.product)
Installed Features:
 org.eclipse.jdt 3.6.0.v20100520-0800-7z8XFUJFMTfCW8oRvdJkums9H155
Comment 1 Walter Harley CLA 2010-06-02 16:48:28 EDT
The error is in the Sun compiler, not Eclipse, and there is an existing bug in Sun's bug database for this (http://bugs.sun.com/view_bug.do?bug_id=6337964) which looks like it may recently have been fixed.  The Java Language Spec (section 9.7) clearly accepts a final comma.

*** This bug has been marked as a duplicate of bug 112433 ***