It's not supported out-of-the box. You can add support by declaring a Java class like this :
public class ArrayLiterals2 {
@Inline("new int[$1][$2]")
public static int[][] intArray(int outerSize, int innerSize) {
throw new UnsupportedOperationException();
}
}
and import it like this in Xtend :
import static extension my.lib.ArrayLiterals2.*
…
val int[][] arr = intArray(10,20)
@Inline tells the compiler to replace any calls to the annotated method with the to-be-inlined Java expression (the 'value' template).
Note that the @Inlined is not stable API (flagged as @Beta) and will likely be removed once Xtend has support for more powerful method-macros.
What's Xtend's syntax equivalent for Java's multi-dimensional array syntax:
e.g.
Type[][] matrixData = new Type[Dim1][Dim2];?
NewArrayOfSize() is only set up for single dimensions.
--
You received this message because you are subscribed to the Google Groups "Xtend Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to xtend-lang+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.