Search in sources :

Example 1 with Functions

use of org.eclipse.xtext.xbase.lib.Functions in project xtext-xtend by eclipse.

the class LinkingTest method testBug342848_01.

@Test
public void testBug342848_01() throws Exception {
    String fileAsText = "import org.eclipse.xtext.xbase.lib.Functions\n" + "class Clazz { def void method(Functions$Function0<Integer> f) { f.apply } }";
    XtendFile file = file(fileAsText, true);
    XtendFunction function = (XtendFunction) ((XtendClass) file.getXtendTypes().get(0)).getMembers().get(0);
    XtendParameter parameter = function.getParameters().get(0);
    String identifier = parameter.getParameterType().getIdentifier();
    assertEquals(Functions.Function0.class.getName() + "<java.lang.Integer>", identifier);
}
Also used : XtendFile(org.eclipse.xtend.core.xtend.XtendFile) XtendFunction(org.eclipse.xtend.core.xtend.XtendFunction) XtendParameter(org.eclipse.xtend.core.xtend.XtendParameter) XtendClass(org.eclipse.xtend.core.xtend.XtendClass) Functions(org.eclipse.xtext.xbase.lib.Functions) Test(org.junit.Test)

Aggregations

XtendClass (org.eclipse.xtend.core.xtend.XtendClass)1 XtendFile (org.eclipse.xtend.core.xtend.XtendFile)1 XtendFunction (org.eclipse.xtend.core.xtend.XtendFunction)1 XtendParameter (org.eclipse.xtend.core.xtend.XtendParameter)1 Functions (org.eclipse.xtext.xbase.lib.Functions)1 Test (org.junit.Test)1