use of org.eclipse.xtext.common.types.JvmIdentifiableElement in project xtext-xtend by eclipse.
the class NonOverridableTypesProviderTest method assertTypeInScope.
protected void assertTypeInScope(final String typeName, final JvmMember context) {
final JvmIdentifiableElement visibleType = this.typesFromHierarchy.getVisibleType(context, typeName);
Assert.assertNotNull(visibleType);
Assert.assertTrue((visibleType instanceof JvmType));
}
use of org.eclipse.xtext.common.types.JvmIdentifiableElement in project xtext-xtend by eclipse.
the class AssignmentLinkingTest method assertImplicitReceiver.
protected void assertImplicitReceiver(String identifier, XAssignment assignment) {
assertTrue("assignment.implicitReceiver instanceof XFeatureCall", assignment.getImplicitReceiver() instanceof XAbstractFeatureCall);
XAbstractFeatureCall implicitReceiver = (XAbstractFeatureCall) assignment.getImplicitReceiver();
JvmIdentifiableElement linked = implicitReceiver.getFeature();
assertFalse("is resolved", linked.eIsProxy());
assertEquals(identifier, linked.getIdentifier());
}
use of org.eclipse.xtext.common.types.JvmIdentifiableElement in project xtext-xtend by eclipse.
the class AssignmentLinkingTest method assertLinksTo.
@SuppressWarnings("deprecation")
protected void assertLinksTo(String identifier, EClass type, XAssignment featureCall, boolean withIssues) {
assertNotNull("feature is available", featureCall.getFeature());
JvmIdentifiableElement linked = featureCall.getFeature();
assertFalse("is resolved", linked.eIsProxy());
assertEquals(identifier, linked.getIdentifier());
assertTrue(type.isInstance(linked));
if (withIssues)
assertNotNull("Expected issues", featureCall.getInvalidFeatureIssueCode());
else {
assertNull(featureCall.getInvalidFeatureIssueCode(), featureCall.getInvalidFeatureIssueCode());
validator.assertNoErrors(featureCall);
}
}
use of org.eclipse.xtext.common.types.JvmIdentifiableElement in project xtext-xtend by eclipse.
the class LinkingTest method testOverloadedWithLambdaArgument_01.
@Test
public void testOverloadedWithLambdaArgument_01() throws Exception {
XtendFile file = file("import static extension com.google.common.collect.Iterables.*" + "abstract class C {\n" + " def void m(Iterable<String> iter) {\n" + " iter.filter [ it != null ]\n" + " }\n" + "}\n");
XtendClass c = (XtendClass) file.getXtendTypes().get(0);
XtendFunction m = (XtendFunction) c.getMembers().get(0);
XBlockExpression body = (XBlockExpression) m.getExpression();
XMemberFeatureCall featureCall = (XMemberFeatureCall) body.getExpressions().get(0);
JvmIdentifiableElement method = featureCall.getFeature();
assertEquals("com.google.common.collect.Iterables.filter(java.lang.Iterable,com.google.common.base.Predicate)", method.getIdentifier());
}
use of org.eclipse.xtext.common.types.JvmIdentifiableElement in project xtext-xtend by eclipse.
the class LinkingTest method testQualifiedSuper.
@Test
public void testQualifiedSuper() throws Exception {
XtendFile file = file("class B<T> { def T m1() {} }\n" + "class C extends B<String> {\n" + " def void m2() { C.super.m1.subSequence(1, 1) } \n" + "}");
XtendClass c = (XtendClass) file.getXtendTypes().get(1);
XtendFunction n = (XtendFunction) c.getMembers().get(0);
XBlockExpression body = (XBlockExpression) n.getExpression();
XMemberFeatureCall featureCall = (XMemberFeatureCall) body.getExpressions().get(0);
JvmIdentifiableElement feature = featureCall.getFeature();
assertEquals("java.lang.String.subSequence(int,int)", feature.getIdentifier());
}
Aggregations