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

Konrad Windszus edited comment on FELIX-5543 at 2/28/17 12:59 PM:
------------------------------------------------------------------

Right now the component property type object returns {{null}} for all methods, 
which are not given in the {{HashMap}} in 
https://github.com/apache/felix/blob/trunk/scr/src/main/java/org/apache/felix/scr/impl/inject/Annotations.java#L246.
 
Instead of the simple {{Handler}} class one must implement something similar to 
{{sun.reflect.annotation.AnnotationInvocationHandler}}. There is such a code in 
bytebuddy (Apache License 2.0) 
(https://github.com/raphw/byte-buddy/blob/master/byte-buddy-dep/src/main/java/net/bytebuddy/description/annotation/AnnotationDescription.java)
 one could maybe just embed.


was (Author: kwin):
Right now the component property type object returns {{null}} for all methods, 
which are not given in the {{HashMap}} in 
https://github.com/apache/felix/blob/trunk/scr/src/main/java/org/apache/felix/scr/impl/inject/Annotations.java#L246.
 
Instead of the simple {{Handler}} class one must implement something similar to 
{{sun.reflect.annotation.AnnotationInvocationHandler}}.

> Component property types must implement java.lang.annotation.Annotation 
> methods properly
> ----------------------------------------------------------------------------------------
>
>                 Key: FELIX-5543
>                 URL: https://issues.apache.org/jira/browse/FELIX-5543
>             Project: Felix
>          Issue Type: Bug
>          Components: Declarative Services (SCR)
>    Affects Versions: scr-2.1.0
>            Reporter: Konrad Windszus
>
> Currently component property types only implement one getter method for each 
> element. The methods {{toString()}}, {{equals()}}, {{hashCode()}} and 
> {{annotationType}} are not implemented properly (i.e. all return just 
> {{null}}). This violates JLS 9.6 
> (https://docs.oracle.com/javase/specs/jls/se7/html/jls-9.html#jls-9.6).
> bq. The direct superinterface of an annotation type is always 
> java.lang.annotation.Annotation.  
> The component property type needs to implement 
> {{java.lang.annotation.Annotation}} and all its methods properly. The current 
> implementation is clearly violating the contract of the 
> {{java.lang.annotation.Annotation}}.
> For that the {{Annotations#toObject(...)}} needs to be adjusted in 
> https://github.com/apache/felix/blob/trunk/scr/src/main/java/org/apache/felix/scr/impl/inject/Annotations.java#L41.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to