Community
Participate
Working Groups
Eclipse build 200411230838 Annotation defined as: =========== @Documented @Rentention(RententionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface MyAnn { String value() default "Default Message" } =========== A method in some other class: ============ public @MyAnn void something() { } ============ Compiler complains "The annotation @MyAnn must define the attribute value" changing "@MyAnn" to "@MyAnn()" shows same error. changing it to "@MyAnn(4)" correctly displays a type mismatch error. changing it to "@MyAnn(null)" displays an error saying that value must be a constant expression.
Works in latest, added regression test: AnnotationTest#test049. Fixed. Complete test case would actually be: [import java.lang.annotation.*; @Documented @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) @interface MyAnn { String value() default "Default Message"; } public class X { public @MyAnn void something() { } }]
Verified in 200412140800