public class XbaseJavaValidator extends AbstractXbaseJavaValidator
AbstractDeclarativeValidator.State, AbstractDeclarativeValidator.StateAccess
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
CURRENT_LANGUAGE_NAME, ISSUE_SEVERITIES
INSIGNIFICANT_INDEX
Constructor and Description |
---|
XbaseJavaValidator() |
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
canonicalName(LightweightTypeReference typeRef) |
void |
checkAssignment(XAssignment assignment) |
protected void |
checkCast(JvmTypeReference concreteSyntax,
LightweightTypeReference toType,
LightweightTypeReference fromType) |
void |
checkCasts(XCastedExpression cast) |
void |
checkClosureParameterTypes(XClosure closure) |
void |
checkClosureParams(XClosure closure) |
void |
checkConstructorArgumentsAreValid(XFeatureCall featureCall) |
void |
checkDelegateConstructorIsFirst(XFeatureCall featureCall) |
protected void |
checkFinalFieldInitialization(JvmGenericType type)
can be called by subclasses to have proper final field initialization checks.
|
void |
checkImports(XImportSection importSection) |
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) |
protected void |
checkIsValidConstructorArgument(XExpression argument,
JvmType containerType) |
void |
checkLocalUsageOfDeclared(XVariableDeclaration variableDeclaration) |
void |
checkNoCircularConstructorCall(XFeatureCall featureCall) |
void |
checkNoForwardReferences(XExpression fieldInitializer) |
protected void |
checkNoJavaStyleTypeCasting(INode node) |
void |
checkNoJavaStyleTypeCasting(XBlockExpression blockExpression) |
protected void |
checkNumberFormat(XNumberLiteral literal) |
void |
checkPrimitiveComparedToNull(XBinaryOperation binaryOperation) |
void |
checkReturn(XReturnExpression expr) |
void |
checkTypeArguments(XAbstractFeatureCall expression) |
void |
checkTypeArguments(XConstructorCall expression) |
void |
checkTypeGuards(XCasePart casePart) |
void |
checkTypeLiteral(XTypeLiteral typeLiteral) |
void |
checkTypeParameterConstraintIsValid(JvmTypeParameter typeParameter) |
void |
checkTypeParameterNotUsedInStaticContext(JvmTypeReference ref) |
void |
checkTypeReferenceIsNotVoid(XCasePart expression) |
void |
checkTypeReferenceIsNotVoid(XExpression expression) |
void |
checkTypes(XCatchClause catchClause) |
void |
checkVariableDeclaration(XVariableDeclaration declaration) |
void |
checkVariableIsNotInferredAsVoid(XVariableDeclaration declaration) |
protected java.util.Set<org.eclipse.emf.ecore.EObject> |
collectPrimarySourceElements(XImportSection importSection,
java.util.Map<JvmType,XImportDeclaration> imports,
java.util.Map<java.lang.String,JvmType> importedNames) |
protected boolean |
containsTypeArgs(LightweightTypeReference instanceOfType) |
void |
doCheckTypeParameterForwardReference(java.util.List<JvmTypeParameter> sourceTypeParameters)
Java 5 does not allow forward references in type parameters, so we have to validate this, too
|
protected void |
ensureNotPrimitiveNorWildcard(JvmTypeReference typeRef) |
protected LightweightTypeReference |
getActualType(org.eclipse.emf.ecore.EObject context,
JvmIdentifiableElement element) |
protected LightweightTypeReference |
getActualType(JvmIdentifiableElement identifiable) |
protected LightweightTypeReference |
getActualType(XExpression expression) |
protected java.util.List<org.eclipse.emf.ecore.EPackage> |
getEPackages() |
protected LightweightTypeReference |
getExpectedType(XExpression expression) |
protected XExpressionHelper |
getExpressionHelper() |
protected ILeafNode |
getFirstLeafNode(BidiTreeIterator<INode> iterator) |
protected java.lang.String |
getNameOfTypes(LightweightTypeReference expectedType) |
protected INode |
getNode(BidiTreeIterator<INode> iterator,
org.eclipse.emf.ecore.EObject... grammarElements) |
protected CommonTypeComputationServices |
getServices() |
protected void |
handleTypeUsageInComment(java.util.Map<JvmType,XImportDeclaration> imports,
java.util.Map<java.lang.String,JvmType> importedNames,
INode n) |
protected void |
handleTypeUsageInCrossReference(java.util.Map<JvmType,XImportDeclaration> imports,
java.util.Map<java.lang.String,JvmType> importedNames,
INode n) |
protected void |
handleTypeUsageInStaticFeatureCall(java.util.Map<JvmType,XImportDeclaration> staticImports,
java.util.Map<JvmType,XImportDeclaration> extensionImports,
INode node) |
protected void |
handleTypeUsageInTypeLiteral(java.util.Map<JvmType,XImportDeclaration> imports,
java.util.Map<java.lang.String,JvmType> importedNames,
XAbstractFeatureCall featureCall,
INode node) |
protected boolean |
isFinal(LightweightTypeReference expressionTypeRef) |
protected boolean |
isHidden(INode child) |
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 |
isPrimitiveVoid(JvmTypeReference typeReference) |
protected boolean |
isSemicolon(INode child) |
protected boolean |
isStaticContext(org.eclipse.emf.ecore.EObject element) |
protected boolean |
isValueExpectedRecursive(XExpression expr) |
protected boolean |
isXExpressionInsideBlock(INode child) |
protected boolean |
markImportUsed(java.util.Map<JvmType,XImportDeclaration> imports,
java.util.Map<java.lang.String,JvmType> importedNames,
java.lang.String simpleName,
java.lang.String delimiter) |
protected boolean |
memberOfTypeHierarchy(LightweightTypeReference type,
LightweightTypeReference potentialMember) |
protected void |
mustBeJavaStatementExpression(XExpression expr) |
protected void |
populateMaps(XImportSection importSection,
java.util.Map<JvmType,XImportDeclaration> imports,
java.util.Map<JvmType,XImportDeclaration> staticImports,
java.util.Map<JvmType,XImportDeclaration> extensionImports,
java.util.Map<java.lang.String,JvmType> importedNames) |
protected void |
reportFieldAlreadyInitialized(XAssignment assignment,
JvmField field) |
protected void |
reportUninitializedField(JvmField field) |
protected LightweightTypeReference |
toLightweightTypeReference(JvmTypeReference typeRef) |
protected LightweightTypeReference |
toLightweightTypeReference(JvmTypeReference typeRef,
boolean keepUnboundWildcardInformation) |
acceptError, acceptError, acceptInfo, acceptInfo, acceptWarning, acceptWarning, addIssue, addIssue, addIssue, addIssue, addIssue, addIssueToState, checkDone, checkIsFromCurrentlyCheckedResource, createDiagnostic, createDiagnostic, error, 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, warning
getCurrentLanguage, isLanguageSpecific, isResponsible, register, validate, validate, validate
protected CommonTypeComputationServices getServices()
protected LightweightTypeReference getActualType(org.eclipse.emf.ecore.EObject context, JvmIdentifiableElement element)
protected LightweightTypeReference getActualType(XExpression expression)
protected LightweightTypeReference getActualType(JvmIdentifiableElement identifiable)
protected LightweightTypeReference getExpectedType(XExpression expression)
protected void checkCast(JvmTypeReference concreteSyntax, LightweightTypeReference toType, LightweightTypeReference fromType)
protected void checkNumberFormat(XNumberLiteral literal)
public void checkTypeReferenceIsNotVoid(XExpression expression)
protected boolean isPrimitiveVoid(JvmTypeReference typeReference)
public void checkVariableIsNotInferredAsVoid(XVariableDeclaration declaration)
public void checkClosureParameterTypes(XClosure closure)
public void checkTypeArguments(XAbstractFeatureCall expression)
public void checkTypeArguments(XConstructorCall expression)
protected void ensureNotPrimitiveNorWildcard(JvmTypeReference typeRef)
protected LightweightTypeReference toLightweightTypeReference(JvmTypeReference typeRef)
protected LightweightTypeReference toLightweightTypeReference(JvmTypeReference typeRef, boolean keepUnboundWildcardInformation)
public void checkTypeReferenceIsNotVoid(XCasePart expression)
public void checkReturn(XReturnExpression expr)
protected boolean isImplicitReturn(XExpression expr)
protected java.lang.String getNameOfTypes(LightweightTypeReference expectedType)
public void checkTypes(XCatchClause catchClause)
public void checkTypeParameterNotUsedInStaticContext(JvmTypeReference ref)
protected boolean isStaticContext(org.eclipse.emf.ecore.EObject element)
public void checkTypeParameterConstraintIsValid(JvmTypeParameter typeParameter)
public void doCheckTypeParameterForwardReference(java.util.List<JvmTypeParameter> sourceTypeParameters)
public void checkAssignment(XAssignment assignment)
protected void checkFinalFieldInitialization(JvmGenericType type)
protected boolean isInitialized(JvmField input)
protected void reportUninitializedField(JvmField field)
protected void reportFieldAlreadyInitialized(XAssignment assignment, JvmField field)
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)
public void checkVariableDeclaration(XVariableDeclaration declaration)
public void checkInnerExpressions(XExpression expr)
protected boolean isValueExpectedRecursive(XExpression expr)
protected void mustBeJavaStatementExpression(XExpression expr)
public void checkCasts(XCastedExpression cast)
public void checkTypeGuards(XCasePart casePart)
public void checkInstanceOf(XInstanceOfExpression instanceOfExpression)
protected boolean memberOfTypeHierarchy(LightweightTypeReference type, LightweightTypeReference potentialMember)
@NonNullByDefault protected boolean containsTypeArgs(LightweightTypeReference instanceOfType)
protected boolean isFinal(LightweightTypeReference expressionTypeRef)
public void checkDelegateConstructorIsFirst(XFeatureCall featureCall)
public void checkConstructorArgumentsAreValid(XFeatureCall featureCall)
protected void checkIsValidConstructorArgument(XExpression argument, JvmType containerType)
public void checkNoCircularConstructorCall(XFeatureCall featureCall)
public void checkNoForwardReferences(XExpression fieldInitializer)
public void checkClosureParams(XClosure closure)
public void checkLocalUsageOfDeclared(XVariableDeclaration variableDeclaration)
public void checkTypeLiteral(XTypeLiteral typeLiteral)
public void checkImports(XImportSection importSection)
protected void handleTypeUsageInStaticFeatureCall(java.util.Map<JvmType,XImportDeclaration> staticImports, java.util.Map<JvmType,XImportDeclaration> extensionImports, INode node)
protected void handleTypeUsageInComment(java.util.Map<JvmType,XImportDeclaration> imports, java.util.Map<java.lang.String,JvmType> importedNames, INode n)
protected void handleTypeUsageInTypeLiteral(java.util.Map<JvmType,XImportDeclaration> imports, java.util.Map<java.lang.String,JvmType> importedNames, XAbstractFeatureCall featureCall, INode node)
protected void handleTypeUsageInCrossReference(java.util.Map<JvmType,XImportDeclaration> imports, java.util.Map<java.lang.String,JvmType> importedNames, INode n)
protected boolean markImportUsed(java.util.Map<JvmType,XImportDeclaration> imports, java.util.Map<java.lang.String,JvmType> importedNames, java.lang.String simpleName, java.lang.String delimiter)
protected java.util.Set<org.eclipse.emf.ecore.EObject> collectPrimarySourceElements(XImportSection importSection, java.util.Map<JvmType,XImportDeclaration> imports, java.util.Map<java.lang.String,JvmType> importedNames)
protected void populateMaps(XImportSection importSection, java.util.Map<JvmType,XImportDeclaration> imports, java.util.Map<JvmType,XImportDeclaration> staticImports, java.util.Map<JvmType,XImportDeclaration> extensionImports, java.util.Map<java.lang.String,JvmType> importedNames)
public void checkPrimitiveComparedToNull(XBinaryOperation binaryOperation)
protected boolean isLocallyUsed(org.eclipse.emf.ecore.EObject target, org.eclipse.emf.ecore.EObject containerToFindUsage)
protected java.util.List<org.eclipse.emf.ecore.EPackage> getEPackages()
getEPackages
in class AbstractXbaseJavaValidator
protected java.lang.String canonicalName(LightweightTypeReference typeRef)
protected boolean isInterface(JvmType type)
protected XExpressionHelper getExpressionHelper()
public void checkNoJavaStyleTypeCasting(XBlockExpression blockExpression)
protected boolean isXExpressionInsideBlock(INode child)
protected boolean isSemicolon(INode child)
protected void checkNoJavaStyleTypeCasting(INode node)
protected INode getNode(BidiTreeIterator<INode> iterator, org.eclipse.emf.ecore.EObject... grammarElements)
protected ILeafNode getFirstLeafNode(BidiTreeIterator<INode> iterator)
protected boolean isHidden(INode child)