Class XbaseValidator

  • All Implemented Interfaces:
    org.eclipse.emf.ecore.EValidator, org.eclipse.xtext.validation.ValidationMessageAcceptor
    Direct Known Subclasses:
    AbstractXbaseWithAnnotationsValidator, XbaseJavaValidator, XbaseWithAnnotationsValidator

    public class XbaseValidator
    extends AbstractXbaseValidator
    Xbase Validator that does use the scope provider or the type argument context. It basically disables or replaces all call-outs to the scope and some validations that will be superseded by immediate error annotations during type resolution.
    • Constructor Detail

      • XbaseValidator

        public XbaseValidator()
    • Method Detail

      • getActualType

        protected LightweightTypeReference getActualType​(org.eclipse.emf.ecore.EObject context,
                                                         org.eclipse.xtext.common.types.JvmIdentifiableElement element)
      • getActualType

        protected LightweightTypeReference getActualType​(org.eclipse.xtext.common.types.JvmIdentifiableElement identifiable)
      • checkNumberFormat

        protected void checkNumberFormat​(XNumberLiteral literal)
      • checkTypeReferenceIsNotVoid

        public void checkTypeReferenceIsNotVoid​(XExpression expression)
      • isPrimitiveVoid

        protected boolean isPrimitiveVoid​(org.eclipse.xtext.common.types.JvmTypeReference typeReference)
      • checkVariableIsNotInferredAsVoid

        public void checkVariableIsNotInferredAsVoid​(XVariableDeclaration declaration)
      • checkClosureParameterTypes

        public void checkClosureParameterTypes​(XClosure closure)
      • checkTypeArguments

        public void checkTypeArguments​(XConstructorCall expression)
      • ensureNotPrimitiveNorWildcard

        protected void ensureNotPrimitiveNorWildcard​(org.eclipse.xtext.common.types.JvmTypeReference typeRef)
      • toLightweightTypeReference

        protected LightweightTypeReference toLightweightTypeReference​(org.eclipse.xtext.common.types.JvmTypeReference typeRef)
      • toLightweightTypeReference

        protected LightweightTypeReference toLightweightTypeReference​(org.eclipse.xtext.common.types.JvmTypeReference typeRef,
                                                                      boolean keepUnboundWildcardInformation)
      • checkTypeReferenceIsNotVoid

        public void checkTypeReferenceIsNotVoid​(XCasePart expression)
      • checkTypes

        public void checkTypes​(XCatchClause catchClause)
      • checkTypeParameterNotUsedInStaticContext

        public void checkTypeParameterNotUsedInStaticContext​(org.eclipse.xtext.common.types.JvmTypeReference ref)
      • isStaticContext

        protected boolean isStaticContext​(org.eclipse.emf.ecore.EObject element)
      • isLocalType

        protected boolean isLocalType​(org.eclipse.emf.ecore.EObject element)
      • checkTypeParameterConstraintIsValid

        public void checkTypeParameterConstraintIsValid​(org.eclipse.xtext.common.types.JvmTypeParameter typeParameter)
      • doCheckTypeParameterForwardReference

        public void doCheckTypeParameterForwardReference​(java.util.List<org.eclipse.xtext.common.types.JvmTypeParameter> sourceTypeParameters)
        Java 5 does not allow forward references in type parameters, so we have to validate this, too
      • checkAssignment

        public void checkAssignment​(XAssignment assignment)
      • checkFinalFieldInitialization

        protected void checkFinalFieldInitialization​(org.eclipse.xtext.common.types.JvmGenericType type)
        can be called by subclasses to have proper final field initialization checks.
      • hasConstructorCallWithThis

        protected boolean hasConstructorCallWithThis​(org.eclipse.xtext.common.types.JvmConstructor constr)
      • isInitialized

        protected boolean isInitialized​(org.eclipse.xtext.common.types.JvmField input)
      • reportUninitializedField

        protected void reportUninitializedField​(org.eclipse.xtext.common.types.JvmField field)
      • reportUninitializedField

        protected void reportUninitializedField​(org.eclipse.xtext.common.types.JvmField field,
                                                org.eclipse.xtext.common.types.JvmConstructor constructor)
      • reportFieldAlreadyInitialized

        protected void reportFieldAlreadyInitialized​(XAssignment assignment,
                                                     org.eclipse.xtext.common.types.JvmField field)
      • checkInitializationRec

        protected void checkInitializationRec​(org.eclipse.emf.ecore.EObject expr,
                                              java.util.Set<org.eclipse.xtext.common.types.JvmField> fields,
                                              java.util.Set<org.eclipse.xtext.common.types.JvmField> initializedForSure,
                                              java.util.Set<org.eclipse.xtext.common.types.JvmField> initializedMaybe,
                                              java.util.Set<org.eclipse.xtext.common.types.JvmConstructor> visited)
      • checkVariableDeclaration

        public void checkVariableDeclaration​(XVariableDeclaration declaration)
      • checkInnerExpressions

        public void checkInnerExpressions​(XExpression expr)
      • isValueExpectedRecursive

        protected boolean isValueExpectedRecursive​(XExpression expr)
      • mustBeJavaStatementExpression

        protected void mustBeJavaStatementExpression​(XExpression expr)
      • checkTypeGuards

        public void checkTypeGuards​(XCasePart casePart)
      • checkDelegateConstructorIsFirst

        public void checkDelegateConstructorIsFirst​(XFeatureCall featureCall)
      • checkConstructorArgumentsAreValid

        public void checkConstructorArgumentsAreValid​(XFeatureCall featureCall)
      • checkIsValidConstructorArgument

        protected void checkIsValidConstructorArgument​(XExpression argument,
                                                       org.eclipse.xtext.common.types.JvmType containerType)
      • checkNoCircularConstructorCall

        public void checkNoCircularConstructorCall​(XFeatureCall featureCall)
      • checkNoForwardReferences

        public void checkNoForwardReferences​(XExpression fieldInitializer)
      • isLocalClassSemantics

        protected boolean isLocalClassSemantics​(org.eclipse.emf.ecore.EObject object)
      • checkClosureParams

        public void checkClosureParams​(XClosure closure)
      • checkLocalUsageOfDeclared

        public void checkLocalUsageOfDeclared​(XVariableDeclaration variableDeclaration)
      • checkLocalUsageOfSwitchParameter

        public void checkLocalUsageOfSwitchParameter​(XSwitchExpression switchExpression)
      • checkTypeLiteral

        public void checkTypeLiteral​(XTypeLiteral typeLiteral)
      • checkImports

        public void checkImports​(XImportSection importSection)
      • addImportUnusedIssues

        protected void addImportUnusedIssues​(java.util.Map<java.lang.String,​java.util.List<XImportDeclaration>> imports)
      • checkConflicts

        protected void checkConflicts​(XImportSection importSection,
                                      java.util.Map<java.lang.String,​java.util.List<XImportDeclaration>> imports,
                                      java.util.Map<java.lang.String,​org.eclipse.xtext.common.types.JvmType> importedNames)
      • populateMaps

        protected void populateMaps​(XImportSection importSection,
                                    java.util.Map<java.lang.String,​java.util.List<XImportDeclaration>> imports,
                                    java.util.Map<java.lang.String,​java.util.List<XImportDeclaration>> staticImports,
                                    java.util.Map<java.lang.String,​java.util.List<XImportDeclaration>> extensionImports,
                                    java.util.Map<java.lang.String,​org.eclipse.xtext.common.types.JvmType> importedNames)
      • checkPrimitiveComparedToNull

        public void checkPrimitiveComparedToNull​(XBinaryOperation binaryOperation)
      • isLocallyUsed

        protected boolean isLocallyUsed​(org.eclipse.emf.ecore.EObject target,
                                        org.eclipse.emf.ecore.EObject containerToFindUsage)
      • isInterface

        protected boolean isInterface​(org.eclipse.xtext.common.types.JvmType type)
      • checkNoJavaStyleTypeCasting

        public void checkNoJavaStyleTypeCasting​(XBlockExpression blockExpression)
      • isXExpressionInsideBlock

        protected boolean isXExpressionInsideBlock​(org.eclipse.xtext.nodemodel.INode child)
      • isSemicolon

        protected boolean isSemicolon​(org.eclipse.xtext.nodemodel.INode child)
      • checkNoJavaStyleTypeCasting

        protected void checkNoJavaStyleTypeCasting​(org.eclipse.xtext.nodemodel.INode node)
      • getNode

        protected org.eclipse.xtext.nodemodel.INode getNode​(org.eclipse.xtext.nodemodel.BidiTreeIterator<org.eclipse.xtext.nodemodel.INode> iterator,
                                                            org.eclipse.emf.ecore.EObject... grammarElements)
      • getFirstLeafNode

        protected org.eclipse.xtext.nodemodel.ILeafNode getFirstLeafNode​(org.eclipse.xtext.nodemodel.BidiTreeIterator<org.eclipse.xtext.nodemodel.INode> iterator)
      • isHidden

        protected boolean isHidden​(org.eclipse.xtext.nodemodel.INode child)
      • checkRedundantCase

        public void checkRedundantCase​(XSwitchExpression switchExpression)
      • checkDuplicatedCases

        public void checkDuplicatedCases​(XSwitchExpression switchExpression)
      • checkTypeGuardsOrder

        public void checkTypeGuardsOrder​(XSwitchExpression expression)
      • checkTypeGuardsOrderWithGenerics

        public void checkTypeGuardsOrderWithGenerics​(XSwitchExpression expression)
      • checkInstanceOfOrder

        public void checkInstanceOfOrder​(XIfExpression expression)
      • checkIncompleteCasesOnEnum

        public void checkIncompleteCasesOnEnum​(XSwitchExpression switchExpression)
      • checkAssignment

        public void checkAssignment​(XBinaryOperation binaryOperation)
      • checkOperandTypesForTripleEquals

        public void checkOperandTypesForTripleEquals​(XBinaryOperation binaryOperation)
      • isTripleEqualsOperation

        protected boolean isTripleEqualsOperation​(XBinaryOperation binaryOperation)
      • checkAssignment

        public void checkAssignment​(XPostfixOperation postfixOperation)
      • checkExplicitOperationCall

        public void checkExplicitOperationCall​(XFeatureCall featureCall)
      • checkExplicitOperationCall

        public void checkExplicitOperationCall​(XMemberFeatureCall featureCall)
      • checkExplicitOperationCall

        public void checkExplicitOperationCall​(XConstructorCall constructorCall)
      • checkAssignment

        protected void checkAssignment​(XExpression expression,
                                       boolean simpleAssignment)
      • checkAssignment

        protected void checkAssignment​(XExpression expression,
                                       org.eclipse.emf.ecore.EStructuralFeature feature,
                                       boolean simpleAssignment)
      • checkDeprecated

        protected void checkDeprecated​(org.eclipse.xtext.common.types.JvmIdentifiableElement object,
                                       org.eclipse.emf.ecore.EObject source,
                                       org.eclipse.emf.ecore.EStructuralFeature structuralFeature)
      • checkDeprecated

        public void checkDeprecated​(org.eclipse.xtext.common.types.JvmParameterizedTypeReference type)
      • checkDeprecated

        public void checkDeprecated​(XConstructorCall expression)
      • checkDeprecated

        public void checkDeprecated​(XTypeLiteral expression)
      • checkReferInvalidTypes

        public void checkReferInvalidTypes​(XConstructorCall constructorCall)
      • checkReferInvalidTypes

        protected void checkReferInvalidTypes​(org.eclipse.xtext.common.types.JvmIdentifiableElement element,
                                              org.eclipse.emf.ecore.EObject source,
                                              org.eclipse.emf.ecore.EReference structuralFeature)
      • getReferInvalidTypeMessage

        protected java.lang.String getReferInvalidTypeMessage​(org.eclipse.xtext.common.types.JvmIdentifiableElement element,
                                                              LightweightTypeReference referencedInvalidType)