-
Notifications
You must be signed in to change notification settings - Fork 130
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
Advertise lambdas as arguments to then
/ runRemotely
#882
Conversation
@@ -759,6 +758,15 @@ public String[] getTruststoreJavaOptions() { | |||
* If you need to pass and/or return values, you can still use a static method reference: | |||
* try {@link #runRemotely(Step2)} or {@link #runRemotely(StepWithReturnAndOneArg, Serializable)} etc. | |||
* (using {@link XStreamSerializable} as needed). | |||
* <p> | |||
* Alternately, you could use a lambda (taking care not to capture non-serializable objects from scope): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my experience, this is pretty difficult to assess once you experience an issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be. Noted in #881 (comment). The difference is that (anonymous) inner classes will always capture variables in lexical scope, whereas lambdas usually will not. Noted another caveat in b9e40f5.
More concise alternative to use of static method handles, at least for the common case that there is only one call site (or the lambda delegates to a static method with arguments). #881 (comment) for discussion (see 1f09a19)