Bug 138443 - compiler - annotations with arrays allow comma after last element
Summary: compiler - annotations with arrays allow comma after last element
Status: CLOSED DUPLICATE of bug 112433
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 153213 169963 195551 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-04-25 13:39 EDT by Darryl Smith CLA
Modified: 2011-05-19 13:11 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Darryl Smith CLA 2006-04-25 13:39:31 EDT
@Embedded
@AttributeOverrides({
    @AttributeOverride( name="city", column=@Column( name="DIAB99C_TXCTY" )),
    @AttributeOverride( name="state", column=@Column( name="DIAB99C_TXSTAT" )),
    @AttributeOverride( name="zipCode", column=@Column( name="DIAB99C_TXZIP" )),
})

compiles fine with eclipse 3.2RC1a jdt compiler.

But when using the sun jdk compiler you get
[javac] C:\..Something.java:73: illegal start of expression
[javac] })
[javac] ^
[javac] 2 errors

It would seem the JDT compiler is incorrect. And the last element in the @AttributeOverride array should not be followed by a comma
Comment 1 Olivier Thomann CLA 2006-04-25 14:34:45 EDT
I'll investigate.
Comment 2 Olivier Thomann CLA 2006-04-25 14:59:52 EDT
This looks like a bug with javac.
From http://java.sun.com/docs/books/jls/third_edition/html/interfaces.html#9.7, the rule from the grammar is:
ElementValueArrayInitializer:
        { ElementValuesopt ,opt }

This means that:
{ ,}
{ c , }
{ c }
{ }

are all valid ElementValueArrayInitializer elements.
They had the same bug for array initializers.
see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4396418.

You should report the bug against Sun compiler.
Closing as INVALID.
Added regression test org.eclipse.jdt.core.tests.compiler.regression.AnnotationTest.test199
Comment 3 Olivier Thomann CLA 2006-08-15 13:25:52 EDT
*** Bug 153213 has been marked as a duplicate of this bug. ***
Comment 4 Olivier Thomann CLA 2007-01-09 11:32:13 EST
*** Bug 169963 has been marked as a duplicate of this bug. ***
Comment 5 Olivier Thomann CLA 2007-07-05 12:56:57 EDT
*** Bug 195551 has been marked as a duplicate of this bug. ***
Comment 6 Olivier Thomann CLA 2011-05-19 13:11:46 EDT
Closing as dup.

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