-
Notifications
You must be signed in to change notification settings - Fork 30
activation rules for constraints not working for programming by contract #7
Comments
Your example does not work because Activation of a parameter constraint depending on another parameter's value is currently not possible. You can try using a @Guarded
public class Pojo {
private String fieldA;
@NotNull(when = "javascript:_this.fieldA != null")
private String fieldB;
@PostValidateThis
public Pojo(String fieldA, String fieldB) {
this.fieldA = fieldA;
this.fieldB = fieldB;
}
public String getFieldA() {
return this.fieldA;
}
} |
Hi Sebastian, Is there some limitation to using
Basic example tests:
|
I cannot really reproduce the issue. I extended the respective test case and it seems to work fine, see c676ef2 There are two things you need to be aware of:
|
Hi Sebastian, I noticed that javascript couldn't see private variables for some reason.
|
I added a fix for the StackOverflowError. Can you please give the latest snapshot a try: http://oval.sourceforge.net/mvn-repo/snapshot/net/sf/oval/oval/1.88-SNAPSHOT/ |
I've tested the latest snapshot and can confirm I no longer get the StackOverflowError. |
Activation rules don't seem to work when using Programming by contract with AspectJ.
As per the documentation this works when using a Validator:
But applying the same concept using Guarded does not.
The text was updated successfully, but these errors were encountered: