digitalmars.D - Java adds concurrency annotations
- Paul D. Anderson (5/5) Sep 11 2008 The folks at Sun are adding standard annotations to Java 7 for security,...
- Walter Bright (4/19) Sep 11 2008 My reading of the article suggests that it is a compile time only thing....
- Benji Smith (11/14) Sep 11 2008 It's not strictly compile-time. The annotations are retained as metadata...
The folks at Sun are adding standard annotations to Java 7 for security, concurrency, precondiitons and nullability, among others: http://today.java.net/pub/a/today/2008/09/11/jsr-305-annotations.html I wonder how these will play out in the real world. I'm especially interested in the Immutable annotation since Java's pass-by-reference implementation makes immutability very difficult to implement. Thanks again, Walter, for the transitive const paradigm. (Although I still contend that you got the keyword wrong: it should be "immutable" -- just like Java!!) Paul
Sep 11 2008
Paul D. Anderson wrote:The folks at Sun are adding standard annotations to Java 7 for security, concurrency, precondiitons and nullability, among others: http://today.java.net/pub/a/today/2008/09/11/jsr-305-annotations.html I wonder how these will play out in the real world. I'm especially interested in the Immutable annotation since Java's pass-by-reference implementation makes immutability very difficult to implement.My reading of the article suggests that it is a compile time only thing. There's no mention of transitivity, but the description implies it isn't transitive.Thanks again, Walter, for the transitive const paradigm. (Although I still contend that you got the keyword wrong: it should be "immutable" -- just like Java!!) Paul
Sep 11 2008
Walter Bright wrote:My reading of the article suggests that it is a compile time only thing. There's no mention of transitivity, but the description implies it isn't transitive.It's not strictly compile-time. The annotations are retained as metadata in the bytecode, so they could be used at runtime, but the main point of retention is for static analysis of bytecodes. The Immutable annotation is definitely not transitive. Off the top fo my head, the idea of transitive const seems to rely on "ownership" of data. And since java deliberately eschews the idea of data ownership, I doubt if it would be possible to implement transitive const. Also, the Immutble annotation only applies to data, and there doesn't seem to be any annotation for ThisMethodDoesntModifyItsArgs. --benji
Sep 11 2008