Question

See my blog post for excerpt from Java Posse #386 - Newscast for May 31st 2012 that expands this topic.

Does JSR 308 promotes design-by-contract to Java? It is step further from assertions? When it will be part of JDK?

When it is scheduled to be released as part of JDK?

See also Do you use assertions?

Was it helpful?

Solution

JSR 308 is not related to contracts. Instead, it extends the Java type system so that you can modify basic types depending on their usage context. The Checker Framework gives a few great examples of what can be done with type annotations. I'm sure you can somehow subvert this to turn it into contracts, but you'd still have to add a custom processor that compiles annotations into code rather than just passing them through a type checker.

And currently the plan is to include in the Java 8. But that can still change.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top