You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Jago de Vreede (JIRA)" <ji...@apache.org> on 2016/09/14 14:26:20 UTC

[jira] [Closed] (FELIX-4384) Difference between inner class and normal class service

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

Jago de Vreede closed FELIX-4384.
---------------------------------
    Resolution: Won't Fix

Closing as Won't Fix As per comment thread, static inner classes work.

> Difference between inner class and normal class service
> -------------------------------------------------------
>
>                 Key: FELIX-4384
>                 URL: https://issues.apache.org/jira/browse/FELIX-4384
>             Project: Felix
>          Issue Type: Bug
>          Components: Dependency Manager
>    Affects Versions: dependencymanager-3.1.0
>            Reporter: Jago de Vreede
>            Priority: Minor
>
> Given the following code:
> package org.example;
> import org.apache.felix.dm.DependencyActivatorBase;
> import org.apache.felix.dm.DependencyManager;
> import org.osgi.framework.BundleContext;
> public class Activator extends DependencyActivatorBase {
>     @Override
>     public synchronized void init(BundleContext context, DependencyManager manager) throws Exception {
>         manager.add(createComponent()
>             .setInterface(A.class.getName(), null)
>             .setImplementation(A.class)
>             .add(createServiceDependency().setService(S.class).setRequired(true)));
>         
>         manager.add(createComponent()
>             .setInterface(S.class.getName(), null)
>             .setImplementation(S1.class));
>     }
>     @Override
>     public synchronized void destroy(BundleContext context, DependencyManager manager) throws Exception {}
>     
>     interface S {}
>     class A {}
>     class S1 implements S {}
> }
> dm will print out:
> g! dm
> [8] mytest
>  [0] org.example.Activator$A unregistered
>     org.example.Activator$S service required unavailable
>  [1] org.example.Activator$S registered
> But when the class S1 is promoted to a real class, dm will print out:
> g! dm
> [8] mytest
>  [0] org.example.Activator$A registered
>     org.example.Activator$S service required available
>  [1] org.example.Activator$S registered
> So the service class S1 is not available if its an inner class but is available if its a normal class.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)