use of org.eclipse.xtend.core.xtend.XtendClass in project xtext-xtend by eclipse.
the class JavaConverterTest method testConstructorCase.
@Test
public void testConstructorCase() throws Exception {
XtendClass clazz = this.toValidXtendClass("public class Clazz { public Clazz(){this(1);}public Clazz(int i){}}");
XtendMember _get = clazz.getMembers().get(0);
Assert.assertEquals(JvmVisibility.PUBLIC, ((XtendConstructor) _get).getVisibility());
XtendMember _get_1 = clazz.getMembers().get(1);
Assert.assertEquals(JvmVisibility.PUBLIC, ((XtendConstructor) _get_1).getVisibility());
}
use of org.eclipse.xtend.core.xtend.XtendClass in project xtext-xtend by eclipse.
the class JavaConverterTest method testSimpleInstanceOfCase.
@Test
public void testSimpleInstanceOfCase() throws Exception {
XtendClass xtendClazz = this.toValidXtendClass("class Test { void doStuff() { String x = null; if(!(x instanceof String)) x = \"\";}");
Assert.assertNotNull(xtendClazz);
}
use of org.eclipse.xtend.core.xtend.XtendClass 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.XtendClass in project xtext-xtend by eclipse.
the class JvmModelTests method testJvmTypeParameter_05.
@Test
public void testJvmTypeParameter_05() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("class Foo {");
_builder.newLine();
_builder.append("\t");
_builder.append("def < foo() {");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
XtendTypeDeclaration _head = IterableExtensions.<XtendTypeDeclaration>head(this.file(_builder.toString(), false, false).getXtendTypes());
final JvmGenericType clazz = this._iXtendJvmAssociations.getInferredType(((XtendClass) _head));
final JvmOperation member = IterableExtensions.<JvmOperation>head(Iterables.<JvmOperation>filter(clazz.getMembers(), JvmOperation.class));
Assert.assertNull(member);
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
use of org.eclipse.xtend.core.xtend.XtendClass in project xtext-xtend by eclipse.
the class JvmModelTests method testJvmTypeParameter_07.
@Test
public void testJvmTypeParameter_07() {
try {
StringConcatenation _builder = new StringConcatenation();
_builder.append("class Foo {");
_builder.newLine();
_builder.append("\t");
_builder.append("def <T> String foo() {");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
XtendTypeDeclaration _head = IterableExtensions.<XtendTypeDeclaration>head(this.file(_builder.toString(), false, false).getXtendTypes());
final JvmGenericType clazz = this._iXtendJvmAssociations.getInferredType(((XtendClass) _head));
final JvmOperation member = IterableExtensions.<JvmOperation>head(Iterables.<JvmOperation>filter(clazz.getMembers(), JvmOperation.class));
EList<JvmTypeParameter> _typeParameters = member.getTypeParameters();
String _plus = ("" + _typeParameters);
Assert.assertEquals(_plus, 1, member.getTypeParameters().size());
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
Aggregations