Bug 22139 - Array initializer used inline causes syntax error
Summary: Array initializer used inline causes syntax error
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P3 minor (vote)
Target Milestone: 2.1 M4   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-08-02 20:13 EDT by Robin Rosenberg CLA
Modified: 2002-12-18 05:36 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robin Rosenberg CLA 2002-08-02 20:13:07 EDT
When an initialized array is used directly Eclipse is incompatible with JDK     
1.3/1.4. Both lines compile without warning with Sun's compiler.    
   
The workaround is simple, just add parentheses.    
    
class as {    
 {     
    int x=new int[] { 1,3,4 }[0]; // Syntax error on token "[", ";" expected    
    int y=(new int[] { 1,3,4 })[0]; //     
 }    
}    
    
My platform is Eclipse GTK, build 200206271827, Linux Mandrake 8.2 i586.
Comment 1 Olivier Thomann CLA 2002-12-11 17:25:44 EST
This was fixed with the latest changes in the parser.
I checked that this code compiles fine using the integration build 1210.
Comment 2 David Audel CLA 2002-12-18 05:36:58 EST
Verified.