Class XtendValidator

  • All Implemented Interfaces:
    org.eclipse.emf.ecore.EValidator, org.eclipse.xtext.validation.ValidationMessageAcceptor

    public class XtendValidator
    extends org.eclipse.xtext.xbase.annotations.validation.XbaseWithAnnotationsValidator
    • Field Detail

      • visibilityModifers

        protected final java.util.Set<java.lang.String> visibilityModifers
      • junitAnnotations

        protected final java.util.Set<java.lang.String> junitAnnotations
      • targetInfos

        protected final com.google.common.collect.Multimap<java.lang.Class<?>,​java.lang.annotation.ElementType> targetInfos
    • Constructor Detail

      • XtendValidator

        public XtendValidator()
    • Method Detail

      • getEPackages

        protected java.util.List<org.eclipse.emf.ecore.EPackage> getEPackages()
        Overrides:
        getEPackages in class org.eclipse.xtext.xbase.annotations.validation.XbaseWithAnnotationsValidator
      • getGeneratorConfig

        protected org.eclipse.xtext.xbase.compiler.GeneratorConfig getGeneratorConfig​(org.eclipse.emf.ecore.EObject element)
      • hasAnnotation

        protected boolean hasAnnotation​(XtendAnnotationTarget source,
                                        java.lang.Class<?> class1)
      • checkValidExtension

        public void checkValidExtension​(XtendField field)
      • checkNonRawTypeInferred

        public void checkNonRawTypeInferred​(XtendField field)
      • checkNonRawTypeInferred

        public void checkNonRawTypeInferred​(XtendFunction function)
      • checkJUnitMethodReturnType

        public void checkJUnitMethodReturnType​(XtendFunction function)
      • validateInferredType

        protected void validateInferredType​(org.eclipse.xtext.common.types.JvmTypeReference inferredType,
                                            XtendMember member,
                                            java.lang.String messagePrefix,
                                            org.eclipse.emf.ecore.EAttribute location)
      • checkValidExtension

        public void checkValidExtension​(XtendParameter parameter)
      • checkValidExtensionType

        protected void checkValidExtensionType​(org.eclipse.xtext.common.types.JvmIdentifiableElement identifiable,
                                               org.eclipse.emf.ecore.EObject source,
                                               org.eclipse.emf.ecore.EStructuralFeature feature)
      • checkAnnotationTarget

        public void checkAnnotationTarget​(org.eclipse.xtext.xbase.annotations.xAnnotations.XAnnotation annotation)
      • checkMultipleAnnotations

        public void checkMultipleAnnotations​(XtendAnnotationTarget annotationTarget)
      • isRelevantAnnotationTarget

        protected boolean isRelevantAnnotationTarget​(XtendAnnotationTarget annotationTarget)
      • getContainingAnnotationTarget

        protected org.eclipse.emf.ecore.EObject getContainingAnnotationTarget​(org.eclipse.xtext.xbase.annotations.xAnnotations.XAnnotation annotation)
      • checkNoVoidInDependencyDeclaration

        public void checkNoVoidInDependencyDeclaration​(XtendField dep)
      • checkMemberNamesAreUnique

        public void checkMemberNamesAreUnique​(XtendTypeDeclaration xtendType)
      • checkXtendParameterNotPrimitiveVoid

        public void checkXtendParameterNotPrimitiveVoid​(XtendParameter param)
      • checkVarArgIsNotExtension

        public void checkVarArgIsNotExtension​(XtendParameter param)
      • checkVarArgComesLast

        public void checkVarArgComesLast​(XtendParameter param)
      • checkClassPath

        public void checkClassPath​(XtendFile xtendFile)
      • checkWhitespaceInRichStrings

        public void checkWhitespaceInRichStrings​(RichString richString)
      • doCheckWhitespaceIn

        protected void doCheckWhitespaceIn​(RichString richString)
      • checkSuperTypes

        public void checkSuperTypes​(XtendClass xtendClass)
      • checkSuperTypes

        public void checkSuperTypes​(XtendInterface xtendInterface)
      • isAnnotation

        protected boolean isAnnotation​(org.eclipse.xtext.common.types.JvmType jvmType)
      • checkSuperTypes

        public void checkSuperTypes​(AnonymousClass anonymousClass)
      • checkStaticMembers

        public void checkStaticMembers​(AnonymousClass anonymousClass)
      • checkWildcardSupertype

        protected void checkWildcardSupertype​(XtendTypeDeclaration xtendType,
                                              org.eclipse.xtext.common.types.JvmTypeReference superTypeReference,
                                              org.eclipse.emf.ecore.EStructuralFeature feature,
                                              int index)
      • isInvalidWildcard

        protected boolean isInvalidWildcard​(org.eclipse.xtext.common.types.JvmTypeReference typeRef)
      • hasCycleInHierarchy

        protected boolean hasCycleInHierarchy​(org.eclipse.xtext.common.types.JvmGenericType type,
                                              java.util.Set<org.eclipse.xtext.common.types.JvmGenericType> processedSuperTypes)
      • checkDuplicateAndOverriddenFunctions

        public void checkDuplicateAndOverriddenFunctions​(XtendTypeDeclaration xtendType)
      • doCheckDuplicateExecutables

        protected void doCheckDuplicateExecutables​(org.eclipse.xtext.common.types.JvmGenericType inferredType,
                                                   org.eclipse.xtext.xbase.typesystem.override.ResolvedFeatures resolvedFeatures,
                                                   java.util.Set<org.eclipse.emf.ecore.EObject> flaggedOperations)
      • doCheckDuplicateExecutables

        protected <Executable extends org.eclipse.xtext.xbase.typesystem.override.IResolvedExecutable> void doCheckDuplicateExecutables​(org.eclipse.xtext.common.types.JvmGenericType inferredType,
                                                                                                                                        java.util.List<Executable> declaredOperations,
                                                                                                                                        com.google.common.base.Function<java.lang.String,​java.util.List<Executable>> bySignature,
                                                                                                                                        java.util.Set<org.eclipse.emf.ecore.EObject> flaggedOperations)
      • typeLabel

        protected java.lang.String typeLabel​(org.eclipse.xtext.common.types.JvmExecutable executable)
      • nameFeature

        protected org.eclipse.emf.ecore.EStructuralFeature nameFeature​(org.eclipse.emf.ecore.EObject member)
      • exceptionsFeature

        protected org.eclipse.emf.ecore.EStructuralFeature exceptionsFeature​(org.eclipse.emf.ecore.EObject member)
      • returnTypeFeature

        protected org.eclipse.emf.ecore.EStructuralFeature returnTypeFeature​(org.eclipse.emf.ecore.EObject member)
      • doCheckOverriddenMethods

        protected void doCheckOverriddenMethods​(XtendTypeDeclaration xtendType,
                                                org.eclipse.xtext.common.types.JvmGenericType inferredType,
                                                org.eclipse.xtext.xbase.typesystem.override.ResolvedFeatures resolvedFeatures,
                                                java.util.Set<org.eclipse.emf.ecore.EObject> flaggedOperations)
      • reportMissingImplementations

        protected void reportMissingImplementations​(XtendTypeDeclaration xtendClass,
                                                    org.eclipse.xtext.common.types.JvmGenericType inferredType,
                                                    java.util.List<org.eclipse.xtext.xbase.typesystem.override.IResolvedOperation> operationsMissingImplementation)
      • doCheckFunctionOverrides

        protected void doCheckFunctionOverrides​(org.eclipse.xtext.xbase.typesystem.override.ResolvedFeatures resolvedFeatures,
                                                java.util.Set<org.eclipse.emf.ecore.EObject> flaggedOperations)
      • doCheckFunctionOverrides

        protected void doCheckFunctionOverrides​(org.eclipse.xtext.xbase.typesystem.override.IResolvedOperation operation,
                                                java.util.Set<org.eclipse.emf.ecore.EObject> flaggedOperations)
      • doCheckFunctionOverrides

        protected void doCheckFunctionOverrides​(org.eclipse.emf.ecore.EObject sourceElement,
                                                org.eclipse.xtext.xbase.typesystem.override.IResolvedOperation resolved,
                                                java.util.List<org.eclipse.xtext.xbase.typesystem.override.IResolvedOperation> allInherited)
      • getDeclaratorName

        protected java.lang.String getDeclaratorName​(org.eclipse.xtext.xbase.typesystem.override.IResolvedOperation resolved)
      • createExceptionMismatchError

        protected void createExceptionMismatchError​(org.eclipse.xtext.xbase.typesystem.override.IResolvedOperation operation,
                                                    org.eclipse.emf.ecore.EObject sourceElement,
                                                    java.util.List<org.eclipse.xtext.xbase.typesystem.override.IResolvedOperation> exceptionMismatch)
      • findPrimarySourceElement

        protected org.eclipse.emf.ecore.EObject findPrimarySourceElement​(org.eclipse.xtext.xbase.typesystem.override.IResolvedOperation operation)
      • isMorePrivateThan

        protected boolean isMorePrivateThan​(org.eclipse.xtext.common.types.JvmVisibility o1,
                                            org.eclipse.xtext.common.types.JvmVisibility o2)
      • checkDefaultSuperConstructor

        public void checkDefaultSuperConstructor​(XtendClass xtendClass)
      • isDelegateConstructorCall

        protected boolean isDelegateConstructorCall​(org.eclipse.xtext.xbase.XExpression expression)
      • isInterface

        protected boolean isInterface​(org.eclipse.xtext.common.types.JvmDeclaredType type)
      • canonicalName

        protected java.lang.String canonicalName​(org.eclipse.xtext.common.types.JvmIdentifiableElement element)
      • getReadableSignature

        protected java.lang.String getReadableSignature​(org.eclipse.xtext.common.types.JvmExecutable executable)
      • doGetReadableSignature

        protected java.lang.String doGetReadableSignature​(java.lang.String simpleName,
                                                          java.util.List<org.eclipse.xtext.common.types.JvmFormalParameter> parameters)
      • getReadableSignature

        protected java.lang.String getReadableSignature​(java.lang.String elementName,
                                                        java.util.List<org.eclipse.xtext.common.types.JvmTypeReference> parameterTypes)
      • checkParameterNames

        public void checkParameterNames​(XtendFunction function)
      • checkAbstract

        public void checkAbstract​(XtendFunction function)
      • checkOperatorSignature

        public void checkOperatorSignature​(XtendFunction function)
      • checkParameterNames

        public void checkParameterNames​(XtendConstructor constructor)
      • dispatchFuncWithTypeParams

        public void dispatchFuncWithTypeParams​(XtendFunction func)
      • checkDispatchFunctions

        public void checkDispatchFunctions​(XtendClass clazz)
      • checkDispatchNonDispatchConflict

        protected void checkDispatchNonDispatchConflict​(XtendClass clazz,
                                                        com.google.common.collect.Multimap<DispatchHelper.DispatchSignature,​org.eclipse.xtext.common.types.JvmOperation> dispatchMethods)
      • addDispatchError

        protected void addDispatchError​(org.eclipse.xtext.common.types.JvmGenericType type,
                                        java.lang.Iterable<org.eclipse.xtext.common.types.JvmOperation> operations,
                                        java.lang.String message,
                                        java.lang.String modifier,
                                        java.lang.String ISSUE_ID)
      • addDispatchError

        protected void addDispatchError​(org.eclipse.xtext.common.types.JvmOperation jvmOperation,
                                        java.lang.String message,
                                        java.lang.String modifier,
                                        java.lang.String ISSUE_ID)
      • getParamTypes

        protected java.util.List<org.eclipse.xtext.common.types.JvmType> getParamTypes​(org.eclipse.xtext.common.types.JvmOperation jvmOperation,
                                                                                       boolean wrapPrimitives)
      • checkNoReturnsInCreateExtensions

        public void checkNoReturnsInCreateExtensions​(XtendFunction func)
      • checkCreateFunctionIsNotTypeVoid

        public void checkCreateFunctionIsNotTypeVoid​(XtendFunction func)
      • checkCreateFunctionIsNotGeneric

        public void checkCreateFunctionIsNotGeneric​(XtendFunction func)
      • checkCreateFunctionIsNotStatic

        public void checkCreateFunctionIsNotStatic​(XtendFunction func)
      • isValueExpectedRecursive

        protected boolean isValueExpectedRecursive​(org.eclipse.xtext.xbase.XExpression expr)
        Overrides:
        isValueExpectedRecursive in class org.eclipse.xtext.xbase.validation.XbaseValidator
      • collectReturnExpressions

        protected void collectReturnExpressions​(org.eclipse.emf.ecore.EObject expr,
                                                java.util.List<org.eclipse.xtext.xbase.XReturnExpression> found)
      • doCheckValidMemberName

        public boolean doCheckValidMemberName​(XtendMember member)
      • checkLocalUsageOfDeclaredFields

        public void checkLocalUsageOfDeclaredFields​(XtendField field)
      • getOutermostType

        protected final org.eclipse.emf.ecore.EObject getOutermostType​(XtendMember member)
        Replies the outer-most type of the given member.
        Returns:
        the container of XtendTypeDeclaration type if it exists, or the direct container.
      • getDeclaratorName

        protected java.lang.String getDeclaratorName​(org.eclipse.xtext.common.types.JvmFeature feature)
      • checkLocalUsageOfDeclaredXtendFunction

        public void checkLocalUsageOfDeclaredXtendFunction​(XtendFunction function)
      • checkDeclaredExceptions

        public void checkDeclaredExceptions​(XtendConstructor constructor)
      • checkTypeParameterForwardReferences

        public void checkTypeParameterForwardReferences​(XtendClass xtendClass)
      • checkTypeParameterForwardReferences

        public void checkTypeParameterForwardReferences​(XtendInterface xtendInterface)
      • checkTypeParameterForwardReferences

        public void checkTypeParameterForwardReferences​(XtendFunction xtendFunction)
      • checkTypeParametersAreUnsupported

        public void checkTypeParametersAreUnsupported​(XtendConstructor constructor)
      • checkDeclaredExceptions

        public void checkDeclaredExceptions​(XtendFunction function)
      • checkLeftHandSideIsVariable

        public void checkLeftHandSideIsVariable​(org.eclipse.xtext.xbase.XAssignment assignment)
      • checkJavaKeywordConflict

        public void checkJavaKeywordConflict​(XtendField member)
      • checkJavaKeywordConflict

        public void checkJavaKeywordConflict​(XtendFunction member)
      • checkJavaKeywordConflict

        public void checkJavaKeywordConflict​(XtendConstructor member)
      • checkJavaKeywordConflict

        public void checkJavaKeywordConflict​(XtendClass member)
      • checkJavaKeywordConflict

        public void checkJavaKeywordConflict​(XtendInterface member)
      • checkNoJavaKeyword

        protected void checkNoJavaKeyword​(org.eclipse.emf.ecore.EObject obj,
                                          org.eclipse.emf.ecore.EAttribute attribute)
      • checkNonInitializedFieldsHaveAType

        public void checkNonInitializedFieldsHaveAType​(XtendField field)
      • checkFieldsAreCalledSelf

        public void checkFieldsAreCalledSelf​(XtendField field)
      • checkFinalFieldInitialization

        public void checkFinalFieldInitialization​(XtendClass clazz)
      • checkFinalFieldInitialization

        public void checkFinalFieldInitialization​(XtendInterface xtendInterface)
      • checkJavaDocRefs

        public void checkJavaDocRefs​(XtendMember member)
      • reportUninitializedField

        protected void reportUninitializedField​(org.eclipse.xtext.common.types.JvmField field)
        Overrides:
        reportUninitializedField in class org.eclipse.xtext.xbase.validation.XbaseValidator
      • reportUninitializedField

        protected void reportUninitializedField​(org.eclipse.xtext.common.types.JvmField field,
                                                org.eclipse.xtext.common.types.JvmConstructor constructor)
        Overrides:
        reportUninitializedField in class org.eclipse.xtext.xbase.validation.XbaseValidator
      • hasAnnotation

        protected boolean hasAnnotation​(java.lang.Iterable<? extends org.eclipse.xtext.xbase.annotations.xAnnotations.XAnnotation> annotations,
                                        java.lang.Class<?> annotationType)
      • checkModifiers

        protected void checkModifiers​(XtendClass xtendClass)
      • checkModifiers

        protected void checkModifiers​(XtendInterface xtendInterface)
      • checkModifiers

        protected void checkModifiers​(XtendEnum xtendEnum)
      • checkModifiers

        protected void checkModifiers​(XtendField field)
      • getMemberName

        protected java.lang.String getMemberName​(XtendField field)
      • checkModifiers

        protected void checkModifiers​(XtendConstructor constructor)
      • checkModifiers

        protected void checkModifiers​(XtendFunction method)
      • checkInferedApi

        protected void checkInferedApi​(XtendFunction method)
      • checkInferedApi

        protected void checkInferedApi​(XtendField field)
      • isApi

        protected boolean isApi​(XtendMember member)
      • checkModifierMatchesTypename

        protected void checkModifierMatchesTypename​(XtendClass xtendClass)
      • checkImplicitReturn

        protected void checkImplicitReturn​(XtendFunction method)
      • isLocalClassSemantics

        protected boolean isLocalClassSemantics​(org.eclipse.emf.ecore.EObject object)
        Overrides:
        isLocalClassSemantics in class org.eclipse.xtext.xbase.validation.XbaseValidator
      • checkDeprecated

        public void checkDeprecated​(org.eclipse.xtext.xtype.XImportDeclaration decl)
        Overrides:
        checkDeprecated in class org.eclipse.xtext.xbase.validation.XbaseValidator
      • checkTernaryExpressionUsed

        public void checkTernaryExpressionUsed​(org.eclipse.xtext.xbase.XIfExpression exp)
      • addIssue

        protected void addIssue​(java.lang.String message,
                                org.eclipse.emf.ecore.EObject source,
                                org.eclipse.emf.ecore.EStructuralFeature feature,
                                int index,
                                java.lang.String issueCode,
                                java.lang.String... issueData)
        Overrides:
        addIssue in class org.eclipse.xtext.validation.AbstractDeclarativeValidator