org.eclipse.incquery.patternlanguage.emf.validation

## Class EMFPatternLanguageJavaValidator

- java.lang.Object
- - org.eclipse.xtext.validation.AbstractInjectableValidator
  - - org.eclipse.xtext.validation.AbstractDeclarativeValidator
    - - org.eclipse.xtext.xbase.validation.AbstractXbaseValidator
      - - org.eclipse.xtext.xbase.validation.XbaseValidator
        - - org.eclipse.xtext.xbase.validation.XbaseJavaValidator
          - - org.eclipse.incquery.patternlanguage.validation.AbstractPatternLanguageJavaValidator
            - - org.eclipse.incquery.patternlanguage.validation.PatternLanguageJavaValidator
              - - org.eclipse.incquery.patternlanguage.emf.validation.AbstractEMFPatternLanguageJavaValidator
                - - org.eclipse.incquery.patternlanguage.emf.validation.EMFPatternLanguageJavaValidator

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

      public class EMFPatternLanguageJavaValidator
      extends AbstractEMFPatternLanguageJavaValidator

  Validators for EMFPattern Language:
  - Duplicate import of EPackages
  - Enum types
  - Unused variables
  - Type checking for parameters and body variables
  - Type checking for literal and computational values in pattern calls, path expressions and compare constraints
  - Pattern body searching for isolated constraints (cartesian products)
  - Non-EDataTypes in check expression

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.eclipse.xtext.validation.AbstractDeclarativeValidator

      `org.eclipse.xtext.validation.AbstractDeclarativeValidator.State, org.eclipse.xtext.validation.AbstractDeclarativeValidator.StateAccess`

    - ### Nested classes/interfaces inherited from interface org.eclipse.emf.ecore.EValidator

      `org.eclipse.emf.ecore.EValidator.Descriptor, org.eclipse.emf.ecore.EValidator.PatternMatcher, org.eclipse.emf.ecore.EValidator.Registry, org.eclipse.emf.ecore.EValidator.SubstitutionLabelProvider, org.eclipse.emf.ecore.EValidator.ValidationDelegate`

  - ### Field Summary

    - ### Fields inherited from class org.eclipse.incquery.patternlanguage.validation.PatternLanguageJavaValidator

      `ANNOTATION_PARAMETER_TYPE_ERROR, DUPLICATE_PATTERN_DEFINITION_MESSAGE, DUPLICATE_VARIABLE_MESSAGE, MISSING_ANNOTATION_ATTRIBUTE, RECURSIVE_PATTERN_CALL, TRANSITIVE_CLOSURE_ARITY_IN_PATTERNCALL, TRANSITIVE_CLOSURE_ONLY_IN_POSITIVE_COMPOSITION, UNKNOWN_ANNOTATION_ATTRIBUTE, UNUSED_PRIVATE_PATTERN_MESSAGE`

    - ### Fields inherited from class org.eclipse.xtext.validation.AbstractInjectableValidator

      `CURRENT_LANGUAGE_NAME, ISSUE_SEVERITIES`

    - ### Fields inherited from interface org.eclipse.xtext.validation.ValidationMessageAcceptor

      `INSIGNIFICANT_INDEX`

    - ### Fields inherited from interface org.eclipse.emf.ecore.EValidator

      `MARKER, RELATED_URIS_ATTRIBUTE, URI_ATTRIBUTE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `EMFPatternLanguageJavaValidator()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `checkClassPath(PatternModel modelFile)`
    `void` | `checkDuplicatePackageImports(PatternModel patternModel)`
    `void` | `checkEnumValues(EnumValue value)`
    `void` | `checkForCartesianProduct(PatternBody patternBody)` A validator for cartesian products (isolated constraints) in pattern bodies.
    `void` | `checkForNotWellbehavingDerivedFeatureInPathExpressions(PathExpressionConstraint pathExpressionConstraint)` This validator looks up all `EStructuralFeature` used in a `PathExpressionConstraint` and reports a warning on each that is not representable by EMF-IncQuery.
    `void` | `checkForWrongLiteralAndComputationValuesInCompareConstraints(CompareConstraint compareConstraint)` This validator checks if the literal or computational values match the other side's type in a compare constraint (equality/inequality).
    `void` | `checkForWrongLiteralAndComputationValuesInPathExpressionConstraints(PathExpressionConstraint pathExpressionConstraint)` This validator checks if the literal or computational values match the path expression's type.
    `void` | `checkForWrongLiteralAndComputationValuesInPatternCalls(PatternCall patternCall)` This validator checks if the literal or computational values match the pattern call's type.
    `void` | `checkForWrongVariablesInXExpressions(CheckConstraint checkConstraint)` This validator looks up all variables in the `CheckConstraint` and reports an error if one them is not an `EDataType` instance.
    `void` | `checkForWrongVariablesInXExpressions(FunctionEvaluationValue eval)` This validator looks up all variables in the `FunctionEvaluationValue` and reports an error if one them is not an `EDataType` instance.
    `void` | `checkMissingParameterTypes(Variable variable)`
    `void` | `checkPackageImportGeneratedCode(PackageImport packageImport)`
    `void` | `checkParametersNamed(Pattern pattern)`
    `void` | `checkPatternImports(XImportSection section)`
    `void` | `checkPatternParametersType(Pattern pattern)` The parameter's type must be the same or more specific than the type inferred from the pattern's body.
    `void` | `checkPatternVariablesType(Pattern pattern)` A variable's type can come from different sources: parameter's type definition, type definitions in the pattern bodies or calculated from path expression constraints or find calls.
    `void` | `checkReferredPackages(ReferenceType type)`

    - ### Methods inherited from class org.eclipse.incquery.patternlanguage.validation.PatternLanguageJavaValidator

      `checkAnnotation, checkApplicabilityOfTransitiveClosureInPatternCall, checkCompareConstraints, checkForImpureJavaCallsInCheckConstraints, checkForImpureJavaCallsInEvalExpressions, checkPackageDeclaration, checkPatternBody, checkPatternCallParameters, checkPatternParameters, checkPatterns, checkPrivatePatternCall, checkPrivatePatternUsage, checkRecursivePatternCall, checkReturnTypeOfCheckConstraints, checkVariableNames, checkVariableUsageCounters, error, isNamedSingleUse, isUnnamedSingleUseVariable, warning`

    - ### Methods inherited from class org.eclipse.xtext.xbase.validation.XbaseValidator

      `checkAssignment, checkAssignment, checkAssignment, checkCasts, checkCatchClausesOrder, checkClosureParameterTypes, checkClosureParams, checkConstructorArgumentsAreValid, checkDelegateConstructorIsFirst, checkDeprecated, checkDeprecated, checkDeprecated, checkDeprecated, checkDeprecated, checkDuplicatedCases, checkExplicitOperationCall, checkExplicitOperationCall, checkExplicitOperationCall, checkImports, checkIncompleteCasesOnEnum, checkInnerExpressions, checkInstanceOf, checkInstanceOfOrder, checkLocalUsageOfDeclared, checkLocalUsageOfSwitchParameter, checkNoCircularConstructorCall, checkNoForwardReferences, checkNoJavaStyleTypeCasting, checkOperandTypesForTripleEquals, checkPrimitiveComparedToNull, checkRedundantCase, checkReturn, checkTypeArguments, checkTypeArguments, checkTypeGuards, checkTypeGuardsOrder, checkTypeLiteral, checkTypeParameterConstraintIsValid, checkTypeParameterNotUsedInStaticContext, checkTypeReferenceIsNotVoid, checkTypeReferenceIsNotVoid, checkTypes, checkVariableDeclaration, checkVariableIsNotInferredAsVoid, doCheckTypeParameterForwardReference`

    - ### Methods inherited from class org.eclipse.xtext.validation.AbstractDeclarativeValidator

      `acceptError, acceptError, acceptInfo, acceptInfo, acceptWarning, acceptWarning, getMessageAcceptor, setInjector, setMessageAcceptor`

    - ### Methods inherited from class org.eclipse.xtext.validation.AbstractInjectableValidator

      `isLanguageSpecific, register, validate, validate, validate`

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### EMFPatternLanguageJavaValidator

          public EMFPatternLanguageJavaValidator()

  - ### Method Detail

    - #### checkDuplicatePackageImports

          public void checkDuplicatePackageImports(PatternModel patternModel)

    - #### checkPackageImportGeneratedCode

          public void checkPackageImportGeneratedCode(PackageImport packageImport)

    - #### checkParametersNamed

          public void checkParametersNamed(Pattern pattern)

    - #### checkEnumValues

          public void checkEnumValues(EnumValue value)

    - #### checkPatternParametersType

          public void checkPatternParametersType(Pattern pattern)

      The parameter's type must be the same or more specific than the type inferred from the pattern's body. This warning usually arises when we have more pattern bodies, which contains different type definitions for the same parameter. In a case like this the common parameter's type is the most specific common supertype of the respective calculated types in the bodies.
      Parameters:
        `pattern` -

    - #### checkPatternVariablesType

          public void checkPatternVariablesType(Pattern pattern)

      A variable's type can come from different sources: parameter's type definition, type definitions in the pattern bodies or calculated from path expression constraints or find calls. In these situations one variable might have conflicting type definitions. In conflicting situations if a variable's multiple types have a common subtype (which would ensure a pattern match runtime) and has a type defined as a parameter, than this type will be selected. In other cases we don't select a random type from the possibilities, the validator returns with an error. Note, if the multiple type definitions are related in subtype-supertype relations than the most specific is selected naturally (this is not even a warning).
      Parameters:
        `pattern` -

    - #### checkForCartesianProduct

          public void checkForCartesianProduct(PatternBody patternBody)

      A validator for cartesian products (isolated constraints) in pattern bodies. There are two types of warnings: strict and soft. Strict warning means that there are constraints in the body which has no connection at all, in soft cases they connected at least with a count find. The validator's result always just a warning, however a strict warning usually a modeling design flaw which should be corrected.
      Parameters:
        `patternBody` -

    - #### checkForWrongLiteralAndComputationValuesInCompareConstraints

          public void checkForWrongLiteralAndComputationValuesInCompareConstraints(CompareConstraint compareConstraint)

      This validator checks if the literal or computational values match the other side's type in a compare constraint (equality/inequality). Both sides can be literal, we will do the check if at least on side is that.
      Parameters:
        `compareConstraint` -

    - #### checkForWrongLiteralAndComputationValuesInPathExpressionConstraints

          public void checkForWrongLiteralAndComputationValuesInPathExpressionConstraints(PathExpressionConstraint pathExpressionConstraint)

      This validator checks if the literal or computational values match the path expression's type.
      Parameters:
        `pathExpressionConstraint` -

    - #### checkForWrongLiteralAndComputationValuesInPatternCalls

          public void checkForWrongLiteralAndComputationValuesInPatternCalls(PatternCall patternCall)

      This validator checks if the literal or computational values match the pattern call's type.
      Parameters:
        `patternCall` -

    - #### checkForWrongVariablesInXExpressions

          public void checkForWrongVariablesInXExpressions(CheckConstraint checkConstraint)

      This validator looks up all variables in the `CheckConstraint` and reports an error if one them is not an `EDataType` instance. We do not allow arbitrary EMF elements in, so the checks are less likely to have side-effects.

    - #### checkForWrongVariablesInXExpressions

          public void checkForWrongVariablesInXExpressions(FunctionEvaluationValue eval)

      This validator looks up all variables in the `FunctionEvaluationValue` and reports an error if one them is not an `EDataType` instance. We do not allow arbitrary EMF elements in, so the checks are less likely to have side-effects.

    - #### checkForNotWellbehavingDerivedFeatureInPathExpressions

          public void checkForNotWellbehavingDerivedFeatureInPathExpressions(PathExpressionConstraint pathExpressionConstraint)

      This validator looks up all `EStructuralFeature` used in a `PathExpressionConstraint` and reports a warning on each that is not representable by EMF-IncQuery. This is a warning, since we only see well-behaving extensions in the host.
      Parameters:
        `pathExpressionConstraint` -

    - #### checkReferredPackages

          public void checkReferredPackages(ReferenceType type)

    - #### checkPatternImports

          public void checkPatternImports(XImportSection section)

    - #### checkMissingParameterTypes

          public void checkMissingParameterTypes(Variable variable)

    - #### checkClassPath

          public void checkClassPath(PatternModel modelFile)