Class EMFPatternLanguageValidator
- 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.viatra.query.patternlanguage.emf.validation.AbstractEMFPatternLanguageValidator
-
- org.eclipse.viatra.query.patternlanguage.emf.validation.EMFPatternLanguageValidator
-
- All Implemented Interfaces:
org.eclipse.emf.ecore.EValidator
,IIssueCallback
,org.eclipse.xtext.validation.ValidationMessageAcceptor
public class EMFPatternLanguageValidator extends AbstractEMFPatternLanguageValidator implements IIssueCallback
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
- No Reference:
-
-
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
-
-
Constructor Summary
Constructors Constructor Description EMFPatternLanguageValidator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
checkDuplicatePackageImports(PatternModel patternModel)
void
checkEnumValues(EnumValue value)
void
checkFeatures(PathExpressionConstraint constraint)
void
checkForCartesianProduct(PatternBody patternBody)
A validator for cartesian products (isolated constraints) in pattern bodies.void
checkForNotWellbehavingDerivedFeatureInPathExpressions(PathExpressionConstraint pathExpressionConstraint)
This validator looks up allEStructuralFeature
used in aPathExpressionConstraint
and reports a warning on each that is not representable by VIATRA Query.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 theCheckConstraint
and reports an error if one them is not anEDataType
instance.void
checkForWrongVariablesInXExpressions(FunctionEvaluationValue eval)
This validator looks up all variables in theFunctionEvaluationValue
and reports an error if one them is not anEDataType
instance.void
checkParametersNamed(Pattern pattern)
void
checkPatternImports(VQLImportSection section)
void
checkPatternName(Pattern pattern)
void
checkPrivatePatternUsage(Pattern pattern)
void
checkReferredPackages(ReferenceType type)
void
checkVariableType(Variable variable)
protected org.eclipse.xtext.validation.AbstractDeclarativeValidator.MethodWrapper
createMethodWrapper(org.eclipse.xtext.validation.AbstractDeclarativeValidator instanceToUse, java.lang.reflect.Method method)
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)
void
info(java.lang.String message, org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.String code, java.lang.String... issueData)
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.emf.validation.AbstractEMFPatternLanguageValidator
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, checkTypeGuardsOrderWithGenerics, 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, error, error, error, error, error, error, error, getCancelIndicator, getChain, getCheckMode, getContext, getCurrentMethod, getCurrentObject, getIssueSeverities, getMessageAcceptor, guard, handleExceptionDuringValidation, info, info, info, info, info, info, info, internalValidate, isIgnored, newInstance, setInjector, setMessageAcceptor, toDiagnosticSeverity, warning, warning, warning, warning, warning, warning, warning
-
-
-
-
Method Detail
-
createMethodWrapper
protected org.eclipse.xtext.validation.AbstractDeclarativeValidator.MethodWrapper createMethodWrapper(org.eclipse.xtext.validation.AbstractDeclarativeValidator instanceToUse, java.lang.reflect.Method method)
- Overrides:
createMethodWrapper
in classorg.eclipse.xtext.validation.AbstractDeclarativeValidator
-
checkDuplicatePackageImports
public void checkDuplicatePackageImports(PatternModel patternModel)
-
checkParametersNamed
public void checkParametersNamed(Pattern pattern)
-
checkEnumValues
public void checkEnumValues(EnumValue value)
-
checkVariableType
public void checkVariableType(Variable variable)
-
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 theCheckConstraint
and reports an error if one them is not anEDataType
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 theFunctionEvaluationValue
and reports an error if one them is not anEDataType
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 allEStructuralFeature
used in aPathExpressionConstraint
and reports a warning on each that is not representable by VIATRA Query. This is a warning, since we only see well-behaving extensions in the host.- Parameters:
pathExpressionConstraint
-
-
checkPatternName
public void checkPatternName(Pattern pattern)
-
checkReferredPackages
public void checkReferredPackages(ReferenceType type)
-
checkPatternImports
public void checkPatternImports(VQLImportSection section)
-
checkPrivatePatternUsage
public void checkPrivatePatternUsage(Pattern pattern)
-
checkFeatures
public void checkFeatures(PathExpressionConstraint constraint)
-
info
public void info(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:
info
in interfaceIIssueCallback
- Overrides:
info
in classorg.eclipse.xtext.validation.AbstractDeclarativeValidator
-
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 interfaceIIssueCallback
- Overrides:
warning
in classorg.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 interfaceIIssueCallback
- Overrides:
error
in classorg.eclipse.xtext.validation.AbstractDeclarativeValidator
-
-