-
-
Notifications
You must be signed in to change notification settings - Fork 662
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
[jvm] automatic conversion of Haxe functions to Java functional interfaces #9576
Comments
I have added There's also a test case. The example for now requires a |
Hm, too bad you need a cast there.
It'd have to be done dynamically for, any single-method-interface I guess? |
But https://docs.oracle.com/javase/8/docs/api/java/util/function/Function.html isn't even single-method. |
The default methods probably don't count. |
Now that we actually track these default methods there's a chance to fix this. On the generator side, we will have to identify all single-method interfaces and then check each of these against each function class. That shouldn't be very expensive because it is going to fail very early very often. The other problem is the unification part... |
* [jvm] deal with functional interfaces see #9576 * [typer] handle functional interface assignments * Added tests for Java functional interfaces. * fix test --------- Co-authored-by: EliteMasterEric <ericmyllyoja@gmail.com>
Implemented in #11019. |
In Java, any interface with a single function is considered a "functional interface" that can be "instantiated" with lambda syntax. So for interop purposes, it would be quite nice if the following magically worked:
(with
foo()
usually being loaded from a.jar
)The text was updated successfully, but these errors were encountered: