Search in sources :

Example 1 with TypeReferences

use of org.eclipse.xtext.common.types.util.TypeReferences in project xtext-xtend by eclipse.

the class GetSuperTypeBenchmark method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    typeReference = getTypeReference(type);
    TypeReferences typeReferences = typeReference.getOwner().getServices().getTypeReferences();
    abstractCollection = typeReferences.findDeclaredType(AbstractCollection.class, typeReference.getType());
    abstractList = typeReferences.findDeclaredType(AbstractList.class, typeReference.getType());
    collection = typeReferences.findDeclaredType(Collection.class, typeReference.getType());
    iterable = typeReferences.findDeclaredType(Iterable.class, typeReference.getType());
    list = typeReferences.findDeclaredType(List.class, typeReference.getType());
    object = typeReferences.findDeclaredType(Object.class, typeReference.getType());
    set = typeReferences.findDeclaredType(Set.class, typeReference.getType());
    stringBuilder = typeReferences.findDeclaredType(StringBuilder.class, typeReference.getType());
    EcoreUtil.resolveAll(typeReference.getOwner().getContextResourceSet());
}
Also used : AbstractList(java.util.AbstractList) Set(java.util.Set) TypeReferences(org.eclipse.xtext.common.types.util.TypeReferences) AbstractCollection(java.util.AbstractCollection) AbstractCollection(java.util.AbstractCollection) Collection(java.util.Collection) List(java.util.List) AbstractList(java.util.AbstractList)

Example 2 with TypeReferences

use of org.eclipse.xtext.common.types.util.TypeReferences in project xtext-xtend by eclipse.

the class XtendValidator method checkClassPath.

@Check
public void checkClassPath(XtendFile xtendFile) {
    TypeReferences typeReferences = getServices().getTypeReferences();
    final JvmGenericType listType = (JvmGenericType) typeReferences.findDeclaredType(List.class, xtendFile);
    if (listType == null || listType.getTypeParameters().isEmpty()) {
        error("Couldn't find a JDK 1.5 or higher on the project's classpath.", xtendFile, XTEND_FILE__PACKAGE, IssueCodes.JDK_NOT_ON_CLASSPATH);
    } else if (typeReferences.findDeclaredType(ToStringBuilder.class, xtendFile) == null) {
        error("Couldn't find the mandatory library 'org.eclipse.xtext.xbase.lib' 2.8.0 or higher on the project's classpath.", xtendFile, XTEND_FILE__PACKAGE, IssueCodes.XBASE_LIB_NOT_ON_CLASSPATH);
    }
}
Also used : TypeReferences(org.eclipse.xtext.common.types.util.TypeReferences) JvmGenericType(org.eclipse.xtext.common.types.JvmGenericType) List(java.util.List) ImmutableList(com.google.common.collect.ImmutableList) Check(org.eclipse.xtext.validation.Check)

Aggregations

List (java.util.List)2 TypeReferences (org.eclipse.xtext.common.types.util.TypeReferences)2 ImmutableList (com.google.common.collect.ImmutableList)1 AbstractCollection (java.util.AbstractCollection)1 AbstractList (java.util.AbstractList)1 Collection (java.util.Collection)1 Set (java.util.Set)1 JvmGenericType (org.eclipse.xtext.common.types.JvmGenericType)1 Check (org.eclipse.xtext.validation.Check)1