org.eclipse.xtext.xbase.validation
Class XbaseJavaValidator
java.lang.Object
org.eclipse.xtext.validation.AbstractInjectableValidator
org.eclipse.xtext.validation.AbstractDeclarativeValidator
org.eclipse.xtext.xbase.validation.AbstractXbaseJavaValidator
org.eclipse.xtext.xbase.validation.XbaseJavaValidator
- All Implemented Interfaces:
- org.eclipse.emf.ecore.EValidator, ValidationMessageAcceptor
- Direct Known Subclasses:
- AbstractPureXbaseJavaValidator, AbstractXbaseWithAnnotationsJavaValidator, PureXbaseJavaValidator, XbaseWithAnnotationsJavaValidator
public class XbaseJavaValidator
- extends AbstractXbaseJavaValidator
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 |
Fields inherited from interface org.eclipse.emf.ecore.EValidator |
MARKER, RELATED_URIS_ATTRIBUTE, URI_ATTRIBUTE |
Method Summary |
protected java.lang.String |
canonicalName(JvmType type)
|
protected java.lang.String |
canonicalName(JvmTypeReference typeRef)
|
void |
checkAssignment(XAssignment assignment)
|
protected void |
checkCast(JvmTypeReference toType,
JvmTypeReference fromType)
|
void |
checkCasts(XCastedExpression cast)
|
void |
checkClosureParameterTypes(XClosure closure)
|
void |
checkClosureParams(XClosure closure)
|
void |
checkConstructorArgumentsAreValid(XFeatureCall featureCall)
|
protected void |
checkDeclaredVariableName(org.eclipse.emf.ecore.EObject nameAndAttributeDeclarator,
org.eclipse.emf.ecore.EAttribute attr)
|
protected void |
checkDeclaredVariableName(org.eclipse.emf.ecore.EObject nameDeclarator,
org.eclipse.emf.ecore.EObject attributeHolder,
org.eclipse.emf.ecore.EAttribute attr)
|
void |
checkDelegateConstructorIsFirst(XFeatureCall featureCall)
|
void |
checkExceptionsInClosure(XClosure closure)
|
protected void |
checkFinalFieldInitialization(JvmGenericType type)
can be called by subclasses to have proper final field initialization checks. |
void |
checkImplicitReturn(XExpression expr)
|
protected void |
checkInitializationRec(org.eclipse.emf.ecore.EObject expr,
java.util.Set<JvmField> fields,
java.util.Set<JvmField> initializedForSure,
java.util.Set<JvmField> initializedMaybe,
java.util.Set<JvmConstructor> visited)
|
void |
checkInnerExpressions(XExpression expr)
|
void |
checkInstanceOf(XInstanceOfExpression instanceOfExpression)
|
void |
checkInstantiationOfAbstractClass(XConstructorCall constructorCall)
|
protected void |
checkIsValidConstructorArgument(XExpression argument)
|
void |
checkLocalUsageOfDeclared(XVariableDeclaration variableDeclaration)
|
void |
checkNoCircularConstructorCall(XFeatureCall featureCall)
|
void |
checkNoForwardReferences(XExpression fieldInitializer)
|
protected void |
checkNumberFormat(XNumberLiteral literal)
|
void |
checkReceiverOfStaticFeature(XFeatureCall featureCall)
|
void |
checkReceiverOfStaticFeature(XMemberFeatureCall featureCall)
|
void |
checkReturn(XReturnExpression expr)
|
void |
checkSpreadOperatorNotUsed(XMemberFeatureCall featureCall)
|
void |
checkTypeArguments(XAbstractFeatureCall expression)
|
void |
checkTypeArguments(XConstructorCall expression)
|
void |
checkTypeGuards(XCasePart casePart)
|
void |
checkTypeReferenceIsNotVoid(XCasePart expression)
|
void |
checkTypeReferenceIsNotVoid(XExpression expression)
|
void |
checkTypes(XCatchClause catchClause)
|
void |
checkTypes(XExpression obj)
|
void |
checkTypes(XForLoopExpression obj)
|
void |
checkUnhandledException(XExpression expression)
|
void |
checkUniqueVariableName(XClosure closure)
|
void |
checkUniqueVariableName(XForLoopExpression forLoop)
|
void |
checkUniqueVariableName(XSwitchExpression decl)
|
void |
checkUniqueVariableName(XTryCatchFinallyExpression tryCatch)
|
void |
checkUniqueVariableName(XVariableDeclaration decl)
|
void |
checkVariableDeclaration(XVariableDeclaration declaration)
|
void |
checkVariableIsNotInferredAsVoid(XVariableDeclaration declaration)
|
protected boolean |
containsTypeArgs(JvmTypeReference instanceOfType)
|
protected void |
doCheckReceiverOfStaticFeature(XAbstractFeatureCall featureCall,
XExpression receiver)
|
protected void |
doCheckUnhandledException(XExpression expression,
java.util.List<JvmTypeReference> declaredExceptions)
|
protected void |
ensureNotPrimitiveNorWildcard(JvmTypeReference typeRef)
|
protected java.lang.Iterable<JvmTypeReference> |
findUnhandledExceptions(org.eclipse.emf.ecore.EObject context,
java.lang.Iterable<JvmTypeReference> thrownExceptions,
java.util.List<JvmTypeReference> declaredExceptions)
|
protected java.util.Set<java.lang.String> |
getDisallowedVariableNames()
|
protected IEarlyExitComputer |
getEarlyExitComputer()
|
protected java.util.List<org.eclipse.emf.ecore.EPackage> |
getEPackages()
|
protected java.lang.String |
getNameOfTypes(JvmTypeReference expectedType)
|
protected XbaseScopeProvider |
getScopeProvider()
|
protected java.util.Set<org.eclipse.emf.ecore.EReference> |
getTypeConformanceCheckedReferences()
|
protected ITypeProvider |
getTypeProvider()
|
protected TypeReferences |
getTypeRefs()
|
protected TypesFactory |
getTypesFactory()
|
protected boolean |
isConformant(JvmType leftType,
JvmTypeReference right)
|
protected boolean |
isConformant(JvmTypeReference left,
JvmTypeReference right)
|
protected boolean |
isFinal(JvmTypeReference expressionTypeRef)
|
protected boolean |
isImplicitReturn(XExpression expr)
|
protected boolean |
isInitialized(JvmField input)
|
protected boolean |
isInterface(JvmType type)
|
protected boolean |
isLocallyUsed(org.eclipse.emf.ecore.EObject target,
org.eclipse.emf.ecore.EObject containerToFindUsage)
|
protected boolean |
isValueExpectedRecursive(XExpression expr)
|
protected boolean |
memberOfTypeHierarchy(JvmTypeReference type,
JvmTypeReference potentialMember)
|
protected void |
mustBeJavaStatementExpression(XExpression expr)
|
protected void |
reportFieldAlreadyInitialized(XAssignment assignment,
JvmField field)
|
protected void |
reportUnhandledException(XExpression element,
JvmTypeReference thrownException)
|
protected void |
reportUninitializedField(JvmField field)
|
protected boolean |
supportsCheckedExceptions()
|
protected void |
validateType(XExpression expression,
Procedures.Procedure2<JvmTypeReference,JvmTypeReference> messageProducer)
|
Methods inherited from class org.eclipse.xtext.validation.AbstractDeclarativeValidator |
acceptError, acceptError, acceptInfo, acceptInfo, acceptWarning, acceptWarning, checkDone, createDiagnostic, createDiagnostic, error, error, error, error, error, error, error, getChain, getCheckMode, getContext, getCurrentMethod, getCurrentObject, getMessageAcceptor, guard, info, info, info, info, info, info, internalValidate, newInstance, setInjector, setMessageAcceptor, toDiagnosticSeverity, warning, warning, warning, warning, warning, warning, warning |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
XbaseJavaValidator
public XbaseJavaValidator()
getTypeConformanceCheckedReferences
protected java.util.Set<org.eclipse.emf.ecore.EReference> getTypeConformanceCheckedReferences()
checkNumberFormat
protected void checkNumberFormat(XNumberLiteral literal)
checkTypeReferenceIsNotVoid
public void checkTypeReferenceIsNotVoid(XExpression expression)
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(JvmTypeReference typeRef)
checkTypeReferenceIsNotVoid
public void checkTypeReferenceIsNotVoid(XCasePart expression)
checkUniqueVariableName
public void checkUniqueVariableName(XVariableDeclaration decl)
checkUniqueVariableName
public void checkUniqueVariableName(XSwitchExpression decl)
checkUniqueVariableName
public void checkUniqueVariableName(XForLoopExpression forLoop)
checkUniqueVariableName
public void checkUniqueVariableName(XClosure closure)
checkUniqueVariableName
public void checkUniqueVariableName(XTryCatchFinallyExpression tryCatch)
checkDeclaredVariableName
protected void checkDeclaredVariableName(org.eclipse.emf.ecore.EObject nameAndAttributeDeclarator,
org.eclipse.emf.ecore.EAttribute attr)
checkDeclaredVariableName
protected void checkDeclaredVariableName(org.eclipse.emf.ecore.EObject nameDeclarator,
org.eclipse.emf.ecore.EObject attributeHolder,
org.eclipse.emf.ecore.EAttribute attr)
getDisallowedVariableNames
protected java.util.Set<java.lang.String> getDisallowedVariableNames()
getScopeProvider
protected XbaseScopeProvider getScopeProvider()
checkTypes
public void checkTypes(XExpression obj)
validateType
protected void validateType(XExpression expression,
Procedures.Procedure2<JvmTypeReference,JvmTypeReference> messageProducer)
checkReceiverOfStaticFeature
public void checkReceiverOfStaticFeature(XMemberFeatureCall featureCall)
checkReceiverOfStaticFeature
public void checkReceiverOfStaticFeature(XFeatureCall featureCall)
doCheckReceiverOfStaticFeature
protected void doCheckReceiverOfStaticFeature(XAbstractFeatureCall featureCall,
XExpression receiver)
checkImplicitReturn
public void checkImplicitReturn(XExpression expr)
checkReturn
public void checkReturn(XReturnExpression expr)
isImplicitReturn
protected boolean isImplicitReturn(XExpression expr)
getNameOfTypes
protected java.lang.String getNameOfTypes(JvmTypeReference expectedType)
checkTypes
public void checkTypes(XForLoopExpression obj)
checkTypes
public void checkTypes(XCatchClause catchClause)
checkAssignment
public void checkAssignment(XAssignment assignment)
checkFinalFieldInitialization
protected void checkFinalFieldInitialization(JvmGenericType type)
- can be called by subclasses to have proper final field initialization checks.
isInitialized
protected boolean isInitialized(JvmField input)
reportUninitializedField
protected void reportUninitializedField(JvmField field)
reportFieldAlreadyInitialized
protected void reportFieldAlreadyInitialized(XAssignment assignment,
JvmField field)
checkInitializationRec
protected void checkInitializationRec(org.eclipse.emf.ecore.EObject expr,
java.util.Set<JvmField> fields,
java.util.Set<JvmField> initializedForSure,
java.util.Set<JvmField> initializedMaybe,
java.util.Set<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)
checkCast
protected void checkCast(JvmTypeReference toType,
JvmTypeReference fromType)
checkTypeGuards
public void checkTypeGuards(XCasePart casePart)
checkInstanceOf
public void checkInstanceOf(XInstanceOfExpression instanceOfExpression)
memberOfTypeHierarchy
protected boolean memberOfTypeHierarchy(JvmTypeReference type,
JvmTypeReference potentialMember)
containsTypeArgs
protected boolean containsTypeArgs(JvmTypeReference instanceOfType)
isFinal
protected boolean isFinal(JvmTypeReference expressionTypeRef)
checkInstantiationOfAbstractClass
public void checkInstantiationOfAbstractClass(XConstructorCall constructorCall)
checkDelegateConstructorIsFirst
public void checkDelegateConstructorIsFirst(XFeatureCall featureCall)
checkConstructorArgumentsAreValid
public void checkConstructorArgumentsAreValid(XFeatureCall featureCall)
checkIsValidConstructorArgument
protected void checkIsValidConstructorArgument(XExpression argument)
checkNoCircularConstructorCall
public void checkNoCircularConstructorCall(XFeatureCall featureCall)
checkNoForwardReferences
public void checkNoForwardReferences(XExpression fieldInitializer)
checkClosureParams
public void checkClosureParams(XClosure closure)
checkExceptionsInClosure
public void checkExceptionsInClosure(XClosure closure)
checkUnhandledException
public void checkUnhandledException(XExpression expression)
supportsCheckedExceptions
protected boolean supportsCheckedExceptions()
doCheckUnhandledException
protected void doCheckUnhandledException(XExpression expression,
java.util.List<JvmTypeReference> declaredExceptions)
findUnhandledExceptions
protected java.lang.Iterable<JvmTypeReference> findUnhandledExceptions(org.eclipse.emf.ecore.EObject context,
java.lang.Iterable<JvmTypeReference> thrownExceptions,
java.util.List<JvmTypeReference> declaredExceptions)
reportUnhandledException
protected void reportUnhandledException(XExpression element,
JvmTypeReference thrownException)
checkSpreadOperatorNotUsed
public void checkSpreadOperatorNotUsed(XMemberFeatureCall featureCall)
checkLocalUsageOfDeclared
public void checkLocalUsageOfDeclared(XVariableDeclaration variableDeclaration)
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:
getEPackages
in class AbstractXbaseJavaValidator
canonicalName
protected java.lang.String canonicalName(JvmTypeReference typeRef)
canonicalName
protected java.lang.String canonicalName(JvmType type)
isInterface
protected boolean isInterface(JvmType type)
isConformant
protected boolean isConformant(JvmType leftType,
JvmTypeReference right)
isConformant
protected boolean isConformant(JvmTypeReference left,
JvmTypeReference right)
getTypeProvider
protected ITypeProvider getTypeProvider()
getTypeRefs
protected TypeReferences getTypeRefs()
getTypesFactory
protected TypesFactory getTypesFactory()
getEarlyExitComputer
protected IEarlyExitComputer getEarlyExitComputer()