Skip to content

getMethodParamNames returns names of local variables #256

@Nikos410

Description

@Nikos410

Hello, first of all thank you for providing this great library as Open-Source software!

I tried using getMethodParamNames today, but the returned list contains not only the names of the method parameters, but also the names of the local variables of that method.

I wrote up a quick demonstration to show this:

    public void test(String testParam) {
        String testLocal = "local";
    }

    public static void main(String[] args) throws Exception {
        final Method method = Demo.class.getMethod("test", String.class);

        Reflections reflections = new Reflections("de.nikos410", new MethodParameterNamesScanner());
        List<String> paramNames = reflections.getMethodParamNames(method);

        System.out.println(paramNames);
    }

The output I get is [testParam, testLocal]

Is this a known issue or is it maybe caused by some configuŕation issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions