Class XbaseValidator
- 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
-
- 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.
-
-
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 XbaseValidator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddImportUnusedIssues(java.util.Map<java.lang.String,java.util.List<XImportDeclaration>> imports)protected java.lang.StringcanonicalName(LightweightTypeReference typeRef)voidcheckAssignment(XAssignment assignment)voidcheckAssignment(XBinaryOperation binaryOperation)protected voidcheckAssignment(XExpression expression, boolean simpleAssignment)protected voidcheckAssignment(XExpression expression, org.eclipse.emf.ecore.EStructuralFeature feature, boolean simpleAssignment)voidcheckAssignment(XPostfixOperation postfixOperation)protected voidcheckCast(org.eclipse.xtext.common.types.JvmTypeReference concreteSyntax, LightweightTypeReference toType, LightweightTypeReference fromType)voidcheckCasts(XCastedExpression cast)voidcheckCatchClausesOrder(XTryCatchFinallyExpression expression)voidcheckClosureParameterTypes(XClosure closure)voidcheckClosureParams(XClosure closure)protected voidcheckConflicts(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)voidcheckConstructorArgumentsAreValid(XFeatureCall featureCall)voidcheckDelegateConstructorIsFirst(XFeatureCall featureCall)protected voidcheckDeprecated(org.eclipse.xtext.common.types.JvmIdentifiableElement object, org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature structuralFeature)voidcheckDeprecated(org.eclipse.xtext.common.types.JvmParameterizedTypeReference type)voidcheckDeprecated(XAbstractFeatureCall expression)voidcheckDeprecated(XConstructorCall expression)voidcheckDeprecated(XTypeLiteral expression)voidcheckDeprecated(XImportDeclaration decl)voidcheckDuplicatedCases(XSwitchExpression switchExpression)voidcheckExplicitOperationCall(XConstructorCall constructorCall)voidcheckExplicitOperationCall(XFeatureCall featureCall)voidcheckExplicitOperationCall(XMemberFeatureCall featureCall)protected voidcheckFinalFieldInitialization(org.eclipse.xtext.common.types.JvmGenericType type)can be called by subclasses to have proper final field initialization checks.voidcheckImports(XImportSection importSection)voidcheckIncompleteCasesOnEnum(XSwitchExpression switchExpression)protected voidcheckInitializationRec(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)voidcheckInnerExpressions(XExpression expr)voidcheckInstanceOf(XInstanceOfExpression instanceOfExpression)voidcheckInstanceOfOrder(XIfExpression expression)protected voidcheckIsValidConstructorArgument(XExpression argument, org.eclipse.xtext.common.types.JvmType containerType)voidcheckLocalUsageOfDeclared(XVariableDeclaration variableDeclaration)voidcheckLocalUsageOfSwitchParameter(XSwitchExpression switchExpression)voidcheckNoCircularConstructorCall(XFeatureCall featureCall)voidcheckNoForwardReferences(XExpression fieldInitializer)protected voidcheckNoJavaStyleTypeCasting(org.eclipse.xtext.nodemodel.INode node)voidcheckNoJavaStyleTypeCasting(XBlockExpression blockExpression)protected voidcheckNumberFormat(XNumberLiteral literal)voidcheckOperandTypesForTripleEquals(XBinaryOperation binaryOperation)voidcheckPrimitiveComparedToNull(XBinaryOperation binaryOperation)voidcheckRedundantCase(XSwitchExpression switchExpression)protected voidcheckReferInvalidTypes(org.eclipse.xtext.common.types.JvmIdentifiableElement element, org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EReference structuralFeature)voidcheckReferInvalidTypes(XAbstractFeatureCall featureCall)voidcheckReferInvalidTypes(XConstructorCall constructorCall)voidcheckReturn(XReturnExpression expr)voidcheckTypeArguments(XAbstractFeatureCall expression)voidcheckTypeArguments(XConstructorCall expression)voidcheckTypeGuards(XCasePart casePart)voidcheckTypeGuardsOrder(XSwitchExpression expression)voidcheckTypeGuardsOrderWithGenerics(XSwitchExpression expression)voidcheckTypeLiteral(XTypeLiteral typeLiteral)voidcheckTypeParameterConstraintIsValid(org.eclipse.xtext.common.types.JvmTypeParameter typeParameter)voidcheckTypeParameterNotUsedInStaticContext(org.eclipse.xtext.common.types.JvmTypeReference ref)voidcheckTypeReferenceIsNotVoid(XCasePart expression)voidcheckTypeReferenceIsNotVoid(XExpression expression)voidcheckTypes(XCatchClause catchClause)voidcheckVariableDeclaration(XVariableDeclaration declaration)voidcheckVariableIsNotInferredAsVoid(XVariableDeclaration declaration)protected booleancontainsTypeArgs(LightweightTypeReference instanceOfType)voiddoCheckTypeParameterForwardReference(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, tooprotected voidensureNotPrimitiveNorWildcard(org.eclipse.xtext.common.types.JvmTypeReference typeRef)protected LightweightTypeReferencegetActualType(org.eclipse.emf.ecore.EObject context, org.eclipse.xtext.common.types.JvmIdentifiableElement element)protected LightweightTypeReferencegetActualType(org.eclipse.xtext.common.types.JvmIdentifiableElement identifiable)protected LightweightTypeReferencegetActualType(XExpression expression)protected java.util.List<org.eclipse.emf.ecore.EPackage>getEPackages()protected LightweightTypeReferencegetExpectedType(XExpression expression)protected XExpressionHelpergetExpressionHelper()protected org.eclipse.xtext.nodemodel.ILeafNodegetFirstLeafNode(org.eclipse.xtext.nodemodel.BidiTreeIterator<org.eclipse.xtext.nodemodel.INode> iterator)protected ILogicalContainerProvidergetLogicalContainerProvider()protected java.lang.StringgetNameOfTypes(LightweightTypeReference expectedType)protected org.eclipse.xtext.nodemodel.INodegetNode(org.eclipse.xtext.nodemodel.BidiTreeIterator<org.eclipse.xtext.nodemodel.INode> iterator, org.eclipse.emf.ecore.EObject... grammarElements)protected java.lang.StringgetReferInvalidTypeMessage(org.eclipse.xtext.common.types.JvmIdentifiableElement element, LightweightTypeReference referencedInvalidType)protected CommonTypeComputationServicesgetServices()protected booleanhasConstructorCallWithThis(org.eclipse.xtext.common.types.JvmConstructor constr)protected booleanisFinal(LightweightTypeReference expressionTypeRef)protected booleanisHandled(LightweightTypeReference actualTypeReference, java.util.Collection<LightweightTypeReference> collection)protected booleanisHidden(org.eclipse.xtext.nodemodel.INode child)protected booleanisInitialized(org.eclipse.xtext.common.types.JvmField input)protected booleanisInterface(org.eclipse.xtext.common.types.JvmType type)protected booleanisLocalClassSemantics(org.eclipse.emf.ecore.EObject object)protected booleanisLocallyUsed(org.eclipse.emf.ecore.EObject target, org.eclipse.emf.ecore.EObject containerToFindUsage)protected booleanisLocalType(org.eclipse.emf.ecore.EObject element)protected booleanisPrimitiveVoid(org.eclipse.xtext.common.types.JvmTypeReference typeReference)protected booleanisSemicolon(org.eclipse.xtext.nodemodel.INode child)protected booleanisStaticContext(org.eclipse.emf.ecore.EObject element)protected booleanisTripleEqualsOperation(XBinaryOperation binaryOperation)protected booleanisValueExpectedRecursive(XExpression expr)protected booleanisXExpressionInsideBlock(org.eclipse.xtext.nodemodel.INode child)protected booleanmemberOfTypeHierarchy(LightweightTypeReference type, LightweightTypeReference potentialMember)protected voidmustBeJavaStatementExpression(XExpression expr)protected voidpopulateMaps(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)protected voidreportFieldAlreadyInitialized(XAssignment assignment, org.eclipse.xtext.common.types.JvmField field)protected voidreportUninitializedField(org.eclipse.xtext.common.types.JvmField field)protected voidreportUninitializedField(org.eclipse.xtext.common.types.JvmField field, org.eclipse.xtext.common.types.JvmConstructor constructor)protected LightweightTypeReferencetoLightweightTypeReference(org.eclipse.xtext.common.types.JvmTypeReference typeRef)protected LightweightTypeReferencetoLightweightTypeReference(org.eclipse.xtext.common.types.JvmTypeReference typeRef, boolean keepUnboundWildcardInformation)-
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, error, getCancelIndicator, getChain, getCheckMode, getContext, getCurrentMethod, getCurrentObject, getIssueSeverities, getMessageAcceptor, guard, handleExceptionDuringValidation, info, info, info, info, info, info, info, info, internalValidate, isIgnored, newInstance, setInjector, setMessageAcceptor, toDiagnosticSeverity, warning, warning, warning, warning, warning, warning, warning, warning
-
-
-
-
Method Detail
-
getServices
protected CommonTypeComputationServices getServices()
-
getActualType
protected LightweightTypeReference getActualType(org.eclipse.emf.ecore.EObject context, org.eclipse.xtext.common.types.JvmIdentifiableElement element)
-
getActualType
protected LightweightTypeReference getActualType(XExpression expression)
-
getActualType
protected LightweightTypeReference getActualType(org.eclipse.xtext.common.types.JvmIdentifiableElement identifiable)
-
getExpectedType
protected LightweightTypeReference getExpectedType(XExpression expression)
-
checkCast
protected void checkCast(org.eclipse.xtext.common.types.JvmTypeReference concreteSyntax, LightweightTypeReference toType, LightweightTypeReference fromType)
-
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(XAbstractFeatureCall expression)
-
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)
-
checkReturn
public void checkReturn(XReturnExpression expr)
-
getNameOfTypes
protected java.lang.String getNameOfTypes(LightweightTypeReference expectedType)
-
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)
-
checkCasts
public void checkCasts(XCastedExpression cast)
-
checkTypeGuards
public void checkTypeGuards(XCasePart casePart)
-
checkInstanceOf
public void checkInstanceOf(XInstanceOfExpression instanceOfExpression)
-
memberOfTypeHierarchy
protected boolean memberOfTypeHierarchy(LightweightTypeReference type, LightweightTypeReference potentialMember)
-
containsTypeArgs
protected boolean containsTypeArgs(LightweightTypeReference instanceOfType)
-
isFinal
protected boolean isFinal(LightweightTypeReference expressionTypeRef)
-
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)
-
getEPackages
protected java.util.List<org.eclipse.emf.ecore.EPackage> getEPackages()
- Overrides:
getEPackagesin classAbstractXbaseValidator
-
canonicalName
protected java.lang.String canonicalName(LightweightTypeReference typeRef)
-
isInterface
protected boolean isInterface(org.eclipse.xtext.common.types.JvmType type)
-
getExpressionHelper
protected XExpressionHelper getExpressionHelper()
-
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)
-
checkCatchClausesOrder
public void checkCatchClausesOrder(XTryCatchFinallyExpression expression)
-
isHandled
protected boolean isHandled(LightweightTypeReference actualTypeReference, java.util.Collection<LightweightTypeReference> collection)
-
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)
-
getLogicalContainerProvider
protected ILogicalContainerProvider getLogicalContainerProvider()
-
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(XImportDeclaration decl)
-
checkDeprecated
public void checkDeprecated(XAbstractFeatureCall expression)
-
checkDeprecated
public void checkDeprecated(XConstructorCall expression)
-
checkDeprecated
public void checkDeprecated(XTypeLiteral expression)
-
checkReferInvalidTypes
public void checkReferInvalidTypes(XAbstractFeatureCall featureCall)
-
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)
-
-