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

Use method reference operator (::) throws ClassCastException #166

Open
johnnychow1 opened this issue Mar 25, 2020 · 3 comments
Open

Use method reference operator (::) throws ClassCastException #166

johnnychow1 opened this issue Mar 25, 2020 · 3 comments
Labels

Comments

@johnnychow1
Copy link

johnnychow1 commented Mar 25, 2020

Describe the bug
Use method reference operator (::) throws ClassCastException

To Reproduce
This code works fine:

MyQuery query = MyQuery.builder().build();
MyQuery.Result result = query.request(ENDPOINT).post();
List resultList = result.getGeneratedObjects().stream()
.map(obj->MyDomainObjectMapper.map(obj))
.collect(Collectors.toList());

However code below fails and throws java.lang.ClassCastException: manifold.api.json.DataBindings cannot be cast to queries$MyQuery$Result$generatedObject

MyQuery query = MyQuery.builder().build();
MyQuery.Result result = query.request(ENDPOINT).post();
List resultList = result.getGeneratedObjects().stream()
.map(MyDomainObjectMapper::map)
.collect(Collectors.toList());

@rsmckinney rsmckinney added the bug label Mar 25, 2020
@rsmckinney
Copy link
Member

As you've discovered method refs are not yet supported with extension methods, instead please use lambda expressions for this use-case. Thanks.

similar: #64

@johnnychow1
Copy link
Author

Thanks for the quick responses. Looking forward to see it supported soon :)

@EotT123
Copy link
Contributor

EotT123 commented Jan 26, 2025

duplicate of #664

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

No branches or pull requests

3 participants