Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getMethodParamNames returns names of local variables #256

Closed
Nikos410 opened this issue Jan 23, 2019 · 1 comment
Closed

getMethodParamNames returns names of local variables #256

Nikos410 opened this issue Jan 23, 2019 · 1 comment

Comments

@Nikos410
Copy link

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?

@ziqin
Copy link

ziqin commented Mar 29, 2020

I have reproduced this problem.

ronmamo pushed a commit that referenced this issue Apr 26, 2020
ziqin pushed a commit to ziqin/reflections that referenced this issue May 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants