use of org.eclipse.xtend.core.xtend.XtendInterface in project xtext-xtend by eclipse.
the class OverrideValidationTest method testOverrideGenericInterfaceMethod_8.
@Test
public void testOverrideGenericInterfaceMethod_8() throws Exception {
XtendInterface xtendInterface = interfaze(" import java.util.List interface Foo<T> extends test.GenericSuperTypeInterface<T> { " + "override <T1, T2 extends T1> getValue8(List<T1> t, List<T2> t2) " + "}");
helper.assertNoErrors(xtendInterface);
}
use of org.eclipse.xtend.core.xtend.XtendInterface in project xtext-xtend by eclipse.
the class OverrideValidationTest method testInterfaceOverrideReturnType.
@Test
public void testInterfaceOverrideReturnType() throws Exception {
XtendInterface xtendInterface = interfaze("interface Foo<T> extends test.GenericSuperTypeInterface<T> { " + "override <T> T getSomething(T t) " + "}");
helper.assertNoErrors(xtendInterface);
}
use of org.eclipse.xtend.core.xtend.XtendInterface in project xtext-xtend by eclipse.
the class XtendJvmModelInferrer method doInferTypeSceleton.
protected JvmDeclaredType doInferTypeSceleton(final XtendTypeDeclaration declaration, final IJvmDeclaredTypeAcceptor acceptor, boolean preIndexingPhase, XtendFile xtendFile, List<Runnable> doLater) {
if (Strings.isEmpty(declaration.getName()))
return null;
if (declaration instanceof XtendAnnotationType) {
final JvmAnnotationType annotation = typesFactory.createJvmAnnotationType();
if (!preIndexingPhase) {
doLater.add(new Runnable() {
@Override
public void run() {
initialize((XtendAnnotationType) declaration, annotation);
}
});
}
return annotation;
} else if (declaration instanceof XtendClass) {
XtendClass xtendClass = (XtendClass) declaration;
final JvmGenericType javaType = typesFactory.createJvmGenericType();
copyTypeParameters(xtendClass.getTypeParameters(), javaType);
if (!preIndexingPhase) {
doLater.add(new Runnable() {
@Override
public void run() {
initialize((XtendClass) declaration, javaType);
}
});
}
return javaType;
} else if (declaration instanceof XtendInterface) {
XtendInterface xtendInterface = (XtendInterface) declaration;
final JvmGenericType javaType = typesFactory.createJvmGenericType();
javaType.setInterface(true);
copyTypeParameters(xtendInterface.getTypeParameters(), javaType);
if (!preIndexingPhase) {
doLater.add(new Runnable() {
@Override
public void run() {
initialize((XtendInterface) declaration, javaType);
}
});
}
return javaType;
} else if (declaration instanceof XtendEnum) {
final JvmEnumerationType javaType = typesFactory.createJvmEnumerationType();
if (!preIndexingPhase) {
doLater.add(new Runnable() {
@Override
public void run() {
initialize((XtendEnum) declaration, javaType);
}
});
}
return javaType;
} else {
return null;
}
}
use of org.eclipse.xtend.core.xtend.XtendInterface in project xtext-xtend by eclipse.
the class JavaConverterTest method testInnerIntefaceCase.
@Test
public void testInnerIntefaceCase() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("public class Clazz {");
_builder.newLine();
_builder.append("\t");
_builder.append("interface Inner {");
_builder.newLine();
_builder.append("\t\t");
_builder.append("void test();");
_builder.newLine();
_builder.append("\t");
_builder.append("}");
_builder.newLine();
_builder.append("}");
_builder.newLine();
_builder.append("interface Test{}");
XtendClass type = this.toValidXtendClass(_builder);
final XtendMember inner = type.getMembers().get(0);
Assert.assertTrue((inner instanceof XtendInterface));
final XtendInterface xtendInterfaze = ((XtendInterface) inner);
Assert.assertEquals(JvmVisibility.PUBLIC, xtendInterfaze.getVisibility());
Assert.assertEquals(JvmVisibility.PUBLIC, this.method(xtendInterfaze, 0).getVisibility());
}
use of org.eclipse.xtend.core.xtend.XtendInterface in project xtext-xtend by eclipse.
the class JavaConverterTest method testFieldVisibility1.
@Test
public void testFieldVisibility1() throws Exception {
StringConcatenation _builder = new StringConcatenation();
_builder.append("public interface JavaToConvert {");
_builder.newLine();
_builder.append("\t");
_builder.append("public static String pub;");
_builder.newLine();
_builder.append("\t");
_builder.append("final String fin;");
_builder.newLine();
_builder.append("\t");
_builder.append("static String def;");
_builder.newLine();
_builder.append("}");
final XtendInterface interfaze = this.toValidXtendInterface(_builder.toString());
Assert.assertEquals(JvmVisibility.PUBLIC, this.field(interfaze, 0).getVisibility());
Assert.assertEquals(JvmVisibility.PUBLIC, this.field(interfaze, 1).getVisibility());
Assert.assertEquals(JvmVisibility.PUBLIC, this.field(interfaze, 2).getVisibility());
}
Aggregations