eclipse-archived/ceylon

Mechanism for transforming Functional Interfaces into Callables appears broken

Opened this issue · 4 comments

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

Current workaround is to rewrite expressions like...

value replacements = CompletableFuture.supplyAsync(() =>
    { 
      "tHa[Nt]" -> "<4>", 
      "aND|caN|Ha[DS]|WaS" -> "<3>", 
      "a[NSt]|BY" -> "<2>", 
      "<[^>]*>" -> "|", 
      "\\|[^|][^|]*\\|" -> "-"
    }.fold(sequence)((buffer, key->val) => regex(key, true).replace(buffer, val))
);

to...

object supplier satisfies Supplier<String> { get() => 
    { 
      "tHa[Nt]" -> "<4>", 
      "aND|caN|Ha[DS]|WaS" -> "<3>", 
      "a[NSt]|BY" -> "<2>", 
      "<[^>]*>" -> "|", 
      "\\|[^|][^|]*\\|" -> "-"
    }.fold(sequence)((buffer, key->val) => regex(key, true).replace(buffer, val)); 
}
    
value replacements = CompletableFuture.supplyAsync(supplier);
xkr47 commented

(typo in subject)

@xkr47 Thanks!

@fwgreen it appears to be working fine for me on Java 8. So it seems to me that this issue must be specific to Java 9. Can you please help confirm that? Thanks.

@gavinking Sorry for the late response (I missed the email alert). You're correct about this not being a problem in Java 8. I only stumbled on this by accident after changing my default JDK in one Eclipse JDT project and having it magically apply to all projects.