Community
Participate
Working Groups
I cannot call a static java method from an Xtend/Xbase. Double xxx() { return Double.valueOf("1"); } does not work, but import static extension java.lang.Double.* ... Double xxx() { return valueOf("1"); } does work but this might be ambigous in some cases
It is not ambiguous, since the precedence of scopes is well defined. Though it shadows a similar named member on 'this' (which can be reached using 'this' explicitly). However, the mentioned feature is planned to be added. But we won't use the Java syntax since it would harm the implementation too much. Instead we use a double colon '::' like in Xtend 1. So it would be 'Double::valueOf("1")' instead.
with ambigous i meant that with imports something like import static extension java.lang.Double.* import static extension java.lang.Integer.* might be a problem cause both offer a valueOf with String as Parameter
In that case they shouldn't be put on the scope at all (future plan). But for the sake of simplicity in the implementation there is currently a defined precedence. So the order of static imports matters.
Xbase 2.0M7 supports Double::valueOf('') as well as org::mypack::EnumType::LITERAL
I'll file a new ticket for this aspect. (In reply to comment #3) > In that case they shouldn't be put on the scope at all (future plan).
Closing all bugs that were set to RESOLVED before Neon.0