Skip to content

Create util to perform generic aware callbacks #11584

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

Closed
philwebb opened this issue Jan 9, 2018 · 5 comments
Closed

Create util to perform generic aware callbacks #11584

philwebb opened this issue Jan 9, 2018 · 5 comments
Labels
type: enhancement A general enhancement
Milestone

Comments

@philwebb
Copy link
Member

philwebb commented Jan 9, 2018

We have quite a few calls now that use generically typed listeners of the form:

public interface SomeListener<T> {

    call(T arg);

}

The pattern to filter the listeners based on a resolvable type, make the call and deal with possible Lamda issues could be extracted.

Search the codebase for "Possibly a lambda-defined" to find the existing occurrences.

@philwebb philwebb added type: enhancement A general enhancement priority: low labels Jan 9, 2018
@snicoll
Copy link
Member

snicoll commented Jan 9, 2018

That could be a core util in the framework.

@spencergibb
Copy link
Member

@philwebb
Copy link
Member Author

philwebb commented Jan 9, 2018

@spencergibb It would be more involved I think. I'd like to cut out the generic resolution and lambda try..catch dance that we keep repeating. See this code for an example.

@spencergibb
Copy link
Member

👍

@philwebb philwebb added this to the 2.0.0.RC1 milestone Jan 30, 2018
philwebb added a commit that referenced this issue Jan 30, 2018
Add `LambdaSafe` utility that provides a consistent way to deal with
the problems that can occur when calling lambda based callbacks.

See gh-11584
philwebb added a commit that referenced this issue Jan 30, 2018
philwebb added a commit that referenced this issue Jan 30, 2018
Update `LambdaSafe` to also detect `ClassCastException` messages that
start with "module/name".

See gh-11584
@philwebb
Copy link
Member Author

One bonus of the extra tests is it seems to have found a problem when running on JDK 9. I think framework also has the same issue so I've raised SPR-16435

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants