You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@bval.apache.org by "Matt Benson (JIRA)" <ji...@apache.org> on 2010/07/09 20:44:51 UTC

[jira] Created: (BVAL-78) Avoid unsafe casting and object swapping when processing @ReportAsSingleViolation composed constraints

Avoid unsafe casting and object swapping when processing @ReportAsSingleViolation composed constraints
------------------------------------------------------------------------------------------------------

                 Key: BVAL-78
                 URL: https://issues.apache.org/jira/browse/BVAL-78
             Project: BeanValidation
          Issue Type: Improvement
          Components: jsr303
    Affects Versions: 0.2-incubating
            Reporter: Matt Benson
         Attachments: BVAL-78.patch.txt

Numerous warnings abound in ConstraintViolation due to the fact that ConstraintValidationListener must be used as a raw type.  Further the GroupValidationContext must be cast to a BeanValidationContext so that the listener reference can be reset, which doesn't feel optimal either.  The attached patch:

* Modifies GroupValidationContext<T> such that, rather than extending ValidationContext<T> where T extends ValidationListener, it instead expressly implements ValidationContext<ConstraintValidationListener<T>> (T is now effectively the same type variable as ConstraintValidationListener<T>).  Now GroupValidationContext.getListener() expressly returns a ConstraintValidationListener.
* Adds state management for @ReportAsSingleViolation composed constraints to ConstraintValidationListener so that the original listener instance can be used throughout.
* The reportAsSingle execution path bails as soon as it is known that a composing constraint has failed.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (BVAL-78) Avoid unsafe casting and object swapping when processing @ReportAsSingleViolation composed constraints

Posted by "Carlos Vara (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/BVAL-78?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carlos Vara resolved BVAL-78.
-----------------------------

    Fix Version/s: 0.2-incubating
       Resolution: Fixed

Merged the patch, thanks Matt!

I added a commentary regarding the use of an AtomicInteger in ConstraintValidationListener, since it should not be needed as objects of that class (and all the classes involved in the validation process) are never shared between threads.

> Avoid unsafe casting and object swapping when processing @ReportAsSingleViolation composed constraints
> ------------------------------------------------------------------------------------------------------
>
>                 Key: BVAL-78
>                 URL: https://issues.apache.org/jira/browse/BVAL-78
>             Project: BeanValidation
>          Issue Type: Improvement
>          Components: jsr303
>    Affects Versions: 0.2-incubating
>            Reporter: Matt Benson
>            Assignee: Carlos Vara
>             Fix For: 0.2-incubating
>
>         Attachments: BVAL-78.patch.txt
>
>
> Numerous warnings abound in ConstraintViolation due to the fact that ConstraintValidationListener must be used as a raw type.  Further the GroupValidationContext must be cast to a BeanValidationContext so that the listener reference can be reset, which doesn't feel optimal either.  The attached patch:
> * Modifies GroupValidationContext<T> such that, rather than extending ValidationContext<T> where T extends ValidationListener, it instead expressly implements ValidationContext<ConstraintValidationListener<T>> (T is now effectively the same type variable as ConstraintValidationListener<T>).  Now GroupValidationContext.getListener() expressly returns a ConstraintValidationListener.
> * Adds state management for @ReportAsSingleViolation composed constraints to ConstraintValidationListener so that the original listener instance can be used throughout.
> * The reportAsSingle execution path bails as soon as it is known that a composing constraint has failed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (BVAL-78) Avoid unsafe casting and object swapping when processing @ReportAsSingleViolation composed constraints

Posted by "Matt Benson (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/BVAL-78?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matt Benson updated BVAL-78:
----------------------------

    Attachment:     (was: BVAL-78.patch.txt)

> Avoid unsafe casting and object swapping when processing @ReportAsSingleViolation composed constraints
> ------------------------------------------------------------------------------------------------------
>
>                 Key: BVAL-78
>                 URL: https://issues.apache.org/jira/browse/BVAL-78
>             Project: BeanValidation
>          Issue Type: Improvement
>          Components: jsr303
>    Affects Versions: 0.2-incubating
>            Reporter: Matt Benson
>         Attachments: BVAL-78.patch.txt
>
>
> Numerous warnings abound in ConstraintViolation due to the fact that ConstraintValidationListener must be used as a raw type.  Further the GroupValidationContext must be cast to a BeanValidationContext so that the listener reference can be reset, which doesn't feel optimal either.  The attached patch:
> * Modifies GroupValidationContext<T> such that, rather than extending ValidationContext<T> where T extends ValidationListener, it instead expressly implements ValidationContext<ConstraintValidationListener<T>> (T is now effectively the same type variable as ConstraintValidationListener<T>).  Now GroupValidationContext.getListener() expressly returns a ConstraintValidationListener.
> * Adds state management for @ReportAsSingleViolation composed constraints to ConstraintValidationListener so that the original listener instance can be used throughout.
> * The reportAsSingle execution path bails as soon as it is known that a composing constraint has failed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (BVAL-78) Avoid unsafe casting and object swapping when processing @ReportAsSingleViolation composed constraints

Posted by "Matt Benson (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/BVAL-78?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matt Benson updated BVAL-78:
----------------------------

    Attachment: BVAL-78.patch.txt

> Avoid unsafe casting and object swapping when processing @ReportAsSingleViolation composed constraints
> ------------------------------------------------------------------------------------------------------
>
>                 Key: BVAL-78
>                 URL: https://issues.apache.org/jira/browse/BVAL-78
>             Project: BeanValidation
>          Issue Type: Improvement
>          Components: jsr303
>    Affects Versions: 0.2-incubating
>            Reporter: Matt Benson
>         Attachments: BVAL-78.patch.txt
>
>
> Numerous warnings abound in ConstraintViolation due to the fact that ConstraintValidationListener must be used as a raw type.  Further the GroupValidationContext must be cast to a BeanValidationContext so that the listener reference can be reset, which doesn't feel optimal either.  The attached patch:
> * Modifies GroupValidationContext<T> such that, rather than extending ValidationContext<T> where T extends ValidationListener, it instead expressly implements ValidationContext<ConstraintValidationListener<T>> (T is now effectively the same type variable as ConstraintValidationListener<T>).  Now GroupValidationContext.getListener() expressly returns a ConstraintValidationListener.
> * Adds state management for @ReportAsSingleViolation composed constraints to ConstraintValidationListener so that the original listener instance can be used throughout.
> * The reportAsSingle execution path bails as soon as it is known that a composing constraint has failed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (BVAL-78) Avoid unsafe casting and object swapping when processing @ReportAsSingleViolation composed constraints

Posted by "Matt Benson (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/BVAL-78?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Matt Benson updated BVAL-78:
----------------------------

    Attachment: BVAL-78.patch.txt

Update patch since BVAL-76 was accepted.

> Avoid unsafe casting and object swapping when processing @ReportAsSingleViolation composed constraints
> ------------------------------------------------------------------------------------------------------
>
>                 Key: BVAL-78
>                 URL: https://issues.apache.org/jira/browse/BVAL-78
>             Project: BeanValidation
>          Issue Type: Improvement
>          Components: jsr303
>    Affects Versions: 0.2-incubating
>            Reporter: Matt Benson
>         Attachments: BVAL-78.patch.txt
>
>
> Numerous warnings abound in ConstraintViolation due to the fact that ConstraintValidationListener must be used as a raw type.  Further the GroupValidationContext must be cast to a BeanValidationContext so that the listener reference can be reset, which doesn't feel optimal either.  The attached patch:
> * Modifies GroupValidationContext<T> such that, rather than extending ValidationContext<T> where T extends ValidationListener, it instead expressly implements ValidationContext<ConstraintValidationListener<T>> (T is now effectively the same type variable as ConstraintValidationListener<T>).  Now GroupValidationContext.getListener() expressly returns a ConstraintValidationListener.
> * Adds state management for @ReportAsSingleViolation composed constraints to ConstraintValidationListener so that the original listener instance can be used throughout.
> * The reportAsSingle execution path bails as soon as it is known that a composing constraint has failed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (BVAL-78) Avoid unsafe casting and object swapping when processing @ReportAsSingleViolation composed constraints

Posted by "Carlos Vara (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/BVAL-78?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carlos Vara reassigned BVAL-78:
-------------------------------

    Assignee: Carlos Vara

> Avoid unsafe casting and object swapping when processing @ReportAsSingleViolation composed constraints
> ------------------------------------------------------------------------------------------------------
>
>                 Key: BVAL-78
>                 URL: https://issues.apache.org/jira/browse/BVAL-78
>             Project: BeanValidation
>          Issue Type: Improvement
>          Components: jsr303
>    Affects Versions: 0.2-incubating
>            Reporter: Matt Benson
>            Assignee: Carlos Vara
>         Attachments: BVAL-78.patch.txt
>
>
> Numerous warnings abound in ConstraintViolation due to the fact that ConstraintValidationListener must be used as a raw type.  Further the GroupValidationContext must be cast to a BeanValidationContext so that the listener reference can be reset, which doesn't feel optimal either.  The attached patch:
> * Modifies GroupValidationContext<T> such that, rather than extending ValidationContext<T> where T extends ValidationListener, it instead expressly implements ValidationContext<ConstraintValidationListener<T>> (T is now effectively the same type variable as ConstraintValidationListener<T>).  Now GroupValidationContext.getListener() expressly returns a ConstraintValidationListener.
> * Adds state management for @ReportAsSingleViolation composed constraints to ConstraintValidationListener so that the original listener instance can be used throughout.
> * The reportAsSingle execution path bails as soon as it is known that a composing constraint has failed.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.