You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@bval.apache.org by "Carlos Vara (JIRA)" <ji...@apache.org> on 2010/04/21 13:57:50 UTC

[jira] Created: (BVAL-20) When building a MetaBean, the full tree of subclasses/interfaces must be considered

When building a MetaBean, the full tree of subclasses/interfaces must be considered
-----------------------------------------------------------------------------------

                 Key: BVAL-20
                 URL: https://issues.apache.org/jira/browse/BVAL-20
             Project: BeanValidation
          Issue Type: Bug
          Components: jsr303
    Affects Versions: 0.1-incubating
            Reporter: Carlos Vara
         Attachments: FullHierarchyTraversal.patch

Currently, only subclasses and interfaces of the original class are traversed. I attach a fix that traverses the full hierarchy tree.

3 more tests in the TCK pass with it applied.

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


[jira] Commented: (BVAL-20) When building a MetaBean, the full tree of subclasses/interfaces must be considered

Posted by "Roman Stumm (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BVAL-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12859330#action_12859330 ] 

Roman Stumm commented on BVAL-20:
---------------------------------

He uses List, because the algorithm requires a specific sequence to process the classes/interfaces.

> When building a MetaBean, the full tree of subclasses/interfaces must be considered
> -----------------------------------------------------------------------------------
>
>                 Key: BVAL-20
>                 URL: https://issues.apache.org/jira/browse/BVAL-20
>             Project: BeanValidation
>          Issue Type: Bug
>          Components: jsr303
>    Affects Versions: 0.1-incubating
>            Reporter: Carlos Vara
>            Assignee: Simone Tripodi
>         Attachments: FullHierarchyTraversal.patch
>
>
> Currently, only subclasses and interfaces of the original class are traversed. I attach a fix that traverses the full hierarchy tree.
> 3 more tests in the TCK pass with it applied.

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


[jira] Updated: (BVAL-20) When building a MetaBean, the full tree of subclasses/interfaces must be considered

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

Carlos Vara updated BVAL-20:
----------------------------

    Attachment: FullHierarchyTraversal.patch

> When building a MetaBean, the full tree of subclasses/interfaces must be considered
> -----------------------------------------------------------------------------------
>
>                 Key: BVAL-20
>                 URL: https://issues.apache.org/jira/browse/BVAL-20
>             Project: BeanValidation
>          Issue Type: Bug
>          Components: jsr303
>    Affects Versions: 0.1-incubating
>            Reporter: Carlos Vara
>         Attachments: FullHierarchyTraversal.patch
>
>
> Currently, only subclasses and interfaces of the original class are traversed. I attach a fix that traverses the full hierarchy tree.
> 3 more tests in the TCK pass with it applied.

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


[jira] Assigned: (BVAL-20) When building a MetaBean, the full tree of subclasses/interfaces must be considered

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

Simone Tripodi reassigned BVAL-20:
----------------------------------

    Assignee: Simone Tripodi

> When building a MetaBean, the full tree of subclasses/interfaces must be considered
> -----------------------------------------------------------------------------------
>
>                 Key: BVAL-20
>                 URL: https://issues.apache.org/jira/browse/BVAL-20
>             Project: BeanValidation
>          Issue Type: Bug
>          Components: jsr303
>    Affects Versions: 0.1-incubating
>            Reporter: Carlos Vara
>            Assignee: Simone Tripodi
>         Attachments: FullHierarchyTraversal.patch
>
>
> Currently, only subclasses and interfaces of the original class are traversed. I attach a fix that traverses the full hierarchy tree.
> 3 more tests in the TCK pass with it applied.

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


[jira] Commented: (BVAL-20) When building a MetaBean, the full tree of subclasses/interfaces must be considered

Posted by "Simone Tripodi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BVAL-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12859332#action_12859332 ] 

Simone Tripodi commented on BVAL-20:
------------------------------------

Ok, clear, thanks a lot Roman, I'll apply the patch as soon as I'll find 5 minutes of spare time.

> When building a MetaBean, the full tree of subclasses/interfaces must be considered
> -----------------------------------------------------------------------------------
>
>                 Key: BVAL-20
>                 URL: https://issues.apache.org/jira/browse/BVAL-20
>             Project: BeanValidation
>          Issue Type: Bug
>          Components: jsr303
>    Affects Versions: 0.1-incubating
>            Reporter: Carlos Vara
>            Assignee: Simone Tripodi
>         Attachments: FullHierarchyTraversal.patch
>
>
> Currently, only subclasses and interfaces of the original class are traversed. I attach a fix that traverses the full hierarchy tree.
> 3 more tests in the TCK pass with it applied.

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


[jira] Commented: (BVAL-20) When building a MetaBean, the full tree of subclasses/interfaces must be considered

Posted by "Simone Tripodi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BVAL-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12859328#action_12859328 ] 

Simone Tripodi commented on BVAL-20:
------------------------------------

Good catch Carlos, gracias :)

Please keep in mind that at 90% I could be wrong, but: what about using Set<Class<?>> classSequence = new HashSet<Class<?>>() instead of List<Class<?>> classSequence = new ArrayList<Class<?>>() ?
AFAIK it should improve the contains() method performances.

Any suggestion?

> When building a MetaBean, the full tree of subclasses/interfaces must be considered
> -----------------------------------------------------------------------------------
>
>                 Key: BVAL-20
>                 URL: https://issues.apache.org/jira/browse/BVAL-20
>             Project: BeanValidation
>          Issue Type: Bug
>          Components: jsr303
>    Affects Versions: 0.1-incubating
>            Reporter: Carlos Vara
>            Assignee: Simone Tripodi
>         Attachments: FullHierarchyTraversal.patch
>
>
> Currently, only subclasses and interfaces of the original class are traversed. I attach a fix that traverses the full hierarchy tree.
> 3 more tests in the TCK pass with it applied.

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


[jira] Updated: (BVAL-20) When building a MetaBean, the full tree of subclasses/interfaces must be considered

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

Roman Stumm updated BVAL-20:
----------------------------

    Fix Version/s: 0.1-incubating

> When building a MetaBean, the full tree of subclasses/interfaces must be considered
> -----------------------------------------------------------------------------------
>
>                 Key: BVAL-20
>                 URL: https://issues.apache.org/jira/browse/BVAL-20
>             Project: BeanValidation
>          Issue Type: Bug
>          Components: jsr303
>    Affects Versions: 0.1-incubating
>            Reporter: Carlos Vara
>            Assignee: Simone Tripodi
>             Fix For: 0.1-incubating
>
>         Attachments: FullHierarchyTraversal.patch
>
>
> Currently, only subclasses and interfaces of the original class are traversed. I attach a fix that traverses the full hierarchy tree.
> 3 more tests in the TCK pass with it applied.

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


[jira] Commented: (BVAL-20) When building a MetaBean, the full tree of subclasses/interfaces must be considered

Posted by "Carlos Vara (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BVAL-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12859333#action_12859333 ] 

Carlos Vara commented on BVAL-20:
---------------------------------

Yes, if it wasn't for the specific order requirement a Set would have been a better choice there.

Still the algorithm can probably be improved for speed, I just prefer to concentrate now only in making it pass the tests and leave optimizations for later.

> When building a MetaBean, the full tree of subclasses/interfaces must be considered
> -----------------------------------------------------------------------------------
>
>                 Key: BVAL-20
>                 URL: https://issues.apache.org/jira/browse/BVAL-20
>             Project: BeanValidation
>          Issue Type: Bug
>          Components: jsr303
>    Affects Versions: 0.1-incubating
>            Reporter: Carlos Vara
>            Assignee: Simone Tripodi
>         Attachments: FullHierarchyTraversal.patch
>
>
> Currently, only subclasses and interfaces of the original class are traversed. I attach a fix that traverses the full hierarchy tree.
> 3 more tests in the TCK pass with it applied.

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


[jira] Commented: (BVAL-20) When building a MetaBean, the full tree of subclasses/interfaces must be considered

Posted by "Simone Tripodi (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BVAL-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12859337#action_12859337 ] 

Simone Tripodi commented on BVAL-20:
------------------------------------

@Roman: thanks :)

BTW guys, what about using the [LinkedHashSet|http://java.sun.com/javase/6/docs/api/java/util/LinkedHashSet.html]? As reported in the Javadoc

{quote}
Hash table and linked list implementation of the Set interface, with predictable iteration order.
{quote}

and

{quote}
Like HashSet, it provides constant-time performance for the basic operations (add, contains and remove), assuming the hash function disperses elements properly among the buckets.
{quote}



> When building a MetaBean, the full tree of subclasses/interfaces must be considered
> -----------------------------------------------------------------------------------
>
>                 Key: BVAL-20
>                 URL: https://issues.apache.org/jira/browse/BVAL-20
>             Project: BeanValidation
>          Issue Type: Bug
>          Components: jsr303
>    Affects Versions: 0.1-incubating
>            Reporter: Carlos Vara
>            Assignee: Simone Tripodi
>         Attachments: FullHierarchyTraversal.patch
>
>
> Currently, only subclasses and interfaces of the original class are traversed. I attach a fix that traverses the full hierarchy tree.
> 3 more tests in the TCK pass with it applied.

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


[jira] Resolved: (BVAL-20) When building a MetaBean, the full tree of subclasses/interfaces must be considered

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

Roman Stumm resolved BVAL-20.
-----------------------------

    Resolution: Fixed

merged and committed the fixed from Carlos, Thanks!

> When building a MetaBean, the full tree of subclasses/interfaces must be considered
> -----------------------------------------------------------------------------------
>
>                 Key: BVAL-20
>                 URL: https://issues.apache.org/jira/browse/BVAL-20
>             Project: BeanValidation
>          Issue Type: Bug
>          Components: jsr303
>    Affects Versions: 0.1-incubating
>            Reporter: Carlos Vara
>            Assignee: Simone Tripodi
>         Attachments: FullHierarchyTraversal.patch
>
>
> Currently, only subclasses and interfaces of the original class are traversed. I attach a fix that traverses the full hierarchy tree.
> 3 more tests in the TCK pass with it applied.

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


[jira] Commented: (BVAL-20) When building a MetaBean, the full tree of subclasses/interfaces must be considered

Posted by "Carlos Vara (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BVAL-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12859347#action_12859347 ] 

Carlos Vara commented on BVAL-20:
---------------------------------

Well, mine is not a binding opinion, but even though I think that the change would very likely improve the speed, I would wait until the TCK passes and the project is profiled to worry about performance. Of course, once you have worried, there is no harm in changing it :-)

Also, probably the time-hog in that algorithm is in these two lines:

  List<Class<?>> subClasses = new ArrayList<Class<?>>(Arrays.asList(clazz.getInterfaces()));
  subClasses.add(0, clazz.getSuperclass());

Can be easily improved (for speed) by doing:

  Class<?>[] subClasses = clazz.getInterfaces();
  fillFullClassHierarchyAsList(allClasses, clazz.getSuperClass());

And keeping the same loop. I just left it the way it is because I find that easier to read.

> When building a MetaBean, the full tree of subclasses/interfaces must be considered
> -----------------------------------------------------------------------------------
>
>                 Key: BVAL-20
>                 URL: https://issues.apache.org/jira/browse/BVAL-20
>             Project: BeanValidation
>          Issue Type: Bug
>          Components: jsr303
>    Affects Versions: 0.1-incubating
>            Reporter: Carlos Vara
>            Assignee: Simone Tripodi
>         Attachments: FullHierarchyTraversal.patch
>
>
> Currently, only subclasses and interfaces of the original class are traversed. I attach a fix that traverses the full hierarchy tree.
> 3 more tests in the TCK pass with it applied.

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


[jira] Commented: (BVAL-20) When building a MetaBean, the full tree of subclasses/interfaces must be considered

Posted by "Roman Stumm (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BVAL-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12859334#action_12859334 ] 

Roman Stumm commented on BVAL-20:
---------------------------------

@Simone: I already committed this and the issued it resolved. 

> When building a MetaBean, the full tree of subclasses/interfaces must be considered
> -----------------------------------------------------------------------------------
>
>                 Key: BVAL-20
>                 URL: https://issues.apache.org/jira/browse/BVAL-20
>             Project: BeanValidation
>          Issue Type: Bug
>          Components: jsr303
>    Affects Versions: 0.1-incubating
>            Reporter: Carlos Vara
>            Assignee: Simone Tripodi
>         Attachments: FullHierarchyTraversal.patch
>
>
> Currently, only subclasses and interfaces of the original class are traversed. I attach a fix that traverses the full hierarchy tree.
> 3 more tests in the TCK pass with it applied.

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