public String[] lookupParameterNames(AccessibleObject methodOrCtor) {

        Class<?>[] types;
        Class<?> declaringClass;
        String name;

        if (methodOrCtor instanceof Method) {
            Method method = (Method) methodOrCtor;
            types = method.getParameterTypes();
            name = method.getName();
            declaringClass = method.getDeclaringClass();
        }

        else {
            Constructor<?> constructor = (Constructor<?>) methodOrCtor;
            types = constructor.getParameterTypes();
            declaringClass = constructor.getDeclaringClass();
            name = "<init>";
        }

        if (types.length == 0) {
            return EMPTY_NAMES;
        }

        InputStream byteCodeStream = getClassAsStream(declaringClass);
        if (byteCodeStream == null) {
            return EMPTY_NAMES;
        }

        try {
            ClassReader reader = new ClassReader(byteCodeStream);
            TypeCollector visitor = new TypeCollector(name, types, false);
            reader.accept(visitor);
            String[] parameterNamesForMethod = visitor.getParameterNamesForMethod();

            try {
                byteCodeStream.close();
            }

            catch (IOException ignored) {}

            return parameterNamesForMethod;
        }

        catch (IOException e) {
            return EMPTY_NAMES;
        }
    }