Charles Jourdan created BVAL-213:
------------------------------------
Summary: [bval-jsr] Illegal strengthening: overridden
[constraints] in inheritance hierarchy
Key: BVAL-213
URL: https://issues.apache.org/jira/browse/BVAL-213
Project: BVal
Issue Type: Bug
Affects Versions: 2.0.5, 2.0.3
Environment: I'm using Bval which is embedded in TomEE.
I tested the version 2.0.3 and 2.0.5, maybe more version have this problem.
Reporter: Charles Jourdan
{{I encountered this exception when creating a bean. I'm not really sure if it
is a bug or a misuse.}}
{code:java}
javax.validation.ConstraintDeclarationException: Illegal strengthening:
overridden [constraints] in inheritance hierarchy: [method1, method2]
{code}
The two methods have exactly the same annotations. There is two classes with an
inheritance. The mother is an abstract generic class and the child is a simple
implementation of the mother.
The exception is thrown by the enum StrengtheningIssue in Liskov
(overridenHierarchy value).
After debugging this part I observed an akward situation. The parameter
detectedValidationElements have 2 two entries, normal. The child class is in
first position followed by the mother class, but the algorithm use the first
class to test the isAssignableFrom. So it will be always false in case of
inheritance.
After some research I found the method
org.apache.bval.jsr.metadata.HierarchyBuilder#forBean which is called by the
org.apache.bval.jsr.descriptor.DescriptorManager#getBeanDescriptor. The method
forBean is responsible of the list with the bad order. It adds the parent in
second position, so I supposed the bug source is in this method.
I have no idea about the impact of this order on other places. I'm not really
if this is a bug, but I found this really akward.
I hope it is understadable, and sorry for my bad english.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)