use of org.eclipse.xtext.common.types.JvmField in project xtext-xtend by eclipse.
the class InferredJvmModelTest method testNameClashWithCreateExtension_02.
@Test
public void testNameClashWithCreateExtension_02() throws Exception {
XtendFile xtendFile = file("package foo class Foo { def create new String() s(String x) { '' } def create new String() s(Object x) { '' }}");
JvmGenericType inferredType = getInferredType(xtendFile);
JvmField cacheVar0 = (JvmField) inferredType.getMembers().get(2);
assertEquals("_createCache_s", cacheVar0.getSimpleName());
JvmOperation initializer0 = (JvmOperation) inferredType.getMembers().get(3);
assertEquals("_init_s", initializer0.getSimpleName());
JvmField cacheVar1 = (JvmField) inferredType.getMembers().get(5);
assertEquals("_createCache_s_1", cacheVar1.getSimpleName());
JvmOperation initializer1 = (JvmOperation) inferredType.getMembers().get(6);
assertEquals("_init_s_1", initializer1.getSimpleName());
}
use of org.eclipse.xtext.common.types.JvmField in project xtext-xtend by eclipse.
the class InferredJvmModelTest method testXtendField_00.
@Test
public void testXtendField_00() throws Exception {
XtendFile xtendFile = file("class Foo { @Inject String string }");
JvmGenericType type = getInferredType(xtendFile);
Iterable<JvmField> iterable = type.getDeclaredFields();
JvmField next = iterable.iterator().next();
assertEquals("string", next.getSimpleName());
assertEquals(JvmVisibility.PRIVATE, next.getVisibility());
assertEquals("java.lang.String", next.getType().getIdentifier());
for (JvmMember member : type.getMembers()) {
if (member instanceof JvmExecutable) {
assertEquals(JvmVisibility.PUBLIC, member.getVisibility());
} else {
assertEquals(JvmVisibility.PRIVATE, member.getVisibility());
}
}
}
use of org.eclipse.xtext.common.types.JvmField in project xtext-xtend by eclipse.
the class InferredJvmModelTest method testNameClashWithCreateExtension_03.
@Test
public void testNameClashWithCreateExtension_03() throws Exception {
XtendFile xtendFile = file("package foo class Foo { def create new String() s(String x) { '' } def create new String() s(Object x, Object y) { '' }}");
JvmGenericType inferredType = getInferredType(xtendFile);
JvmField cacheVar0 = (JvmField) inferredType.getMembers().get(2);
assertEquals("_createCache_s", cacheVar0.getSimpleName());
JvmOperation initializer0 = (JvmOperation) inferredType.getMembers().get(3);
assertEquals("_init_s", initializer0.getSimpleName());
JvmField cacheVar1 = (JvmField) inferredType.getMembers().get(5);
assertEquals("_createCache_s_1", cacheVar1.getSimpleName());
JvmOperation initializer1 = (JvmOperation) inferredType.getMembers().get(6);
assertEquals("_init_s", initializer1.getSimpleName());
}
use of org.eclipse.xtext.common.types.JvmField in project xtext-xtend by eclipse.
the class InferredJvmModelTest method testNameClashWithCreateExtension_01.
@Test
public void testNameClashWithCreateExtension_01() throws Exception {
XtendFile xtendFile = file("package foo class Foo { def create new String() s(String x) { '' } String _init_s }");
JvmGenericType inferredType = getInferredType(xtendFile);
JvmField cacheVar = (JvmField) inferredType.getMembers().get(2);
assertEquals("_createCache_s", cacheVar.getSimpleName());
JvmOperation initializer = (JvmOperation) inferredType.getMembers().get(3);
assertEquals("_init_s_1", initializer.getSimpleName());
JvmField field = (JvmField) inferredType.getMembers().get(4);
assertEquals("_init_s", field.getSimpleName());
}
use of org.eclipse.xtext.common.types.JvmField in project xtext-xtend by eclipse.
the class InferredJvmModelTest method testNameClashWithAnonymousExtension_00.
@Test
public void testNameClashWithAnonymousExtension_00() throws Exception {
XtendFile xtendFile = file("package foo import com.google.inject.Inject class Foo { @Inject extension String String _string }");
JvmGenericType inferredType = getInferredType(xtendFile);
JvmField extension = (JvmField) inferredType.getMembers().get(1);
assertEquals("_string_1", extension.getSimpleName());
JvmField field = (JvmField) inferredType.getMembers().get(2);
assertEquals("_string", field.getSimpleName());
}
Aggregations