Early Draft Review of JSR-308, Annotations on Java Types is available For Review

20Nov07

JSR 308 proposes an extension to Java’s annotation system that permits annotations to appear on any use of a type. (By contrast, Java SE 6 permits annotations to appear only on class/method/field/variable declarations; JSR 308 is backward-compatible and continues to permit those annotations.) Such a generalization removes arbitrary limitations of Java’s annotation system, and it enables new uses of annotations. This proposal also notes a few other possible extensions to annotations

Example

@NonNullDefault
class DAG {
Set<Edge> edges;
List<Vertex> getNeighbors(@Interned @Readonly Vertex v) @Readonly {
List<Vertex> neighbors = new LinkedList<Vertex>();
for (Edge e : edges)
if (e.from() == v)
neighbors.add(e.to());
return neighbors;
}
}

Find out more about JSR 308 here

Advertisements


One Response to “Early Draft Review of JSR-308, Annotations on Java Types is available For Review”

  1. thank you, brother


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: