Support cross-parameter constraints

Description

Do you think we should support the following?

similar to having property level and class level constraints, we could get method level constraints receiving all the parameters and raising constraints violations if necessary.

Environment

None

Activity

Show:
Emmanuel Bernard
July 11, 2011, 6:35 PM

I like 2b but... I don't think Java can properly model this in a type-safe way. I know Ceylon can but afaik that's the only language that can.
In other words nothing will prevent someone from writing the wrong signature.
1. can be built atop 2.a. And regardless, I think we should offer 2.a.

I guess what we could do is have the interface be 2.a. and allow other isValid methods (a la 2.b) and call them upon matching. Not sure I like that but that should be explored.

Emmanuel Bernard
July 11, 2011, 6:36 PM

How can cross-parameter constraints be distinguished from return value constraints?

Yes I agree that's an issue but I don't see a nice way out

Hardy Ferentschik
January 27, 2012, 2:41 PM

+1 for 2a

Hardy Ferentschik
January 27, 2012, 2:54 PM

@ParameterAssert might be a nice solution in case we want to keep this more open for now.

Emmanuel Bernard
October 12, 2012, 7:09 PM

For the draft of october let's put in the generic solution.
We can still continue to discuss the other options after.

Fixed

Assignee

Gunnar Morling

Reporter

Emmanuel Bernard

Labels

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Suitable for new contributors

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Components

Fix versions

Priority

Major
Configure