Bug 79665 - [1.5][annot] Field declarations inside annotation type declaration must be constant
Summary: [1.5][annot] Field declarations inside annotation type declaration must be co...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M4   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-29 10:46 EST by Olivier Thomann CLA
Modified: 2004-12-14 17:51 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 Olivier Thomann CLA 2004-11-29 10:46:26 EST
A field declaration is allowed inside an annotation type declaration iff it is a
constant field declaration (i.e. it has an initializer with a constant value).

@interface I {
     int[] tab;
}

error: needs an initializer:

@interface I {
     int[] tab = {1, 2};
}
compiles fine.
Comment 1 Philipe Mulet CLA 2004-11-29 12:19:24 EST
Note that javac accepts: int[] tab = {1, "aaa".length() }
Comment 2 Philipe Mulet CLA 2004-11-29 13:01:08 EST
Added support for checking annotation fields.
Added regression test: AnnotationTest#test039-043.
Fixed
Comment 3 Olivier Thomann CLA 2004-12-14 17:51:38 EST
Verified in 200412140800