On Tue, Nov 21, 2017 at 4:00 PM, Christian Schneider <ch...@die-schneider.net> wrote: > I think it can not work with a simple optional import. What could work is a > separate component that has > the optional class as a mandatory reference. > > This component could then be injected into your component with an optional > reference and with an interface that is independent of the optional import.
That's a good point. Sadly I can't use this approach since it's going to generate a warning in the logs and we have a strict policy against that. > I think declarative services do not yet support this but it would be a very > valuable feature as it allows to handle optional imports without any class > loading magic on the user side. +1 Robert > > Christian > > 2017-11-21 14:53 GMT+01:00 Robert Munteanu via osgi-dev > <osgi-dev@mail.osgi.org>: >> >> Hi Carsten, >> >> On Tue, Nov 21, 2017 at 3:50 PM, Carsten Ziegeler <cziege...@apache.org> >> wrote: >> > Hi, >> > >> > if I understand you correctly you have an optional package import to the >> > package providing BarService? >> >> Yes, that is correct. >> >> > In that case your class SomeComponent can't be loaded if that package is >> > not available and there is no magic to get around this. >> >> I was afraid of that. I'll try using a ServiceTracker, guess that's >> the next best thing. >> >> Thanks, >> >> Robert >> _______________________________________________ >> OSGi Developer Mail List >> osgi-dev@mail.osgi.org >> https://mail.osgi.org/mailman/listinfo/osgi-dev > > > > > -- > -- > Christian Schneider > http://www.liquid-reality.de > > Computer Scientist > http://www.adobe.com > -- http://robert.muntea.nu/ _______________________________________________ OSGi Developer Mail List osgi-dev@mail.osgi.org https://mail.osgi.org/mailman/listinfo/osgi-dev