Search in sources :

Example 1 with JavaVersion

use of org.eclipse.xtext.util.JavaVersion in project xtext-xtend by eclipse.

the class XtendValidator method checkDuplicateAndOverriddenFunctions.

@Check
public void checkDuplicateAndOverriddenFunctions(XtendTypeDeclaration xtendType) {
    final JvmDeclaredType inferredType = associations.getInferredType(xtendType);
    if (inferredType instanceof JvmGenericType) {
        JavaVersion targetVersion = getGeneratorConfig(xtendType).getJavaSourceVersion();
        ResolvedFeatures resolvedFeatures = overrideHelper.getResolvedFeatures(inferredType, targetVersion);
        Set<EObject> flaggedOperations = Sets.newHashSet();
        doCheckDuplicateExecutables((JvmGenericType) inferredType, resolvedFeatures, flaggedOperations);
        doCheckOverriddenMethods(xtendType, (JvmGenericType) inferredType, resolvedFeatures, flaggedOperations);
        doCheckFunctionOverrides(resolvedFeatures, flaggedOperations);
    }
}
Also used : ResolvedFeatures(org.eclipse.xtext.xbase.typesystem.override.ResolvedFeatures) EObject(org.eclipse.emf.ecore.EObject) JvmGenericType(org.eclipse.xtext.common.types.JvmGenericType) JvmDeclaredType(org.eclipse.xtext.common.types.JvmDeclaredType) JavaVersion(org.eclipse.xtext.util.JavaVersion) Check(org.eclipse.xtext.validation.Check)

Example 2 with JavaVersion

use of org.eclipse.xtext.util.JavaVersion in project xtext-xtend by eclipse.

the class XtendBatchCompiler method setJavaSourceVersion.

/**
 * @since 2.8
 */
public void setJavaSourceVersion(final String javaSourceVersion) {
    JavaVersion javaVersion = JavaVersion.fromQualifier(javaSourceVersion);
    if (javaVersion == null) {
        List<String> qualifiers = Lists.newArrayList();
        for (JavaVersion version : JavaVersion.values()) qualifiers.addAll(version.getAllQualifiers());
        throw new IllegalArgumentException("Unknown Java Version Qualifier: '" + javaSourceVersion + "'. Valid values are: '" + Joiner.on(", ").join(qualifiers) + "'");
    }
    generatorConfig.setJavaSourceVersion(javaVersion);
}
Also used : JavaVersion(org.eclipse.xtext.util.JavaVersion)

Aggregations

JavaVersion (org.eclipse.xtext.util.JavaVersion)2 EObject (org.eclipse.emf.ecore.EObject)1 JvmDeclaredType (org.eclipse.xtext.common.types.JvmDeclaredType)1 JvmGenericType (org.eclipse.xtext.common.types.JvmGenericType)1 Check (org.eclipse.xtext.validation.Check)1 ResolvedFeatures (org.eclipse.xtext.xbase.typesystem.override.ResolvedFeatures)1