use of org.eclipse.xtext.common.types.JvmIdentifiableElement in project xtext-xtend by eclipse.
the class LinkingTest method testOverloadedMethods_12.
@Test
public void testOverloadedMethods_12() throws Exception {
XtendFile file = file("import java.util.Collection\n" + "class X {\n" + " def <T> foo(Collection<? super T> collection, Collection<T> elements) {\n" + " collection.addAll(elements)\n" + " }\n" + "}");
XtendClass clazz = (XtendClass) file.getXtendTypes().get(0);
XtendFunction func = (XtendFunction) clazz.getMembers().get(0);
XMemberFeatureCall featureCall = (XMemberFeatureCall) ((XBlockExpression) func.getExpression()).getExpressions().get(0);
JvmIdentifiableElement addAll = featureCall.getFeature();
assertNotNull(addAll);
assertFalse(addAll.eIsProxy());
assertEquals("java.util.Collection.addAll(java.util.Collection)", addAll.getIdentifier());
}
use of org.eclipse.xtext.common.types.JvmIdentifiableElement in project xtext-xtend by eclipse.
the class LinkingTest method testOverloadedMethods_07.
@Test
public void testOverloadedMethods_07() throws Exception {
XtendFile file = file("import java.util.List\n" + "class X {\n" + " def foo() {\n" + " var List<String> strings = null\n" + " var testdata.OverloadedMethods<String> receiver = null\n" + " receiver.overloaded2(strings, strings)\n" + " }\n" + "}");
XtendClass clazz = (XtendClass) file.getXtendTypes().get(0);
XtendFunction func = (XtendFunction) clazz.getMembers().get(0);
XMemberFeatureCall featureCall = (XMemberFeatureCall) ((XBlockExpression) func.getExpression()).getExpressions().get(2);
JvmIdentifiableElement overloaded = featureCall.getFeature();
assertNotNull(overloaded);
assertFalse(overloaded.eIsProxy());
assertEquals("testdata.OverloadedMethods.overloaded2(java.util.List,java.util.List)", overloaded.getIdentifier());
}
use of org.eclipse.xtext.common.types.JvmIdentifiableElement in project xtext-xtend by eclipse.
the class LinkingTest method testBug403580_02.
@Test
public void testBug403580_02() throws Exception {
XtendFile file = file("abstract class C {\n" + " def void m() {\n" + " overloaded [ String s | s.length ]\n" + " }\n" + " def void overloaded(Object o)" + " def <T> void overloaded(Comparable<T> c)" + "}\n");
XtendClass c = (XtendClass) file.getXtendTypes().get(0);
XtendFunction m = (XtendFunction) c.getMembers().get(0);
XBlockExpression body = (XBlockExpression) m.getExpression();
XFeatureCall featureCall = (XFeatureCall) body.getExpressions().get(0);
JvmIdentifiableElement method = featureCall.getFeature();
assertEquals("C.overloaded(java.lang.Comparable)", method.getIdentifier());
}
use of org.eclipse.xtext.common.types.JvmIdentifiableElement in project xtext-xtend by eclipse.
the class LinkingTest method testOverloadedMethods_06.
@Test
public void testOverloadedMethods_06() throws Exception {
XtendFile file = file("import java.util.List\n" + "class X {\n" + " def foo() {\n" + " var List<CharSequence> chars = null\n" + " var List<String> strings = null\n" + " var testdata.OverloadedMethods<CharSequence> receiver = null\n" + " receiver.overloaded2(strings, chars)\n" + " }\n" + "}");
XtendClass clazz = (XtendClass) file.getXtendTypes().get(0);
XtendFunction func = (XtendFunction) clazz.getMembers().get(0);
XMemberFeatureCall featureCall = (XMemberFeatureCall) ((XBlockExpression) func.getExpression()).getExpressions().get(3);
JvmIdentifiableElement overloaded = featureCall.getFeature();
assertNotNull(overloaded);
assertFalse(overloaded.eIsProxy());
assertEquals("testdata.OverloadedMethods.overloaded2(java.lang.Iterable,java.util.Collection)", overloaded.getIdentifier());
}
use of org.eclipse.xtext.common.types.JvmIdentifiableElement in project xtext-xtend by eclipse.
the class LinkingTest method testQualifiedThisOuter.
@Test
public void testQualifiedThisOuter() throws Exception {
XtendFile file = file("class C {\n" + " def void m() { new Object { def m3() { C.this.m2() } } }\n" + " def void m2() {}\n" + "}");
XtendClass c = (XtendClass) file.getXtendTypes().get(0);
XtendFunction m = (XtendFunction) c.getMembers().get(0);
XBlockExpression outer = (XBlockExpression) m.getExpression();
AnonymousClass anonymousClass = (AnonymousClass) outer.getExpressions().get(0);
XtendFunction m3 = (XtendFunction) anonymousClass.getMembers().get(0);
XBlockExpression body = (XBlockExpression) m3.getExpression();
XMemberFeatureCall featureCall = (XMemberFeatureCall) body.getExpressions().get(0);
JvmIdentifiableElement feature = featureCall.getFeature();
assertEquals("C.m2()", feature.getIdentifier());
}
Aggregations