eclipse-archived / ceylon

The Ceylon compiler, language module, and command line tools
http://ceylon-lang.org
Apache License 2.0
399 stars 62 forks source link

Java 8: support auto-SMI of our Callable types #1617

Closed CeylonMigrationBot closed 8 years ago

CeylonMigrationBot commented 10 years ago

[@FroMage] In theory we should be able to pretend that any method in Java which accepts an SMI (Single-Method Interface) accepts a union of the SMI and its corresponding Ceylon Callable, and do the magic auto-conversion in our backend, when provided with a Callable.

Similarly we should be able to pretend that any method in Java which returns an SMI returns an intersection of the SMI and its corresponding Ceylon Callable, and do the magic auto-conversion in our backend.

I'm not 100% convinced we can do this due to the usual issues with types and bounds and type-arguments, but we can try and investigate.

I highly doubt we'll have time to do this for 1.1, so marking 1.2

[Migrated from ceylon/ceylon-compiler#1617]

FroMage commented 8 years ago

Well, at least we'd be able to find a place to stick the uncheckedNull

gavinking commented 8 years ago

Stef, by the way, you left your System.outs in the code you pushed ;-)

gavinking commented 8 years ago

Well, at least we'd be able to find a place to stick the uncheckedNull

Right, that's the idea.

FroMage commented 8 years ago

I removed it after ;)

FroMage commented 8 years ago

Well, I'll try that tomorrow, see where it leads.

gavinking commented 8 years ago

OK.

FroMage commented 8 years ago

OK that's pretty easy to create a Functional argument but still the typechecker does not check uncheckedNull to allow functions that take/return null.

gavinking commented 8 years ago

OK that's pretty easy to create a Functional argument but still the typechecker does not check uncheckedNull to allow functions that take/return null.

Yes, that's what I was trying to say above. But perhaps it's not too hard to fix. I have to try.

FroMage commented 8 years ago

Well I found how to make the typechecker accept it, it looks like, but the code we generate on the backend doesn't handle it properly. I'll have to fix that.

FroMage commented 8 years ago

This appears to work. Let's see if I can make the IDEs compile with the changes I did.

FroMage commented 8 years ago

OK, the two IDEs compile, but I haven't tested them. Can you review my code please @bjansen and @davidfestal and @gavinking and @jvasileff can you test?

I feel like it's about time I've closed this issue.

bjansen commented 8 years ago

The IntelliJ part LGTM.

jvasileff commented 8 years ago

Ok... you asked. https://github.com/ceylon/ceylon/issues/6634

fwgreen commented 6 years ago

This now appears broken on Java 9, at least when running Eclipse:

Error while loading the java.base/9 module:
Failure to turn functional interface to Callable type:
Function get() not found in the binding of class java.util.function.Supplier
gavinking commented 6 years ago

@fwgreen could you please report that as a new issue, against Ceylon 1.4?