-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Method constraints in inheritance hierarchies
PostPosted: Sat Jul 06, 2013 1:11 pm 
Newbie

Joined: Sat Jul 06, 2013 12:30 pm
Posts: 1
Hi,

I'm doing some tests with bean validation, and i have some doubts about the behavior of method constraints on inheritance hierarchies.
The specification tells about Liskov substitution, on method constraints within inheritance hierarchies, but i made the test bellow with
the reference implementation ( hiberante validator 5.1 ), and not understand if this is a bug in implementation or my misunderstanding the specification.

public interface Foo {
public void doStuff(@NotNull String v);
}

@Named
public class Bar implements Foo {
public void doStuff(String v) {}
}

Calling bar.doStuff(null), the validation is not fired.
But if i changed Foo interface to an abstract class, and made Bar extends it, the validation executes and a ConstraintViolationException is propagated.
The test was done with cdi beans.

What should be the appropriate behavior?

IMHO, this is a bug on the implementation, on the hibernate validator cdi extension.


Top
 Profile  
 
 Post subject: Re: Method constraints in inheritance hierarchies
PostPosted: Thu Jul 11, 2013 3:40 am 
Hibernate Team
Hibernate Team

Joined: Sat Jan 24, 2009 12:46 pm
Posts: 388
Hi Denis,

See my answer to your original thread (http://lists.jboss.org/pipermail/beanvalidation-dev/2013-July/000920.html), I think you should add @ValidateOnExecution(type=IMPLICIT) to your implementation class.

--Gunnar

_________________
Visit my blog at http://musingsofaprogrammingaddict.blogspot.com/


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.