Well, we do hack java.lang.Exception in karaf by adding a hacked version in an endorsed jar, so I'm pretty sure you can do the same for java.util.ServiceLoader. However, I've no idea how that works in java9.
2016-09-30 9:35 GMT+02:00 David Bosschaert <[email protected]>: > Hi Guillaume, > > I don't think you *can* hack the java.util.ServiceLoader. It's in java.* > (not in javax.*) and those packages are designated for the JRE only. If you > try to load them from another place you'll get a security exception of some > sort. > > Cheers, > > David > > > On 30 September 2016 at 07:27, Guillaume Nodet <[email protected]> wrote: > >> >> >> 2016-09-29 23:36 GMT+02:00 David Bosschaert <[email protected]>: >> >>> Yes, SPI-Fly only handles setting the ThreadContextClassLoader for the >>> duration of certain invocations. >>> >>> BTW Anyone know whether there exist such a hacked endorsed jar for the >>> file system provider? >>> >> >> I'm not aware of anything. >> >> I'm actually wondering, given the number of spec jars that are >> maintained, would it be easier to hack the ServiceLoader >> class so that it delegates to OSGi first, and use that hacked >> ServiceLoader as an endorsed jar ? I haven't checked all the specs, but I >> now expect most of them to use this mechanism. >> Though, that may be a point to address when we're going to look at JDK9 / >> Jigsaw support. >> >> >>> >>> Cheers, >>> >>> David >>> >>> On 29 September 2016 at 18:23, Guillaume Nodet <[email protected]> >>> wrote: >>> >>>> No, I think your analysis is correct. >>>> Iin order to work, we'd have to use an endorsed hacked spec jar, as we >>>> usually do >>>> >>>> 2016-09-29 19:10 GMT+02:00 Benson Margulies <[email protected]>: >>>> >>>>> Has anyone tried or succeeded in integrating a file system provider by >>>>> using SPI-fly? >>>>> >>>>> The code in the JRE calls 'ClassLoader.getSystemClassLoader()', which >>>>> leads me to be a pessimist, but I thought I'd ask. >>>>> >>>> >>>> >>>> >>>> -- >>>> ------------------------ >>>> Guillaume Nodet >>>> ------------------------ >>>> Red Hat, Open Source Integration >>>> >>>> Email: [email protected] >>>> Web: http://fusesource.com >>>> Blog: http://gnodet.blogspot.com/ >>>> >>>> >>> >> >> >> -- >> ------------------------ >> Guillaume Nodet >> ------------------------ >> Red Hat, Open Source Integration >> >> Email: [email protected] >> Web: http://fusesource.com >> Blog: http://gnodet.blogspot.com/ >> >> > -- ------------------------ Guillaume Nodet ------------------------ Red Hat, Open Source Integration Email: [email protected] Web: http://fusesource.com Blog: http://gnodet.blogspot.com/
