private static ClassLoader[] getCandidateLoaders()
    {
        ClassLoader[] result = new ClassLoader[] {
            RESOLVER.getNonlibraryCallerClass().getClassLoader(),
            Thread.currentThread().getContextClassLoader(),
            Reflector.class.getClassLoader()
        };

        // Sort them in most-specific-to-least-specific order
        // using a simple bubble sort (augh!!)
        boolean moved = false;
        if (hasAsChild(result[1], result[2]))
        {
            ClassLoader temp = result[2];
            result[2] = result[1];
            result[1] = temp;
            moved = true;
        }
        if (hasAsChild(result[0], result[1]))
        {
            ClassLoader temp = result[1];
            result[1] = result[0];
            result[0] = temp;
            moved = true;
        }
        if (moved)
        {
            if (hasAsChild(result[1], result[2]))
            {
                ClassLoader temp = result[2];
                result[2] = result[1];
                result[1] = temp;
            }
        }
        else
        {
            if (hasAsChild(result[0], result[2]))
            {
                ClassLoader temp = result[2];
                result[2] = result[0];
                result[0] = temp;
            }
        }
        return result;
    }