[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [jdt-apt-dev] Should annotation with default values return null?

Yeah it's definitely a bug. I'm pretty sure it's caused by https://bugs.eclipse.org/bugs/show_bug.cgi?id=124388, which I'm working on now.
 
Tim
 
-----Original Message-----
From: jdt-apt-dev-bounces@xxxxxxxxxxx [mailto:jdt-apt-dev-bounces@xxxxxxxxxxx]On Behalf Of WGilster@xxxxxxxx
Sent: Wednesday, January 25, 2006 8:16 AM
To: jdt-apt-dev@xxxxxxxxxxx
Subject: [jdt-apt-dev] Should annotation with default values return null?


I think I've said this before, but GREAT TOOL GUYS!!

I submitted a bug recently also dealing with annotations on parameters, but I was a little unsure if this particular one is a problem or something I don't understand.  I'm getting some annotations from a parameter, and the value that is being returned from the isHidden() method of the annotation is null, yet the annotation has a default value.  In "My Little Program", I'm not specifying the value of isHidden(), but it is giving me a value of null, instead of Boolean.FALSE which is the default value.  If this is the desired functionality for parameters, this doesn't seem consistent because annotations on methods use the default values.  Is there something I'm missing?



Here is as best as I can describe the problem with code...
public enum Boolean {
        TRUE,
        FALSE,
        NULL
}


@Target({ElementType.Type, ElementType.METHOD, ElementType.PARAMETER})
public @interface FeatureDescription {
        public String displayName() default "";
        public String name() default "";
        public String shortDescription() default "";
        public Boolean isHidden() default Boolean.FALSE;
}




//My Little Program
public interface Manager extends Serializable {
        public void myMethod(
                @FeatureDescription(
                        displayName="NameOfParameter",
                        shortDescription="Stuff"
                )
                Class<? extends OtherClass> theClass) throws InstantiationException;
}        
       

Wes G.