You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Konrad Windszus (JIRA)" <ji...@apache.org> on 2017/02/14 10:22:41 UTC

[jira] [Comment Edited] (FELIX-5543) Make component property types implement java.lang.annotation.Annotation as well

    [ 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/14/17 10:22 AM:
------------------------------------------------------------------

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. This is not good, since each object in Java implicitly derives from https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html which mandates a certain implementation of those methods.
Instead of the simple {{Handler}} class one must implement something similar to {{sun.reflect.annotation.AnnotationInvocationHandler}}.


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. This is not good, since each object in Java implicitly derives from https://docs.oracle.com/javase/7/docs/api/java/lang/Object.html which mandates a certain implementation of those methods.

> Make component property types implement java.lang.annotation.Annotation as well
> -------------------------------------------------------------------------------
>
>                 Key: FELIX-5543
>                 URL: https://issues.apache.org/jira/browse/FELIX-5543
>             Project: Felix
>          Issue Type: Improvement
>          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.
> At least the toString() should be implemented in a way, that doesn't just return {{null}}.
> I think it would be reasonable for all component property types to implement {{java.lang.annotation.Annotation}} appropriately (as specified by the javadoc in https://docs.oracle.com/javase/7/docs/api/java/lang/annotation/Annotation.html}}. 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)