What's happening here is that Container.add()
's second parameter is declared to be an Object
, not a java.lang.String
so the Ceylon compiler doesn't realize there's a need to unbox the Ceylon String
. According to the signature of the method any Object
is acceptable, it's just that the implementation of the method decides it actually need a Java String.
You can use the javaString()
function from the ceylon.interop.java
module to convert a Ceylon String
to a Java String
in cases like this:
panel.add(JLabel("Hello world"), javaString(north));
panel.add(JButton("Click me"), javaString(center));