[JSR308] JSR draft and comments

Rémi Forax forax at univ-mlv.fr
Thu Feb 1 04:58:07 EST 2007


Hi everybody, hi michael,

I have some remarks on the current draft.

First, one general question, is annotation on types are allowed
everywhere annotations are currently allowed ?

In section 2, in your example, i don't clearly understand the @Interned 
annotation.
In "e.from() == v", is the return type of method from must be tagged
with @Interned ?

In section 3, the syntax for object creation doesn't say if
type annotations are before or after type parameters:
new @NonNull <String> Test();
or
new <String>@NonNull Test();

in section 3.1, bullet about annotations on type parameter bounds,
there is a mistake, type parameter can't have super bounds.
(see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5052956)

Another question, is annotation types allowed for wildcards ?
List<? extends @Existing File> and
List<? super @Existing File>

Else, a humble proposal to solve array-valued annotations (section 6)
i propose to add a meta annotation (here @MoreThanOnce but i think
we can find a better name) to say that
 -a Resource can appear more that once
 - if it is the case, the compiler will generate the enclosing @Resources
   automatically.

@MoreThanOnce(Resources.class)
@interface Ressource {
   ...
}

The advantages to specify an enclosing annotation is that you don't need
to change the reflection API to handle inlined array-valued annotation.

This meta-annotation will be defined like that :
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.ANNOTATION_TYPE)
public @interface MoreThanOnce {
  Class<? extends Annotation> value();
}

cheers,
Rémi



More information about the JSR308 mailing list