Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[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.

Back to the top