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

LambdaCallHydrator incorrect param lvt indicies when param comes from field #15

Open
Machine-Maker opened this issue Aug 3, 2023 · 0 comments

Comments

@Machine-Maker
Copy link
Contributor

Machine-Maker commented Aug 3, 2023

The LambdaCallHydrator doesn't properly capture param lvt indicies if one of the parameters comes from a field node. Now usually this isn't the case, but it seems to be in the following situation.

abstract class AbstractClass {
	abstract Supplier<String> get(String arg);
}

class OuterClass {
	
	AbstractClass create(final String input) {
		final String value = input + "other";
		return new AbstractClass() {
			@Override
			Supplier<String> get(String arg) {
				return () -> value + arg;
			}
		}
	}
}

In this example, the lambda at OuterClass$1$lambda$create$0 (I think that's the correct name it'd have) or the one on being returned from the overriden method won't have the "arg" param marked as captured.

The issue comes from the logic collecting the param indicies. If it encounters a non var insn it breaks out of the loop, not completing the collection so an empty array is set in the LambdaCall object.

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

1 participant