org.eclipse.viatra.query.patternlanguage.validation

## Class PatternLanguageJavaValidator

- 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.viatra.query.patternlanguage.validation.AbstractPatternLanguageJavaValidator
            - - org.eclipse.viatra.query.patternlanguage.validation.PatternLanguageJavaValidator

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

      public class PatternLanguageJavaValidator
      extends AbstractPatternLanguageJavaValidator
      implements IIssueCallback

  Validators for Core Pattern Language.

  Validators implemented:

  - Duplicate parameter in pattern declaration
  - Duplicate pattern definition (name duplication only, better calculation is needed)
  - Pattern call parameter checking (only the number of the parameters, types not supported yet)
  - Empty PatternBody check
  - Check for recursive pattern calls

- - ### Nested Class Summary

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

      `org.eclipse.xtext.validation.AbstractDeclarativeValidator.MethodWrapper, 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
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `ANNOTATION_PARAMETER_TYPE_ERROR`
    `static java.lang.String` | `DUPLICATE_PATTERN_DEFINITION_MESSAGE`
    `static java.lang.String` | `DUPLICATE_VARIABLE_MESSAGE`
    `static java.lang.String` | `EXACTLY_ONE_AGGREGATE_MESSAGE`
    `static java.lang.String` | `INVALID_AGGREGATE_MESSAGE`
    `static java.lang.String` | `MISSING_AGGREGATE_MESSAGE`
    `static java.lang.String` | `MISSING_ANNOTATION_ATTRIBUTE`
    `static java.lang.String` | `RECURSIVE_PATTERN_CALL`
    `static java.lang.String` | `TRANSITIVE_CLOSURE_ARITY_IN_PATTERNCALL`
    `static java.lang.String` | `TRANSITIVE_CLOSURE_ONLY_IN_POSITIVE_COMPOSITION`
    `static java.lang.String` | `UNEXPECTED_AGGREGATE_MESSAGE`
    `static java.lang.String` | `UNKNOWN_ANNOTATION_ATTRIBUTE`
    `static java.lang.String` | `UNUSED_PRIVATE_PATTERN_MESSAGE`
    `static java.lang.String` | `VARIABLE_NAME_DUBIUS_REUSE_MESSAGE_AGGREGATE`
    `static java.lang.String` | `VARIABLE_NAME_DUBIUS_REUSE_MESSAGE_SINGLEUSE`

    - ### 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
    `PatternLanguageJavaValidator()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `checkAggregatorExpression(AggregatedValue expression)` Checks if an aggregator expression has the correct number (0 or 1) aggregate variables.
    `void` | `checkAnnotation(Annotation annotation)`
    `void` | `checkApplicabilityOfTransitiveClosureInPatternCall(PatternCall call)`
    `void` | `checkCompareConstraints(CompareConstraint constraint)`
    `void` | `checkForImpureJavaCallsInCheckConstraints(CheckConstraint checkConstraint)`
    `void` | `checkForImpureJavaCallsInEvalExpressions(FunctionEvaluationValue eval)`
    `void` | `checkNegativeCallParameters(PatternCompositionConstraint constraint)`
    `void` | `checkPackageDeclaration(PatternModel model)`
    `void` | `checkPatternBody(PatternBody body)`
    `void` | `checkPatternCallParameters(PatternCall call)`
    `void` | `checkPatternParameters(Pattern pattern)`
    `void` | `checkPatterns(PatternModel model)`
    `void` | `checkPrivatePatternCall(PatternCall call)`
    `void` | `checkPrivatePatternUsage(Pattern pattern)`
    `void` | `checkRecursivePatternCall(PatternCall call)`
    `void` | `checkReturnTypeOfCheckConstraints(CheckConstraint checkConstraint)`
    `void` | `checkValueReference(VariableReference value)` Checks if an aggregate `VariableReference` is used only in the right context, that is, in an `AggregatedValue` with an aggregator requiring aggregator parameters.
    `void` | `checkVariableNames(PatternBody body)`
    `void` | `error(java.lang.String message, org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.String code, java.lang.String... issueData)`
    `protected java.lang.String` | `getFormattedArgumentsList(PatternCall call)`
    `boolean` | `isNamedSingleUse(Variable variable)` Deprecated. use `CorePatternLanguageHelper.isNamedSingleUse(Variable)` instead
    `boolean` | `isUnnamedSingleUseVariable(Variable variable)` Deprecated. use `CorePatternLanguageHelper#isUnnamedSingleUse(Variable)` instead
    `void` | `warning(java.lang.String message, org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.String code, java.lang.String... issueData)`

    - ### Methods inherited from class org.eclipse.viatra.query.patternlanguage.validation.AbstractPatternLanguageJavaValidator

      `getEPackages`

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

      `addImportUnusedIssues, canonicalName, checkAssignment, checkAssignment, checkAssignment, checkAssignment, checkAssignment, checkCast, checkCasts, checkCatchClausesOrder, checkClosureParameterTypes, checkClosureParams, checkConflicts, checkConstructorArgumentsAreValid, checkDelegateConstructorIsFirst, checkDeprecated, checkDeprecated, checkDeprecated, checkDeprecated, checkDeprecated, checkDeprecated, checkDuplicatedCases, checkExplicitOperationCall, checkExplicitOperationCall, checkExplicitOperationCall, checkFinalFieldInitialization, checkImports, checkIncompleteCasesOnEnum, checkInitializationRec, checkInnerExpressions, checkInstanceOf, checkInstanceOfOrder, checkIsValidConstructorArgument, checkLocalUsageOfDeclared, checkLocalUsageOfSwitchParameter, checkNoCircularConstructorCall, checkNoForwardReferences, checkNoJavaStyleTypeCasting, checkNoJavaStyleTypeCasting, checkNumberFormat, checkOperandTypesForTripleEquals, checkPrimitiveComparedToNull, checkRedundantCase, checkReferInvalidTypes, checkReferInvalidTypes, checkReferInvalidTypes, checkReturn, checkTypeArguments, checkTypeArguments, checkTypeGuards, checkTypeGuardsOrder, checkTypeLiteral, checkTypeParameterConstraintIsValid, checkTypeParameterNotUsedInStaticContext, checkTypeReferenceIsNotVoid, checkTypeReferenceIsNotVoid, checkTypes, checkVariableDeclaration, checkVariableIsNotInferredAsVoid, containsTypeArgs, doCheckTypeParameterForwardReference, ensureNotPrimitiveNorWildcard, getActualType, getActualType, getActualType, getExpectedType, getExpressionHelper, getFirstLeafNode, getLogicalContainerProvider, getNameOfTypes, getNode, getReferInvalidTypeMessage, getServices, hasConstructorCallWithThis, isFinal, isHandled, isHidden, isInitialized, isInterface, isLocalClassSemantics, isLocallyUsed, isLocalType, isPrimitiveVoid, isSemicolon, isStaticContext, isTripleEqualsOperation, isValueExpectedRecursive, isXExpressionInsideBlock, memberOfTypeHierarchy, mustBeJavaStatementExpression, populateMaps, reportFieldAlreadyInitialized, reportUninitializedField, reportUninitializedField, toLightweightTypeReference, toLightweightTypeReference`

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

      `acceptError, acceptError, acceptInfo, acceptInfo, acceptWarning, acceptWarning, addIssue, addIssue, addIssue, addIssue, addIssue, addIssueToState, checkDone, checkIsFromCurrentlyCheckedResource, createDiagnostic, createDiagnostic, createMethodWrapper, error, error, error, error, error, error, error, getChain, getCheckMode, getContext, getCurrentMethod, getCurrentObject, getIssueSeverities, getMessageAcceptor, guard, info, info, info, info, info, info, info, info, internalValidate, isIgnored, newInstance, setInjector, setMessageAcceptor, toDiagnosticSeverity, warning, warning, warning, warning, warning, warning, warning`

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

      `getCurrentLanguage, isLanguageSpecific, isResponsible, register, validate, validate, validate`

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

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

- - ### Field Detail

    - #### DUPLICATE_VARIABLE_MESSAGE

          public static final java.lang.String DUPLICATE_VARIABLE_MESSAGE

      See Also:
        Constant Field Values

    - #### DUPLICATE_PATTERN_DEFINITION_MESSAGE

          public static final java.lang.String DUPLICATE_PATTERN_DEFINITION_MESSAGE

      See Also:
        Constant Field Values

    - #### UNKNOWN_ANNOTATION_ATTRIBUTE

          public static final java.lang.String UNKNOWN_ANNOTATION_ATTRIBUTE

      See Also:
        Constant Field Values

    - #### MISSING_ANNOTATION_ATTRIBUTE

          public static final java.lang.String MISSING_ANNOTATION_ATTRIBUTE

      See Also:
        Constant Field Values

    - #### ANNOTATION_PARAMETER_TYPE_ERROR

          public static final java.lang.String ANNOTATION_PARAMETER_TYPE_ERROR

      See Also:
        Constant Field Values

    - #### TRANSITIVE_CLOSURE_ARITY_IN_PATTERNCALL

          public static final java.lang.String TRANSITIVE_CLOSURE_ARITY_IN_PATTERNCALL

      See Also:
        Constant Field Values

    - #### TRANSITIVE_CLOSURE_ONLY_IN_POSITIVE_COMPOSITION

          public static final java.lang.String TRANSITIVE_CLOSURE_ONLY_IN_POSITIVE_COMPOSITION

      See Also:
        Constant Field Values

    - #### UNUSED_PRIVATE_PATTERN_MESSAGE

          public static final java.lang.String UNUSED_PRIVATE_PATTERN_MESSAGE

      See Also:
        Constant Field Values

    - #### RECURSIVE_PATTERN_CALL

          public static final java.lang.String RECURSIVE_PATTERN_CALL

      See Also:
        Constant Field Values

    - #### INVALID_AGGREGATE_MESSAGE

          public static final java.lang.String INVALID_AGGREGATE_MESSAGE

      Since:
        1.4
      See Also:
        Constant Field Values

    - #### UNEXPECTED_AGGREGATE_MESSAGE

          public static final java.lang.String UNEXPECTED_AGGREGATE_MESSAGE

      Since:
        1.4
      See Also:
        Constant Field Values

    - #### EXACTLY_ONE_AGGREGATE_MESSAGE

          public static final java.lang.String EXACTLY_ONE_AGGREGATE_MESSAGE

      Since:
        1.4
      See Also:
        Constant Field Values

    - #### MISSING_AGGREGATE_MESSAGE

          public static final java.lang.String MISSING_AGGREGATE_MESSAGE

      Since:
        1.4
      See Also:
        Constant Field Values

    - #### VARIABLE_NAME_DUBIUS_REUSE_MESSAGE_SINGLEUSE

          public static final java.lang.String VARIABLE_NAME_DUBIUS_REUSE_MESSAGE_SINGLEUSE

      Since:
        1.4
      See Also:
        Constant Field Values

    - #### VARIABLE_NAME_DUBIUS_REUSE_MESSAGE_AGGREGATE

          public static final java.lang.String VARIABLE_NAME_DUBIUS_REUSE_MESSAGE_AGGREGATE

      Since:
        1.4
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### PatternLanguageJavaValidator

          public PatternLanguageJavaValidator()

  - ### Method Detail

    - #### checkValueReference

          public void checkValueReference(VariableReference value)

      Checks if an aggregate `VariableReference` is used only in the right context, that is, in an `AggregatedValue` with an aggregator requiring aggregator parameters.
      Parameters:
        `value` - the `VariableReference` instance
      Since:
        1.4

    - #### checkAggregatorExpression

          public void checkAggregatorExpression(AggregatedValue expression)

      Checks if an aggregator expression has the correct number (0 or 1) aggregate variables.
      Parameters:
        `expression` - the aggregator expression
      Since:
        1.4

    - #### checkPatternParameters

          public void checkPatternParameters(Pattern pattern)

    - #### checkPrivatePatternUsage

          public void checkPrivatePatternUsage(Pattern pattern)

    - #### checkPrivatePatternCall

          public void checkPrivatePatternCall(PatternCall call)

    - #### checkPatternCallParameters

          public void checkPatternCallParameters(PatternCall call)

    - #### checkApplicabilityOfTransitiveClosureInPatternCall

          public void checkApplicabilityOfTransitiveClosureInPatternCall(PatternCall call)

    - #### checkPatterns

          public void checkPatterns(PatternModel model)

    - #### checkPatternBody

          public void checkPatternBody(PatternBody body)

    - #### checkAnnotation

          public void checkAnnotation(Annotation annotation)

    - #### checkCompareConstraints

          public void checkCompareConstraints(CompareConstraint constraint)

    - #### checkRecursivePatternCall

          public void checkRecursivePatternCall(PatternCall call)

    - #### getFormattedArgumentsList

          protected java.lang.String getFormattedArgumentsList(PatternCall call)

    - #### checkPackageDeclaration

          public void checkPackageDeclaration(PatternModel model)

    - #### checkReturnTypeOfCheckConstraints

          public void checkReturnTypeOfCheckConstraints(CheckConstraint checkConstraint)

    - #### checkVariableNames

          public void checkVariableNames(PatternBody body)

    - #### checkForImpureJavaCallsInCheckConstraints

          public void checkForImpureJavaCallsInCheckConstraints(CheckConstraint checkConstraint)

    - #### checkForImpureJavaCallsInEvalExpressions

          public void checkForImpureJavaCallsInEvalExpressions(FunctionEvaluationValue eval)

    - #### checkNegativeCallParameters

          public void checkNegativeCallParameters(PatternCompositionConstraint constraint)

    - #### warning

          public void warning(java.lang.String message,
                              org.eclipse.emf.ecore.EObject source,
                              org.eclipse.emf.ecore.EStructuralFeature feature,
                              java.lang.String code,
                              java.lang.String... issueData)

      Specified by:
        `warning` in interface `IIssueCallback`
      Overrides:
        `warning` in class `org.eclipse.xtext.validation.AbstractDeclarativeValidator`

    - #### error

          public void error(java.lang.String message,
                            org.eclipse.emf.ecore.EObject source,
                            org.eclipse.emf.ecore.EStructuralFeature feature,
                            java.lang.String code,
                            java.lang.String... issueData)

      Specified by:
        `error` in interface `IIssueCallback`
      Overrides:
        `error` in class `org.eclipse.xtext.validation.AbstractDeclarativeValidator`

    - #### isNamedSingleUse

          @Deprecated
          public boolean isNamedSingleUse(Variable variable)

      Deprecated. use `CorePatternLanguageHelper.isNamedSingleUse(Variable)` instead
      Returns:
        true if the variable is single-use a named variable

    - #### isUnnamedSingleUseVariable

          @Deprecated
          public boolean isUnnamedSingleUseVariable(Variable variable)

      Deprecated. use `CorePatternLanguageHelper#isUnnamedSingleUse(Variable)` instead
      Returns:
        true if the variable is an unnamed single-use variable