Search in sources :

Example 71 with XtendInterface

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

the class OverrideValidationTest method testInterfaceOverrideReturnType_4.

@Test
public void testInterfaceOverrideReturnType_4() throws Exception {
    XtendInterface xtendInterface = interfaze("interface Foo extends test.GenericSuperTypeInterface<Integer> {  " + "override String getComparable()" + "}");
    helper.assertNoErrors(xtendInterface);
}
Also used : XtendInterface(org.eclipse.xtend.core.xtend.XtendInterface) Test(org.junit.Test)

Example 72 with XtendInterface

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

the class OverrideValidationTest method testInterfaceCompatibleThrowsClause_12.

@Test
public void testInterfaceCompatibleThrowsClause_12() throws Exception {
    XtendInterface xtendInterface = interfaze("interface Foo extends test.ExceptionThrowingInterface { override generifiedRuntimeException() throws NullPointerException }");
    helper.assertNoError(xtendInterface.getMembers().get(0), INCOMPATIBLE_THROWS_CLAUSE);
}
Also used : XtendInterface(org.eclipse.xtend.core.xtend.XtendInterface) Test(org.junit.Test)

Example 73 with XtendInterface

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

the class OverrideValidationTest method testDuplicateInterfaceMethod_3.

@Test
public void testDuplicateInterfaceMethod_3() throws Exception {
    XtendInterface xtendInterface = interfaze("interface Foo { def void bar(java.util.List<String> x) def void bar(java.util.List<Integer> x) }");
    helper.assertError(xtendInterface.getMembers().get(0), XTEND_FUNCTION, DUPLICATE_METHOD, "erasure", "List)", "List<String");
    helper.assertError(xtendInterface.getMembers().get(1), XTEND_FUNCTION, DUPLICATE_METHOD, "erasure", "List)", "List<Integer");
}
Also used : XtendInterface(org.eclipse.xtend.core.xtend.XtendInterface) Test(org.junit.Test)

Example 74 with XtendInterface

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

the class OverrideValidationTest method testInterfaceOverrideReturnType_1.

@Test
public void testInterfaceOverrideReturnType_1() throws Exception {
    XtendInterface xtendInterface = interfaze("import java.util.List import java.io.Serializable interface Foo<T> extends test.GenericSuperTypeInterface<T> {  " + "override <T1> T1[] getValue1(List<T1> t)" + "}");
    helper.assertNoErrors(xtendInterface);
}
Also used : XtendInterface(org.eclipse.xtend.core.xtend.XtendInterface) Test(org.junit.Test)

Example 75 with XtendInterface

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

the class OverrideValidationTest method testDuplicateInterfaceMethod_0.

// ***************************************************************************************************
// * and now the same for the interfaces
// ***************************************************************************************************
@Test
public void testDuplicateInterfaceMethod_0() throws Exception {
    XtendInterface xtendInterface = interfaze("interface Foo { def void bar(int x) def void bar(int x) }");
    helper.assertError(xtendInterface.getMembers().get(0), XTEND_FUNCTION, DUPLICATE_METHOD, "duplicate");
}
Also used : XtendInterface(org.eclipse.xtend.core.xtend.XtendInterface) Test(org.junit.Test)

Aggregations

XtendInterface (org.eclipse.xtend.core.xtend.XtendInterface)82 Test (org.junit.Test)78 XtendClass (org.eclipse.xtend.core.xtend.XtendClass)5 XtendAnnotationType (org.eclipse.xtend.core.xtend.XtendAnnotationType)4 XtendEnum (org.eclipse.xtend.core.xtend.XtendEnum)4 RichString (org.eclipse.xtend.core.xtend.RichString)3 XtendField (org.eclipse.xtend.core.xtend.XtendField)3 StringConcatenation (org.eclipse.xtend2.lib.StringConcatenation)3 XtendMember (org.eclipse.xtend.core.xtend.XtendMember)2 XtendParameter (org.eclipse.xtend.core.xtend.XtendParameter)2 EObject (org.eclipse.emf.ecore.EObject)1 EPackage (org.eclipse.emf.ecore.EPackage)1 InternalEObject (org.eclipse.emf.ecore.InternalEObject)1 XtendAnnotationTypeDeclarationImpl (org.eclipse.xtend.core.macro.declaration.XtendAnnotationTypeDeclarationImpl)1 XtendClassDeclarationImpl (org.eclipse.xtend.core.macro.declaration.XtendClassDeclarationImpl)1 XtendEnumerationDeclarationImpl (org.eclipse.xtend.core.macro.declaration.XtendEnumerationDeclarationImpl)1 XtendInterfaceDeclarationImpl (org.eclipse.xtend.core.macro.declaration.XtendInterfaceDeclarationImpl)1 XtendTypeDeclarationImpl (org.eclipse.xtend.core.macro.declaration.XtendTypeDeclarationImpl)1 JavaConverterTest (org.eclipse.xtend.core.tests.javaconverter.JavaConverterTest)1 RichStringLiteral (org.eclipse.xtend.core.xtend.RichStringLiteral)1