You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@bval.apache.org by "Matthew Jason Benson (Jira)" <ji...@apache.org> on 2022/01/08 15:20:00 UTC

[jira] [Closed] (BVAL-213) [bval-jsr] Illegal strengthening: overridden [constraints] in inheritance hierarchy

     [ https://issues.apache.org/jira/browse/BVAL-213?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matthew Jason Benson closed BVAL-213.
-------------------------------------
    Resolution: Not A Problem

> [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.3, 2.0.5
>         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
>            Priority: Major
>
> {{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.20.1#820001)