@@ -0,0 +1,2843 @@
+/*%0A * This file is part of FastClasspathScanner.%0A * %0A * Author: Luke Hutchison%0A * %0A * Hosted at: https://github.com/lukehutch/fast-classpath-scanner%0A * %0A * --%0A *%0A * The MIT License (MIT)%0A *%0A * Copyright (c) 2017 Luke Hutchison%0A * %0A * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated%0A * documentation files (the %22Software%22), to deal in the Software without restriction, including without%0A * limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of%0A * the Software, and to permit persons to whom the Software is furnished to do so, subject to the following%0A * conditions:%0A * %0A * The above copyright notice and this permission notice shall be included in all copies or substantial%0A * portions of the Software.%0A * %0A * THE SOFTWARE IS PROVIDED %22AS IS%22, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT%0A * LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO%0A * EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN%0A * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE%0A * OR OTHER DEALINGS IN THE SOFTWARE.%0A */%0Apackage io.github.lukehutch.fastclasspathscanner.classloaderhandler;%0A%0Aimport java.io.File;%0A%0Aimport io.github.lukehutch.fastclasspathscanner.scanner.ClasspathFinder;%0Aimport io.github.lukehutch.fastclasspathscanner.utils.LogNode;%0Aimport io.github.lukehutch.fastclasspathscanner.utils.ReflectionUtils;%0A%0Apublic class OSGiDefaultClassLoaderHandler implements ClassLoaderHandler %7B%0A    @Override%0A    public boolean handle(final ClassLoader classloader, final ClasspathFinder classpathFinder, final LogNode log)%0A            throws Exception %7B%0A        for (Class%3C?%3E c = classloader.getClass(); c != null; c = c.getSuperclass()) %7B%0A            if (!%22org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader%22.equals(c.getName())) %7B%0A                continue;%0A            %7D%0A            final Object classpathManager = ReflectionUtils.invokeMethod(classloader, %22getClasspathManager%22);%0A            final Object%5B%5D entries = (Object%5B%5D) ReflectionUtils.getFieldVal(classpathManager, %22entries%22);%0A            if (entries != null) %7B%0A                for (int i = 0; i %3C entries.length; i++) %7B%0A                    final Object bundleFile = ReflectionUtils.invokeMethod(entries%5Bi%5D, %22getBundleFile%22);%0A                    final File baseFile = (File) ReflectionUtils.invokeMethod(bundleFile, %22getBaseFile%22);%0A                    if (baseFile != null) %7B%0A                        classpathFinder.addClasspathElement(baseFile.getPath(), classloader, log);%0A                    %7D%0A                %7D%0A            %7D%0A            return true;%0A        %7D%0A        return false;%0A    %7D%0A%7D%0A

Support org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader (#130)