You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Maurizio Cucchiara (JIRA)" <ji...@apache.org> on 2013/04/05 10:54:15 UTC

[jira] [Commented] (OGNL-233) ClassCacheHandler should return a handler with a key that is the nearest class (interface) to the forClass in the hierarchy tree

    [ https://issues.apache.org/jira/browse/OGNL-233?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13623463#comment-13623463 ] 

Maurizio Cucchiara commented on OGNL-233:
-----------------------------------------

Sorry, 
but I'm not sure I understand what you mean.

Why do you think that List is nearer than Collection?
There are two paths, and they have the same depth AFAICU:
1. B / AbstractList / List
2. B / A / Collection 

Furthermore, consider that ClassCacheHandler has been intended for internal use (and I would not exclude that this class changes its visibility in the next release).
                
> ClassCacheHandler should return a handler with a key that is the nearest class (interface) to the forClass in the hierarchy tree
> --------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: OGNL-233
>                 URL: https://issues.apache.org/jira/browse/OGNL-233
>             Project: Commons OGNL
>          Issue Type: Bug
>          Components: Core Runtime
>            Reporter: Azuo Lee
>         Attachments: ClassHierachy.png
>
>
> ClassCacheHandler enumerates over the forClass's interfaces and superclasses to find a match key class. But consider the following senario:
> interface A implements java.util.Collection
> class B extends java.util.AbstractList implements A
> Now if ClassCacheHandler.getHandler(B, handlers) is invoked, and assuming handlers is an empty ClassCache, according to the current enumeration logic used by ClassCacheHandler, classes (interfaces) will be enumerated in the following order:
> class B
> interface A
> interface java.util.Collection
> interface java.lang.Iterable
> interface java.io.Serializable
> class java.util.AbstractList
> interface java.util.List
> interface java.util.Collection
> interface java.lang.Iterable
> class java.util.AbstractCollection
> interface java.util.Collection
> interface java.lang.Iterable
> if both java.util.Collection and java.util.List are present as keys in the handlers, since java.util.Collection is enumerated first, then it will be matched, instead of java.util.List.
> The expected behaviour should be java.util.List is matched, because it is nearer to class B in the hierarchy tree.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira