Jens, the issue is not anything to do with ambiguity, it has to do
with the way we are able to treat an anonymous class as both a
function and an object, see Runtime.java makeLambdaFunction
/**
* Create a function that applies the specified samMethod on itself,
and whose __proto__ points to
That would be — awesome. Pretty please? :)
On Tuesday, May 17, 2016 at 11:13:09 AM UTC-7, Jens wrote:
>
>
> The issue is that @JsFunction implementors must "extend
>> java.lang.Object" as their parent. because standard library functions
>> are/canbe implemented on classes with complicated
> The issue is that @JsFunction implementors must "extend
> java.lang.Object" as their parent. because standard library functions
> are/canbe implemented on classes with complicated type hierarchies,
> this would cause failures to compile.
>
> This restriction comes about from the efficiency
Well bummer. Thanks for the detailed info. Perhaps someday it can check
if they do directly extend Object or not and either take the shortcut or
the long way... I'm afraid that's way over my depth in the GWT code to
attempt a patch though.
On Wednesday, May 11, 2016 at 6:07:15 PM UTC-7, Ray
The issue is that @JsFunction implementors must "extend
java.lang.Object" as their parent. because standard library functions
are/canbe implemented on classes with complicated type hierarchies,
this would cause failures to compile.
This restriction comes about from the efficiency trick we use to
No, its not a solution, so much as a "here is a workaround that might
satisfy your specific case as you build your JsInterop-based lib so that it
looks like it can use @FunctionalInterface types". I do not believe it to
be a comprehensive way to provide the feature requested. At some point I'll
We cannot impose @JsFunction restrictions on standard library
@FunctionInterfaces. You can see some of the limitations in the Javadoc.
@Colin: I didn't understand your solution. Feel free to propose something
more concrete and we can discuss over that.
On Wed, May 11, 2016 at 4:22 PM, Colin
Unfortunately, you can't add the annotation to an interface with more than
one method, even if those methods are default methods, at least as it is
currently implemented.
I can't remember the exact specifics around why this is the case, but
believe it has to do with handling functions passed from
I think it would be good to add @JsFunction to all of the
java.util.function interfaces in the JRE Emulation so that we can use
standard function signatures with JsInterop.
Would that work? Any drawbacks?
If you think that's a good idea, I can submit a patch.
Thanks!
--
You received this