Create a Java agent to enforce method level validation (design by contract)

Description

Google released Contract for Java - http://code.google.com/p/cofoja/ - which is a Java implementations for Design by Contract. Googles version uses a set of annotations, an annotation processor and a runtime java agent (see their documentation).

We have all the pieces for doing this as well.

  • We have the constraint annotations

  • We have an annotation processor (obviously it does something else now, but we know how to write one)

  • And we have Byteman

I wonder whether we couldn't put these things together and create our own Contract for Java.

Environment

None

Activity

Show:

Gunnar MorlingJanuary 27, 2017 at 10:40 AM

I'm going to close this one as "Won't Fix". It's an interesting idea, but tiggering validation is better left to containers such as CDI and Spring, i.e. people will already benefit from method validation in these environments. I don't think people would bother starting their apps with an agent for the purpose of validation, I'd recommend them to go for some sort of container if they want this functionality.

Won't Fix

Details

Assignee

Reporter

Labels

Participants

Gunnar Morling
Hardy Ferentschik

Components

Affects versions

Priority

Created February 9, 2011 at 2:52 PM
Updated December 3, 2024 at 9:26 AM
Resolved January 27, 2017 at 10:40 AM

Flag notifications