You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@aries.apache.org by "Amichai Rothman (Jira)" <ji...@apache.org> on 2019/10/30 15:28:00 UTC

[jira] [Updated] (ARIES-1938) Can't register service as java.lang.Object

     [ https://issues.apache.org/jira/browse/ARIES-1938?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Amichai Rothman updated ARIES-1938:
-----------------------------------
    Affects Version/s: blueprint-core-1.10.2
          Description: 
Trying to register a service in the blueprint xml under the interface name "java.lang.Object" results in an error, but according to the spec this should work.

Specifically, from my understanding of the osgi core spec (section 5.2.3) is should be calling {{Class.isInstance}}  on each specified class to check if the service class is indeed an instance of it (and also mentions explicitly this can be a class, not just an interface).

However, the blueprint code in ServiceRecipe doesn't do this, but instead tries to collect all superclasses and interfaces of the service object. To do this, it uses ReflectionUtils.getSuperClasses(), which does not return Object as a superclass.

This may be a bug in getSuperClasses, but might as well be changed to do what the spec says directly instead, which looks more performant as well.

btw, the real-world use case I came across is pax web whiteboard requiring a service to be registered under java.lang.Object, which doesn't work with blueprint.
              Summary: Can't register service as java.lang.Object  (was: can register service as java.lang.Object)

> Can't register service as java.lang.Object
> ------------------------------------------
>
>                 Key: ARIES-1938
>                 URL: https://issues.apache.org/jira/browse/ARIES-1938
>             Project: Aries
>          Issue Type: Bug
>          Components: Blueprint
>    Affects Versions: blueprint-core-1.10.2
>            Reporter: Amichai Rothman
>            Priority: Major
>
> Trying to register a service in the blueprint xml under the interface name "java.lang.Object" results in an error, but according to the spec this should work.
> Specifically, from my understanding of the osgi core spec (section 5.2.3) is should be calling {{Class.isInstance}}  on each specified class to check if the service class is indeed an instance of it (and also mentions explicitly this can be a class, not just an interface).
> However, the blueprint code in ServiceRecipe doesn't do this, but instead tries to collect all superclasses and interfaces of the service object. To do this, it uses ReflectionUtils.getSuperClasses(), which does not return Object as a superclass.
> This may be a bug in getSuperClasses, but might as well be changed to do what the spec says directly instead, which looks more performant as well.
> btw, the real-world use case I came across is pax web whiteboard requiring a service to be registered under java.lang.Object, which doesn't work with blueprint.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)