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

improvements type inference of type intersections (affects ValLambda.java, ValWeirdTypes.java tests) #2109

Merged

Conversation

m4gshm
Copy link
Contributor

@m4gshm m4gshm commented Apr 24, 2019

No description provided.

@rzwitserloot
Copy link
Collaborator

Unfortunately, looks like I have to shoot this one down. I don't know how you do it, but you manage to make javac (with lombok with your patch) correctly untangle this marvellous line of code:

lombok.val foo = (System.currentTimeMillis() > 0) ? (Runnable)()-> {} : System.out::println;

If I try to compile that with javac with lombok with your patch in it, it works. But if I try to compile the same thing with ecj, it won't (it can't target-type System.out::println into a functional interface). This compiles fine on both ecj and javac without lombok:

Runnable foo = (System.currentTimeMillis() > 0) ? (Runnable)()-> {} : System.out::println;

and this won't compile on either:

Object foo = (System.currentTimeMillis() > 0) ? (Runnable)()-> {} : System.out::println;

adding to the impressiveness of the patch :)

Nevertheless, if we can't make ecj and javac do the same thing here, I prefer to just call it a day and go with j.l.Object for this stuff. Not great either, but at least consistent.

@rzwitserloot rzwitserloot merged commit cd49188 into projectlombok:master May 21, 2019
@rzwitserloot
Copy link
Collaborator

This is some seriously impressive voodoo magic, Alex! Will be in the next release :)

@rzwitserloot
Copy link
Collaborator

See also 2eab72c

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

Successfully merging this pull request may close these issues.

None yet

2 participants