Search in sources :

Example 96 with XtendFile

use of org.eclipse.xtend.core.xtend.XtendFile in project xtext-xtend by eclipse.

the class ValidationBug464563Test method testJvmOperation_05.

@Test
public void testJvmOperation_05() {
    try {
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("package mypackage");
        _builder.newLine();
        _builder.newLine();
        _builder.append("import java.util.List");
        _builder.newLine();
        _builder.newLine();
        _builder.append("class Foo {");
        _builder.newLine();
        _builder.newLine();
        _builder.append("\t");
        _builder.append("def void foo(List<Unknown[]> arg0) {");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("}");
        _builder.newLine();
        _builder.newLine();
        _builder.append("\t");
        _builder.append("def void bar() {");
        _builder.newLine();
        _builder.append("\t\t");
        _builder.append("foo(notify)");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("}");
        _builder.newLine();
        _builder.newLine();
        _builder.append("}");
        _builder.newLine();
        final XtendFile file = this._parseHelper.parse(_builder);
        this._validationTestHelper.assertError(file, XbasePackage.Literals.XFEATURE_CALL, IssueCodes.REFER_INVALID_TYPES, "The method foo(List<Unknown[]>) from the type Foo refers to the missing type Unknown");
    } catch (Throwable _e) {
        throw Exceptions.sneakyThrow(_e);
    }
}
Also used : XtendFile(org.eclipse.xtend.core.xtend.XtendFile) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Test(org.junit.Test)

Example 97 with XtendFile

use of org.eclipse.xtend.core.xtend.XtendFile in project xtext-xtend by eclipse.

the class ValidationBug464563Test method testJvmOperation_04.

@Test
public void testJvmOperation_04() {
    try {
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("package mypackage");
        _builder.newLine();
        _builder.newLine();
        _builder.append("import java.util.List");
        _builder.newLine();
        _builder.newLine();
        _builder.append("class Foo {");
        _builder.newLine();
        _builder.newLine();
        _builder.append("\t");
        _builder.append("def Object foo(Object arg0, List<Object> arg1) throws Unknown4 {");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("}");
        _builder.newLine();
        _builder.newLine();
        _builder.append("\t");
        _builder.append("def void bar() {");
        _builder.newLine();
        _builder.append("\t\t");
        _builder.append("foo(null, null) ");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("}");
        _builder.newLine();
        _builder.newLine();
        _builder.append("}");
        _builder.newLine();
        final XtendFile file = this._parseHelper.parse(_builder);
        this._validationTestHelper.assertError(file, XbasePackage.Literals.XFEATURE_CALL, IssueCodes.REFER_INVALID_TYPES, "The method foo(Object, List<Object>) from the type Foo refers to the missing type Unknown4");
    } catch (Throwable _e) {
        throw Exceptions.sneakyThrow(_e);
    }
}
Also used : XtendFile(org.eclipse.xtend.core.xtend.XtendFile) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Test(org.junit.Test)

Example 98 with XtendFile

use of org.eclipse.xtend.core.xtend.XtendFile in project xtext-xtend by eclipse.

the class ValidationBug464563Test method testJvmConstructor_04.

@Test
public void testJvmConstructor_04() {
    try {
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("package mypackage");
        _builder.newLine();
        _builder.newLine();
        _builder.append("import java.util.List");
        _builder.newLine();
        _builder.newLine();
        _builder.append("class Foo {");
        _builder.newLine();
        _builder.newLine();
        _builder.append("\t");
        _builder.append("new (List<Unknown[]> arg0) {");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("}");
        _builder.newLine();
        _builder.newLine();
        _builder.append("\t");
        _builder.append("def void bar() {");
        _builder.newLine();
        _builder.append("\t\t");
        _builder.append("new Foo(notify)");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("}");
        _builder.newLine();
        _builder.newLine();
        _builder.append("}");
        _builder.newLine();
        final XtendFile file = this._parseHelper.parse(_builder);
        this._validationTestHelper.assertError(file, XbasePackage.Literals.XCONSTRUCTOR_CALL, IssueCodes.REFER_INVALID_TYPES, "The constructor Foo(List<Unknown[]>) refers to the missing type Unknown");
    } catch (Throwable _e) {
        throw Exceptions.sneakyThrow(_e);
    }
}
Also used : XtendFile(org.eclipse.xtend.core.xtend.XtendFile) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Test(org.junit.Test)

Example 99 with XtendFile

use of org.eclipse.xtend.core.xtend.XtendFile in project xtext-xtend by eclipse.

the class ValidationBug464563Test method testJvmConstructor_02.

@Test
public void testJvmConstructor_02() {
    try {
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("package mypackage");
        _builder.newLine();
        _builder.newLine();
        _builder.append("import java.util.List");
        _builder.newLine();
        _builder.newLine();
        _builder.append("class Foo {");
        _builder.newLine();
        _builder.newLine();
        _builder.append("\t");
        _builder.append("new (Object arg0, List<Unknown2> arg1) throws Unknown3 {");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("}");
        _builder.newLine();
        _builder.newLine();
        _builder.append("\t");
        _builder.append("def void bar() {");
        _builder.newLine();
        _builder.append("\t\t");
        _builder.append("new Foo(null, null) ");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("}");
        _builder.newLine();
        _builder.newLine();
        _builder.append("}");
        _builder.newLine();
        final XtendFile file = this._parseHelper.parse(_builder);
        this._validationTestHelper.assertError(file, XbasePackage.Literals.XCONSTRUCTOR_CALL, IssueCodes.REFER_INVALID_TYPES, "The constructor Foo(Object, List<Unknown2>) refers to the missing type Unknown2");
        this._validationTestHelper.assertNoErrors(file, XbasePackage.Literals.XCONSTRUCTOR_CALL, IssueCodes.REFER_INVALID_TYPES, "The constructor Foo(Object, List<Unknown2>) refers to the missing type Unknown3");
    } catch (Throwable _e) {
        throw Exceptions.sneakyThrow(_e);
    }
}
Also used : XtendFile(org.eclipse.xtend.core.xtend.XtendFile) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Test(org.junit.Test)

Example 100 with XtendFile

use of org.eclipse.xtend.core.xtend.XtendFile in project xtext-xtend by eclipse.

the class ValidationBug464563Test method testJvmConstructor_07.

@Test
public void testJvmConstructor_07() {
    try {
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("package mypackage");
        _builder.newLine();
        _builder.newLine();
        _builder.append("import java.util.List");
        _builder.newLine();
        _builder.newLine();
        _builder.append("class Foo {");
        _builder.newLine();
        _builder.newLine();
        _builder.append("\t");
        _builder.append("new <T extends Unknown & Unknown2> (List<T> arg0) {");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("}");
        _builder.newLine();
        _builder.newLine();
        _builder.append("\t");
        _builder.append("def void bar() {");
        _builder.newLine();
        _builder.append("\t\t");
        _builder.append("new Foo(notify)");
        _builder.newLine();
        _builder.append("\t");
        _builder.append("}");
        _builder.newLine();
        _builder.newLine();
        _builder.append("}");
        _builder.newLine();
        final XtendFile file = this._parseHelper.parse(_builder);
        this._validationTestHelper.assertError(file, XbasePackage.Literals.XCONSTRUCTOR_CALL, IssueCodes.REFER_INVALID_TYPES, "The constructor Foo(List<T>) refers to the missing type Unknown");
    } catch (Throwable _e) {
        throw Exceptions.sneakyThrow(_e);
    }
}
Also used : XtendFile(org.eclipse.xtend.core.xtend.XtendFile) StringConcatenation(org.eclipse.xtend2.lib.StringConcatenation) Test(org.junit.Test)

Aggregations

XtendFile (org.eclipse.xtend.core.xtend.XtendFile)855 Test (org.junit.Test)782 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)372 XtendClass (org.eclipse.xtend.core.xtend.XtendClass)229 XtendFunction (org.eclipse.xtend.core.xtend.XtendFunction)182 XBlockExpression (org.eclipse.xtext.xbase.XBlockExpression)126 XtendMember (org.eclipse.xtend.core.xtend.XtendMember)119 XtendTypeDeclaration (org.eclipse.xtend.core.xtend.XtendTypeDeclaration)98 XExpression (org.eclipse.xtext.xbase.XExpression)82 JvmGenericType (org.eclipse.xtext.common.types.JvmGenericType)64 JvmIdentifiableElement (org.eclipse.xtext.common.types.JvmIdentifiableElement)62 JvmOperation (org.eclipse.xtext.common.types.JvmOperation)62 EObject (org.eclipse.emf.ecore.EObject)50 Resource (org.eclipse.emf.ecore.resource.Resource)47 XMemberFeatureCall (org.eclipse.xtext.xbase.XMemberFeatureCall)46 XAbstractFeatureCall (org.eclipse.xtext.xbase.XAbstractFeatureCall)42 XtextResource (org.eclipse.xtext.resource.XtextResource)34 XFeatureCall (org.eclipse.xtext.xbase.XFeatureCall)29 XtendField (org.eclipse.xtend.core.xtend.XtendField)23 IResolvedTypes (org.eclipse.xtext.xbase.typesystem.IResolvedTypes)21