org.eclipse.xtext.xbase.annotations.validation.UnresolvedFeatureCallTypeAwareMessageProvider Java Examples

The following examples show how to use org.eclipse.xtext.xbase.annotations.validation.UnresolvedFeatureCallTypeAwareMessageProvider. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FeatureCallValidationTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testBrokenModel_11() throws Exception {
	XtendClass clazz = clazz("class C { def UnknownType m1() {} def void m2() { newArrayList(m1, m1).map[ it.unknownOperation ] }}");
	helper.assertNoError(clazz, IssueCodes.INCOMPATIBLE_TYPES);
	helper.assertNoError(clazz, Diagnostic.LINKING_DIAGNOSTIC,UnresolvedFeatureCallTypeAwareMessageProvider.FEATURE_CALL);
	helper.assertError(clazz, TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE, Diagnostic.LINKING_DIAGNOSTIC, "UnknownType cannot be resolved to a type.");
}
 
Example #2
Source File: XImportSectionValidationTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
public void assertFeatureCallError(final XtendFile file, final EClass objectType) {
  final Resource resource = file.eResource();
  final List<Issue> allIssues = this._validationTestHelper.validate(resource);
  final Function1<Issue, Boolean> _function = (Issue it) -> {
    EObject object = resource.getResourceSet().getEObject(it.getUriToProblem(), true);
    final boolean featureCall = ArrayExtensions.contains(it.getData(), UnresolvedFeatureCallTypeAwareMessageProvider.FEATURE_CALL);
    return Boolean.valueOf((((Objects.equal(it.getCode(), Diagnostic.LINKING_DIAGNOSTIC) && (it.getSeverity() == Severity.ERROR)) && 
      objectType.isInstance(object)) && featureCall));
  };
  final Iterable<Issue> match = IterableExtensions.<Issue>filter(allIssues, _function);
  boolean _isEmpty = IterableExtensions.isEmpty(match);
  if (_isEmpty) {
    Assert.fail("No Diagnostic.LINKING_DIAGNOSTIC issue with user data FEATURE_CALL found");
  }
}
 
Example #3
Source File: FeatureCallValidationTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testBrokenModel_12() throws Exception {
	XtendClass clazz = clazz("class C { def void m() { <UnknownType>newArrayList().map[ it.unknownOperation ] }}");
	helper.assertNoError(clazz, IssueCodes.INCOMPATIBLE_TYPES);
	helper.assertNoError(clazz, Diagnostic.LINKING_DIAGNOSTIC,UnresolvedFeatureCallTypeAwareMessageProvider.FEATURE_CALL);
	helper.assertError(clazz, TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE, Diagnostic.LINKING_DIAGNOSTIC, "UnknownType cannot be resolved to a type.");
}
 
Example #4
Source File: FeatureCallValidationTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testBrokenModel_10() throws Exception {
	XtendClass clazz = clazz("class C { def void m2() { #[ null as UnknownType ].head.unknownOperation }}");
	helper.assertNoError(clazz, IssueCodes.INCOMPATIBLE_TYPES);
	helper.assertNoError(clazz, Diagnostic.LINKING_DIAGNOSTIC,UnresolvedFeatureCallTypeAwareMessageProvider.FEATURE_CALL);
	helper.assertError(clazz, TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE, Diagnostic.LINKING_DIAGNOSTIC, "UnknownType cannot be resolved to a type.");
}
 
Example #5
Source File: FeatureCallValidationTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testBrokenModel_09() throws Exception {
	XtendClass clazz = clazz("class C { def void m2() { <UnknownType>newArrayList.head.unknownOperation }}");
	helper.assertNoError(clazz, IssueCodes.INCOMPATIBLE_TYPES);
	helper.assertNoError(clazz, Diagnostic.LINKING_DIAGNOSTIC,UnresolvedFeatureCallTypeAwareMessageProvider.FEATURE_CALL);
	helper.assertError(clazz, TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE, Diagnostic.LINKING_DIAGNOSTIC, "UnknownType cannot be resolved to a type.");
}
 
Example #6
Source File: FeatureCallValidationTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testBrokenModel_08() throws Exception {
	XtendClass clazz = clazz("class C { def UnknownType m1() {} def void m2() { m1.unknownOperation }}");
	helper.assertNoError(clazz, IssueCodes.INCOMPATIBLE_TYPES);
	helper.assertNoError(clazz, Diagnostic.LINKING_DIAGNOSTIC,UnresolvedFeatureCallTypeAwareMessageProvider.FEATURE_CALL);
	helper.assertError(clazz, TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE, Diagnostic.LINKING_DIAGNOSTIC, "UnknownType cannot be resolved to a type.");
}
 
Example #7
Source File: FeatureCallValidationTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testBrokenModel_06() throws Exception {
	XtendClass clazz = clazz("class C { UnknownType fieldName def void m() { fieldName.unknownOperation }}");
	helper.assertNoError(clazz, IssueCodes.INCOMPATIBLE_TYPES);
	helper.assertNoError(clazz, Diagnostic.LINKING_DIAGNOSTIC,UnresolvedFeatureCallTypeAwareMessageProvider.FEATURE_CALL);
	helper.assertError(clazz, TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE, Diagnostic.LINKING_DIAGNOSTIC, "UnknownType cannot be resolved to a type.");
}
 
Example #8
Source File: FeatureCallValidationTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testBrokenModel_05() throws Exception {
	XtendClass clazz = clazz("class C { @DoesNotExist(unknown='zonk') def void m() {}}");
	helper.assertNoError(clazz, IssueCodes.INCOMPATIBLE_TYPES);
	helper.assertError(clazz, XAnnotationsPackage.Literals.XANNOTATION, Diagnostic.LINKING_DIAGNOSTIC, "DoesNotExist cannot be resolved to an annotation type.");
	helper.assertNoError(clazz, Diagnostic.LINKING_DIAGNOSTIC,UnresolvedFeatureCallTypeAwareMessageProvider.FEATURE_CALL);
}
 
Example #9
Source File: FeatureCallValidationTest.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
@Test
public void testBrokenModel_04() throws Exception {
	XtendClass clazz = clazz("class C { def void m() { DoesNotExist::unknown }}");
	helper.assertNoError(clazz, IssueCodes.INCOMPATIBLE_TYPES);
	helper.assertError(clazz, XbasePackage.Literals.XFEATURE_CALL, Diagnostic.LINKING_DIAGNOSTIC, "DoesNotExist cannot be resolved to a type.");
	helper.assertNoError(clazz, Diagnostic.LINKING_DIAGNOSTIC,UnresolvedFeatureCallTypeAwareMessageProvider.FEATURE_CALL);
}
 
Example #10
Source File: QuickfixTestBuilder.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
public QuickfixTestBuilder assertTypeLiteralLinkingIssue() {
  QuickfixTestBuilder _xblockexpression = null;
  {
    final Function1<Issue, Boolean> _function = (Issue it) -> {
      return Boolean.valueOf((Objects.equal(it.getCode(), Diagnostic.LINKING_DIAGNOSTIC) && 
        ArrayExtensions.contains(it.getData(), UnresolvedFeatureCallTypeAwareMessageProvider.TYPE_LITERAL)));
    };
    Assert.assertTrue(IterableExtensions.<Issue>exists(this.getIssuesAtCaret(), _function));
    _xblockexpression = this;
  }
  return _xblockexpression;
}
 
Example #11
Source File: QuickfixTestBuilder.java    From xtext-xtend with Eclipse Public License 2.0 5 votes vote down vote up
public QuickfixTestBuilder assertFeatureCallLinkingIssue() {
  QuickfixTestBuilder _xblockexpression = null;
  {
    final Function1<Issue, Boolean> _function = (Issue it) -> {
      return Boolean.valueOf((Objects.equal(it.getCode(), Diagnostic.LINKING_DIAGNOSTIC) && 
        ArrayExtensions.contains(it.getData(), UnresolvedFeatureCallTypeAwareMessageProvider.FEATURE_CALL)));
    };
    Assert.assertTrue(IterableExtensions.<Issue>exists(this.getIssuesAtCaret(), _function));
    _xblockexpression = this;
  }
  return _xblockexpression;
}
 
Example #12
Source File: JavaTypeQuickfixes.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected boolean isUseJavaSearch(EReference unresolvedReference, Issue issue) {
	if (isConstructorReference(unresolvedReference))
		return true;
	if (isTypeReference(unresolvedReference))
		return true;
	if (Arrays.contains(issue.getData(), UnresolvedFeatureCallTypeAwareMessageProvider.TYPE_LITERAL)) {
		return true;
	}
	return false;
}
 
Example #13
Source File: FeatureCallValidationTest.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@Test
public void testBrokenModel_01() throws Exception {
	XtendClass clazz = clazz("class C { def m(DoesNotExist d) { d.unknown.unknown }}");
	helper.assertNoError(clazz, Diagnostic.LINKING_DIAGNOSTIC,UnresolvedFeatureCallTypeAwareMessageProvider.FEATURE_CALL);
}
 
Example #14
Source File: DefaultXbaseRuntimeModule.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
/**
 * @since 2.9
 */
public Class<? extends ILinkingDiagnosticMessageProvider> bindILinkingDiagnosticMessageProvider() {
	return UnresolvedFeatureCallTypeAwareMessageProvider.class;
}
 
Example #15
Source File: FeatureCallValidationTest.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@Test
public void testInvalidPropertySugarBug403564_01() throws Exception {
	XtendClass clazz = clazz("class C { def String getSomething() { return something }}");
	helper.assertNoError(clazz, Diagnostic.LINKING_DIAGNOSTIC,UnresolvedFeatureCallTypeAwareMessageProvider.FEATURE_CALL);
}
 
Example #16
Source File: FeatureCallValidationTest.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@Test
public void testInvalidPropertySugarBug403564_02() throws Exception {
	XtendClass clazz = clazz("class C { def String isSomething() { return something }}");
	helper.assertNoError(clazz, Diagnostic.LINKING_DIAGNOSTIC,UnresolvedFeatureCallTypeAwareMessageProvider.FEATURE_CALL);
}
 
Example #17
Source File: FeatureCallValidationTest.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@Test
public void testInvalidPropertySugarBug403564_03() throws Exception {
	XtendClass clazz = clazz("class C { def void setSomething(String s) { something = '' }}");
	helper.assertNoError(clazz, Diagnostic.LINKING_DIAGNOSTIC,UnresolvedFeatureCallTypeAwareMessageProvider.FEATURE_CALL);
}
 
Example #18
Source File: FeatureCallValidationTest.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@Test
public void testInvalidPropertySugarBug403564_05() throws Exception {
	XtendClass clazz = clazz("class C { def String getURI() { return URI }}");
	helper.assertNoError(clazz, Diagnostic.LINKING_DIAGNOSTIC,UnresolvedFeatureCallTypeAwareMessageProvider.FEATURE_CALL);
}
 
Example #19
Source File: FeatureCallValidationTest.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@Test
public void testInvalidPropertySugarBug403564_06() throws Exception {
	XtendClass clazz = clazz("class C { def boolean isURI() { return URI }}");
	helper.assertNoError(clazz, Diagnostic.LINKING_DIAGNOSTIC,UnresolvedFeatureCallTypeAwareMessageProvider.FEATURE_CALL);
}
 
Example #20
Source File: FeatureCallValidationTest.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@Test
public void testInvalidPropertySugarBug403564_07() throws Exception {
	XtendClass clazz = clazz("class C { def void setURI(String s) { URI = '' }}");
	helper.assertNoError(clazz, Diagnostic.LINKING_DIAGNOSTIC,UnresolvedFeatureCallTypeAwareMessageProvider.FEATURE_CALL);
}
 
Example #21
Source File: FeatureCallValidationTest.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@Test
public void testInvalidPropertySugarBug403564_10() throws Exception {
	XtendClass clazz = clazz("class C { def String getX() { return x }}");
	helper.assertNoError(clazz, Diagnostic.LINKING_DIAGNOSTIC,UnresolvedFeatureCallTypeAwareMessageProvider.FEATURE_CALL);
}
 
Example #22
Source File: FeatureCallValidationTest.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@Test
public void testInvalidPropertySugarBug403564_11() throws Exception {
	XtendClass clazz = clazz("class C { def boolean isX() { return x }}");
	helper.assertNoError(clazz, Diagnostic.LINKING_DIAGNOSTIC,UnresolvedFeatureCallTypeAwareMessageProvider.FEATURE_CALL);
}
 
Example #23
Source File: FeatureCallValidationTest.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@Test
public void testInvalidPropertySugarBug403564_12() throws Exception {
	XtendClass clazz = clazz("class C { def void setX(String s) { x = '' }}");
	helper.assertNoError(clazz, Diagnostic.LINKING_DIAGNOSTIC,UnresolvedFeatureCallTypeAwareMessageProvider.FEATURE_CALL);
}