Bug 79665

Summary: [1.5][annot] Field declarations inside annotation type declaration must be constant
Product: [Eclipse Project] JDT Reporter: Olivier Thomann <Olivier_Thomann>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 3.1   
Target Milestone: 3.1 M4   
Hardware: PC   
OS: Windows XP   
Whiteboard:

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