use of org.eclipse.xtend.core.xtend.XtendField in project xtext-xtend by eclipse.
the class JavaConverterTest method testRichStringSpecialCase2.
@Test
public void testRichStringSpecialCase2() throws Exception {
XtendClass clazz = this.toValidXtendClass((("class Z { String richTxt = \"test\" + \"\'\'\'�FOR a: \'123\'.toCharArray SEPARATOR \',\\n \\t\'�\\n" + "a\\n") + "�ENDFOR�\'\'\'\";}"));
Assert.assertNotNull(clazz);
XtendMember _get = clazz.getMembers().get(0);
XtendField xtendMember = ((XtendField) _get);
Assert.assertEquals("richTxt", xtendMember.getName());
XExpression _initialValue = xtendMember.getInitialValue();
Assert.assertFalse((_initialValue instanceof RichString));
}
use of org.eclipse.xtend.core.xtend.XtendField in project xtext-xtend by eclipse.
the class UnicodeEscapeLinkingTest method testIdentifiersWithUnicode_01.
@Test
public void testIdentifiersWithUnicode_01() throws Exception {
XtendClass clazz = clazz("class A {\n" + " String a\n" + " def m() {\n" + " \\u0061\n" + " }\n" + "}");
XFeatureCall call = (XFeatureCall) ((XBlockExpression) ((XtendFunction) clazz.getMembers().get(1)).getExpression()).getExpressions().get(0);
JvmIdentifiableElement feature = call.getFeature();
assertFalse(feature.eIsProxy());
assertSame(feature, associator.getJvmField((XtendField) clazz.getMembers().get(0)));
}
use of org.eclipse.xtend.core.xtend.XtendField in project xtext-xtend by eclipse.
the class ParserTest method testExtensionOnLambdaParameter_01.
@Test
public void testExtensionOnLambdaParameter_01() throws Exception {
XtendClass clazz = clazz("class Foo { val x = [ extension String a, String b | 0 ] }");
assertEquals(1, clazz.getMembers().size());
XtendField f = (XtendField) clazz.getMembers().get(0);
XClosure initializer = (XClosure) f.getInitialValue();
List<JvmFormalParameter> parameters = initializer.getDeclaredFormalParameters();
assertEquals(2, parameters.size());
XtendFormalParameter firstParameter = (XtendFormalParameter) parameters.get(0);
assertTrue(firstParameter.isExtension());
XtendFormalParameter secondParameter = (XtendFormalParameter) parameters.get(1);
assertFalse(secondParameter.isExtension());
}
use of org.eclipse.xtend.core.xtend.XtendField in project xtext-xtend by eclipse.
the class LinkingTest method testRelativeImports.
@Test
public void testRelativeImports() throws Exception {
XtendFile file = file("package annotation class X {\n" + " Annotation failed\n" + " java.lang.annotation.Annotation success\n" + " reflect.AccessibleObject failedToo\n" + " Thread.State anotherSuccess\n" + " Thread$State thirdSuccess\n" + "}");
XtendClass xClass = (XtendClass) file.getXtendTypes().get(0);
XtendField failed = (XtendField) xClass.getMembers().get(0);
assertTrue("Annotation", failed.getType().getType().eIsProxy());
XtendField success = (XtendField) xClass.getMembers().get(1);
assertFalse("java.lang.annotation", success.getType().getType().eIsProxy());
XtendField failedToo = (XtendField) xClass.getMembers().get(2);
assertTrue("reflect.AccessibleObject", failedToo.getType().getType().eIsProxy());
XtendField anotherSuccess = (XtendField) xClass.getMembers().get(3);
assertFalse("Thread.State", anotherSuccess.getType().getType().eIsProxy());
XtendField thirdSuccess = (XtendField) xClass.getMembers().get(4);
assertFalse("Thread$State", thirdSuccess.getType().getType().eIsProxy());
}
use of org.eclipse.xtend.core.xtend.XtendField in project xtext-xtend by eclipse.
the class CodeStyleValidationTest method testInferedApiField01.
@Test
public void testInferedApiField01() throws Exception {
XtendField field = field("public val f = \"foo\" ");
helper.assertError(field, XTEND_FIELD, API_TYPE_INFERENCE);
}
Aggregations