public class XbaseJavaValidator extends AbstractXbaseJavaValidator
AbstractDeclarativeValidator.MethodWrapper, 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 void |
addImportUnusedIssues(java.util.Map<java.lang.String,java.util.List<XImportDeclaration>> imports) |
protected java.lang.String |
canonicalName(LightweightTypeReference typeRef) |
void |
checkAssignment(XAssignment assignment) |
void |
checkAssignment(XBinaryOperation binaryOperation) |
protected void |
checkAssignment(XExpression expression,
org.eclipse.emf.ecore.EStructuralFeature feature,
boolean simpleAssignment) |
void |
checkAssignment(XPostfixOperation postfixOperation) |
protected void |
checkCast(JvmTypeReference concreteSyntax,
LightweightTypeReference toType,
LightweightTypeReference fromType) |
void |
checkCasts(XCastedExpression cast) |
void |
checkCatchClausesOrder(XTryCatchFinallyExpression expression) |
void |
checkClosureParameterTypes(XClosure closure) |
void |
checkClosureParams(XClosure closure) |
protected void |
checkConflicts(XImportSection importSection,
java.util.Map<java.lang.String,java.util.List<XImportDeclaration>> imports,
java.util.Map<java.lang.String,JvmType> importedNames) |
void |
checkConstructorArgumentsAreValid(XFeatureCall featureCall) |
void |
checkDelegateConstructorIsFirst(XFeatureCall featureCall) |
protected void |
checkDeprecated(JvmIdentifiableElement object,
org.eclipse.emf.ecore.EObject source,
org.eclipse.emf.ecore.EStructuralFeature structuralFeature) |
void |
checkDeprecated(JvmParameterizedTypeReference type) |
void |
checkDeprecated(XAbstractFeatureCall expression) |
void |
checkDeprecated(XConstructorCall expression) |
void |
checkDeprecated(XImportDeclaration decl) |
void |
checkDeprecated(XTypeLiteral expression) |
void |
checkDuplicatedCases(XSwitchExpression switchExpression) |
void |
checkExplicitOperationCall(XConstructorCall constructorCall) |
void |
checkExplicitOperationCall(XFeatureCall featureCall) |
void |
checkExplicitOperationCall(XMemberFeatureCall featureCall) |
protected void |
checkFinalFieldInitialization(JvmGenericType type)
can be called by subclasses to have proper final field initialization checks.
|
void |
checkImports(XImportSection importSection) |
void |
checkIncompleteCasesOnEnum(XSwitchExpression switchExpression) |
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 |
checkInstanceOfOrder(XIfExpression expression) |
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 |
checkOperandTypesForTripleEquals(XBinaryOperation binaryOperation) |
void |
checkPrimitiveComparedToNull(XBinaryOperation binaryOperation) |
void |
checkRedundantCase(XSwitchExpression switchExpression) |
void |
checkReturn(XReturnExpression expr) |
void |
checkTypeArguments(XAbstractFeatureCall expression) |
void |
checkTypeArguments(XConstructorCall expression) |
void |
checkTypeGuards(XCasePart casePart) |
void |
checkTypeGuardsOrder(XSwitchExpression expression) |
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 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 ILogicalContainerProvider |
getLogicalContainerProvider() |
protected java.lang.String |
getNameOfTypes(LightweightTypeReference expectedType) |
protected INode |
getNode(BidiTreeIterator<INode> iterator,
org.eclipse.emf.ecore.EObject... grammarElements) |
protected CommonTypeComputationServices |
getServices() |
protected boolean |
hasConstructorCallWithThis(JvmConstructor constr) |
protected boolean |
isFinal(LightweightTypeReference expressionTypeRef) |
protected boolean |
isHandled(LightweightTypeReference actualTypeReference,
java.util.Collection<LightweightTypeReference> collection) |
protected boolean |
isHidden(INode child) |
protected boolean |
isInitialized(JvmField input) |
protected boolean |
isInterface(JvmType type) |
protected boolean |
isLocalClassSemantics(org.eclipse.emf.ecore.EObject object) |
protected boolean |
isLocallyUsed(org.eclipse.emf.ecore.EObject target,
org.eclipse.emf.ecore.EObject containerToFindUsage) |
protected boolean |
isLocalType(org.eclipse.emf.ecore.EObject element) |
protected boolean |
isPrimitiveVoid(JvmTypeReference typeReference) |
protected boolean |
isSemicolon(INode child) |
protected boolean |
isStaticContext(org.eclipse.emf.ecore.EObject element) |
protected boolean |
isTripleEqualsOperation(XBinaryOperation binaryOperation) |
protected boolean |
isValueExpectedRecursive(XExpression expr) |
protected boolean |
isXExpressionInsideBlock(INode child) |
protected boolean |
memberOfTypeHierarchy(LightweightTypeReference type,
LightweightTypeReference potentialMember) |
protected void |
mustBeJavaStatementExpression(XExpression expr) |
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,JvmType> importedNames) |
protected void |
reportFieldAlreadyInitialized(XAssignment assignment,
JvmField field) |
protected void |
reportUninitializedField(JvmField field) |
protected void |
reportUninitializedField(JvmField field,
JvmConstructor constructor) |
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, createMethodWrapper, 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 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)
protected boolean isLocalType(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 hasConstructorCallWithThis(JvmConstructor constr)
protected boolean isInitialized(JvmField input)
protected void reportUninitializedField(JvmField field)
protected void reportUninitializedField(JvmField field, JvmConstructor constructor)
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)
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)
protected boolean isLocalClassSemantics(org.eclipse.emf.ecore.EObject object)
public void checkClosureParams(XClosure closure)
public void checkLocalUsageOfDeclared(XVariableDeclaration variableDeclaration)
public void checkTypeLiteral(XTypeLiteral typeLiteral)
public void checkImports(XImportSection importSection)
protected void addImportUnusedIssues(java.util.Map<java.lang.String,java.util.List<XImportDeclaration>> imports)
protected void checkConflicts(XImportSection importSection, java.util.Map<java.lang.String,java.util.List<XImportDeclaration>> imports, java.util.Map<java.lang.String,JvmType> importedNames)
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,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)
public void checkRedundantCase(XSwitchExpression switchExpression)
public void checkDuplicatedCases(XSwitchExpression switchExpression)
public void checkTypeGuardsOrder(XSwitchExpression expression)
public void checkInstanceOfOrder(XIfExpression expression)
public void checkCatchClausesOrder(XTryCatchFinallyExpression expression)
protected boolean isHandled(LightweightTypeReference actualTypeReference, java.util.Collection<LightweightTypeReference> collection)
public void checkIncompleteCasesOnEnum(XSwitchExpression switchExpression)
public void checkAssignment(XBinaryOperation binaryOperation)
public void checkOperandTypesForTripleEquals(XBinaryOperation binaryOperation)
protected boolean isTripleEqualsOperation(XBinaryOperation binaryOperation)
public void checkAssignment(XPostfixOperation postfixOperation)
public void checkExplicitOperationCall(XFeatureCall featureCall)
public void checkExplicitOperationCall(XMemberFeatureCall featureCall)
public void checkExplicitOperationCall(XConstructorCall constructorCall)
protected void checkAssignment(XExpression expression, org.eclipse.emf.ecore.EStructuralFeature feature, boolean simpleAssignment)
protected ILogicalContainerProvider getLogicalContainerProvider()
protected void checkDeprecated(JvmIdentifiableElement object, org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature structuralFeature)
public void checkDeprecated(JvmParameterizedTypeReference type)
public void checkDeprecated(XImportDeclaration decl)
public void checkDeprecated(XAbstractFeatureCall expression)
public void checkDeprecated(XConstructorCall expression)
public void checkDeprecated(XTypeLiteral expression)