org.eclipse.xtend.core.validation
Class XtendJavaValidator

java.lang.Object
  extended by org.eclipse.xtext.validation.AbstractInjectableValidator
      extended by org.eclipse.xtext.validation.AbstractDeclarativeValidator
          extended by org.eclipse.xtext.xbase.validation.AbstractXbaseJavaValidator
              extended by org.eclipse.xtext.xbase.validation.XbaseJavaValidator
                  extended by org.eclipse.xtext.xbase.annotations.validation.XbaseWithAnnotationsJavaValidator
                      extended by org.eclipse.xtend.core.validation.XtendJavaValidator
All Implemented Interfaces:
org.eclipse.emf.ecore.EValidator, ValidationMessageAcceptor

public class XtendJavaValidator
extends XbaseWithAnnotationsJavaValidator

Author:
Jan Koehnlein - Initial contribution and API, Sebastian Zarnekow, Sven Efftinge, Holger Schill

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.xtext.validation.AbstractDeclarativeValidator
AbstractDeclarativeValidator.State, 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
 
Field Summary
 
Fields inherited from class org.eclipse.xtext.validation.AbstractInjectableValidator
CURRENT_LANGUAGE_NAME
 
Fields inherited from interface org.eclipse.xtext.validation.ValidationMessageAcceptor
INSIGNIFICANT_INDEX
 
Fields inherited from interface org.eclipse.emf.ecore.EValidator
MARKER, RELATED_URIS_ATTRIBUTE, URI_ATTRIBUTE
 
Constructor Summary
XtendJavaValidator()
           
 
Method Summary
protected  void addDispatchError(JvmGenericType type, java.lang.Iterable<JvmOperation> operations, java.lang.String message, org.eclipse.emf.ecore.EStructuralFeature preferredFeature, java.lang.String ISSUE_ID)
           
protected  void addDispatchError(JvmOperation jvmOperation, java.lang.String message, org.eclipse.emf.ecore.EStructuralFeature preferredFeature, java.lang.String ISSUE_ID)
           
protected  java.lang.Iterable<JvmOperation> allSuperOperations(XtendClass xtendClass)
           
protected  java.lang.String canonicalName(JvmIdentifiableElement element)
           
 void checkAbstract(XtendFunction function)
           
 void checkAnnotationTarget(XAnnotation annotation)
           
 void checkAssignment(XAssignment assignment)
           
 void checkClasses(XtendFile file)
           
 void checkClassPath(XtendClass clazz)
           
 void checkCreateFunctionIsNotGeneric(XtendFunction func)
           
 void checkCreateFunctionIsNotStatic(XtendFunction func)
           
 void checkCreateFunctionIsNotTypeVoid(XtendFunction func)
           
 void checkDeclaredExceptions(XtendConstructor constructor)
           
 void checkDeclaredExceptions(XtendFunction function)
           
 void checkDefaultSuperConstructor(XtendClass xtendClass)
           
 void checkDispatchFunctions(XtendClass clazz)
           
protected  void checkDispatchNonDispatchConflict(XtendClass clazz, com.google.common.collect.Multimap<Pair<java.lang.String,java.lang.Integer>,JvmOperation> dispatchMethods)
           
 void checkDuplicateAndOverriddenFunctions(XtendClass xtendClass)
           
 void checkFinalFieldInitialization(XtendClass clazz)
           
protected  void checkFunctionOverride(XtendFunction function)
           
 void checkImports(XtendFile file)
           
 void checkJavaKeywordConflict(XtendClass member)
           
 void checkJavaKeywordConflict(XtendConstructor member)
           
 void checkJavaKeywordConflict(XtendField member)
           
 void checkJavaKeywordConflict(XtendFunction member)
           
 void checkLeftHandSideIsVariable(XAssignment assignment)
           
 void checkLocalUsageOfDeclaredFields(XtendField field)
           
 void checkLocalUsageOfDeclaredXtendFunction(XtendFunction function)
           
 void checkMemberNamesAreUnique(XtendClass xtendClass)
           
protected  void checkNoJavaKeyword(org.eclipse.emf.ecore.EObject obj, org.eclipse.emf.ecore.EAttribute attribute)
           
 void checkNonInitializedFieldsHaveAType(XtendField field)
           
 void checkNoReturnsInCreateExtensions(XtendFunction func)
           
 void checkNoVoidInDependencyDeclaration(XtendField dep)
           
 void checkParameterNames(XtendConstructor constructor)
           
 void checkParameterNames(XtendFunction function)
           
 void checkPropertyAnnotation(XtendField field)
           
 void checkSuperTypes(XtendClass xtendClass)
           
 void checkTypeParametersAreUnsupported(XtendConstructor constructor)
           
 void checkVarArgComesLast(XtendParameter param)
           
 void checkVariableNameShadowing(XtendFunction func)
           
 void checkWhitespaceInRichStrings(RichString richString)
           
 void checkXtendParameterNotPrimitiveVoid(XtendParameter param)
           
protected  void collectReturnExpressions(org.eclipse.emf.ecore.EObject expr, java.util.List<XReturnExpression> found)
           
 void dispatchFuncWithTypeParams(XtendFunction func)
           
protected  void doCheckDuplicateExecutables(JvmGenericType inferredType, com.google.common.collect.Multimap<java.lang.Object,? extends JvmExecutable> executablesPerErasure)
           
protected  void doCheckOverriddenMethods(XtendClass xtendClass, JvmGenericType inferredType, ITypeArgumentContext typeArgumentContext, com.google.common.collect.Multimap<java.lang.Object,JvmOperation> operationsPerErasure)
           
 boolean doCheckValidMemberName(XtendMember member)
           
protected  void doCheckWhitespaceIn(RichString richString)
           
protected  java.lang.String doGetReadableSignature(java.lang.String simpleName, java.util.List<JvmFormalParameter> parameters)
           
protected  org.eclipse.emf.ecore.EObject getContainingAnnotationTarget(XAnnotation annotation)
           
protected  java.util.List<org.eclipse.emf.ecore.EPackage> getEPackages()
           
protected  java.util.List<JvmType> getParamTypes(JvmOperation jvmOperation, boolean wrapPrimitives)
           
protected  java.lang.String getReadableSignature(JvmExecutable executable)
           
protected  java.lang.String getReadableSignature(java.lang.String elementName, java.util.List<JvmTypeReference> parameterTypes)
           
protected  java.util.Map<java.lang.Class<?>,java.lang.annotation.ElementType> getTargetInfos()
           
protected  java.util.Set<org.eclipse.emf.ecore.EReference> getTypeConformanceCheckedReferences()
           
protected  boolean hasAnnotation(java.lang.Iterable<? extends XAnnotation> annotations, java.lang.Class<?> annotationType)
           
protected  boolean hasAnnotation(XtendAnnotationTarget source, java.lang.Class<?> class1)
           
protected  boolean hasCycleInHierarchy(JvmGenericType type, java.util.List<JvmGenericType> processedSuperTypes)
           
protected  boolean isDelegatConstructorCall(XExpression expression)
           
protected  boolean isInterface(JvmDeclaredType type)
           
protected  boolean isMorePrivateThan(JvmVisibility o1, JvmVisibility o2)
           
protected  boolean isValueExpectedRecursive(XExpression expr)
           
protected  org.eclipse.emf.ecore.EStructuralFeature nameFeature(org.eclipse.emf.ecore.EObject member)
           
protected  void reportMissingImplementations(XtendClass xtendClass, ITypeArgumentContext typeArgumentContext, java.util.List<JvmOperation> operationsMissingImplementation)
           
protected  void reportUninitializedField(JvmField field)
           
protected  boolean supportsCheckedExceptions()
           
protected  java.lang.String typeLabel(JvmExecutable executable)
           
 
Methods inherited from class org.eclipse.xtext.xbase.annotations.validation.XbaseWithAnnotationsJavaValidator
checkAllAttributesConfigured, checkAnnotationValueConformance, checkTypeConformance, checkTypeConformance
 
Methods inherited from class org.eclipse.xtext.xbase.validation.XbaseJavaValidator
canonicalName, canonicalName, checkCast, checkCasts, checkClosureParameterTypes, checkClosureParams, checkConstructorArgumentsAreValid, checkDeclaredVariableName, checkDeclaredVariableName, checkDelegateConstructorIsFirst, checkExceptionsInClosure, checkFinalFieldInitialization, checkImplicitReturn, checkInitializationRec, checkInnerExpressions, checkInstanceOf, checkInstantiationOfAbstractClass, checkIsValidConstructorArgument, checkLocalUsageOfDeclared, checkNoCircularConstructorCall, checkNoForwardReferences, checkNumberFormat, checkReceiverOfStaticFeature, checkReceiverOfStaticFeature, checkReturn, checkSpreadOperatorNotUsed, checkTypeArguments, checkTypeArguments, checkTypeGuards, checkTypeReferenceIsNotVoid, checkTypeReferenceIsNotVoid, checkTypes, checkTypes, checkTypes, checkUnhandledException, checkUniqueVariableName, checkUniqueVariableName, checkUniqueVariableName, checkUniqueVariableName, checkUniqueVariableName, checkVariableDeclaration, checkVariableIsNotInferredAsVoid, containsTypeArgs, doCheckReceiverOfStaticFeature, doCheckUnhandledException, ensureNotPrimitiveNorWildcard, findUnhandledExceptions, getDisallowedVariableNames, getEarlyExitComputer, getNameOfTypes, getScopeProvider, getTypeProvider, getTypeRefs, getTypesFactory, isConformant, isConformant, isFinal, isImplicitReturn, isInitialized, isInterface, isLocallyUsed, memberOfTypeHierarchy, mustBeJavaStatementExpression, reportFieldAlreadyInitialized, reportUnhandledException, validateType
 
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 org.eclipse.xtext.validation.AbstractInjectableValidator
getCurrentLanguage, isLanguageSpecific, isResponsible, register, validate, validate, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XtendJavaValidator

public XtendJavaValidator()
Method Detail

getEPackages

protected java.util.List<org.eclipse.emf.ecore.EPackage> getEPackages()
Overrides:
getEPackages in class XbaseWithAnnotationsJavaValidator

getTypeConformanceCheckedReferences

protected java.util.Set<org.eclipse.emf.ecore.EReference> getTypeConformanceCheckedReferences()
Overrides:
getTypeConformanceCheckedReferences in class XbaseJavaValidator

checkPropertyAnnotation

public void checkPropertyAnnotation(XtendField field)

hasAnnotation

protected boolean hasAnnotation(XtendAnnotationTarget source,
                                java.lang.Class<?> class1)

checkAnnotationTarget

public void checkAnnotationTarget(XAnnotation annotation)

getContainingAnnotationTarget

protected org.eclipse.emf.ecore.EObject getContainingAnnotationTarget(XAnnotation annotation)

getTargetInfos

protected java.util.Map<java.lang.Class<?>,java.lang.annotation.ElementType> getTargetInfos()

checkAssignment

public void checkAssignment(XAssignment assignment)
Overrides:
checkAssignment in class XbaseJavaValidator

checkVariableNameShadowing

public void checkVariableNameShadowing(XtendFunction func)

checkNoVoidInDependencyDeclaration

public void checkNoVoidInDependencyDeclaration(XtendField dep)

checkMemberNamesAreUnique

public void checkMemberNamesAreUnique(XtendClass xtendClass)

checkXtendParameterNotPrimitiveVoid

public void checkXtendParameterNotPrimitiveVoid(XtendParameter param)

checkVarArgComesLast

public void checkVarArgComesLast(XtendParameter param)

checkClassPath

public void checkClassPath(XtendClass clazz)

checkWhitespaceInRichStrings

public void checkWhitespaceInRichStrings(RichString richString)

doCheckWhitespaceIn

protected void doCheckWhitespaceIn(RichString richString)

checkSuperTypes

public void checkSuperTypes(XtendClass xtendClass)

hasCycleInHierarchy

protected boolean hasCycleInHierarchy(JvmGenericType type,
                                      java.util.List<JvmGenericType> processedSuperTypes)

supportsCheckedExceptions

protected boolean supportsCheckedExceptions()
Overrides:
supportsCheckedExceptions in class XbaseJavaValidator

checkDuplicateAndOverriddenFunctions

public void checkDuplicateAndOverriddenFunctions(XtendClass xtendClass)

doCheckDuplicateExecutables

protected void doCheckDuplicateExecutables(JvmGenericType inferredType,
                                           com.google.common.collect.Multimap<java.lang.Object,? extends JvmExecutable> executablesPerErasure)

typeLabel

protected java.lang.String typeLabel(JvmExecutable executable)

nameFeature

protected org.eclipse.emf.ecore.EStructuralFeature nameFeature(org.eclipse.emf.ecore.EObject member)

doCheckOverriddenMethods

protected void doCheckOverriddenMethods(XtendClass xtendClass,
                                        JvmGenericType inferredType,
                                        ITypeArgumentContext typeArgumentContext,
                                        com.google.common.collect.Multimap<java.lang.Object,JvmOperation> operationsPerErasure)

reportMissingImplementations

protected void reportMissingImplementations(XtendClass xtendClass,
                                            ITypeArgumentContext typeArgumentContext,
                                            java.util.List<JvmOperation> operationsMissingImplementation)

checkFunctionOverride

protected void checkFunctionOverride(XtendFunction function)

isMorePrivateThan

protected boolean isMorePrivateThan(JvmVisibility o1,
                                    JvmVisibility o2)

allSuperOperations

protected java.lang.Iterable<JvmOperation> allSuperOperations(XtendClass xtendClass)

checkDefaultSuperConstructor

public void checkDefaultSuperConstructor(XtendClass xtendClass)

isDelegatConstructorCall

protected boolean isDelegatConstructorCall(XExpression expression)

isInterface

protected boolean isInterface(JvmDeclaredType type)

canonicalName

protected java.lang.String canonicalName(JvmIdentifiableElement element)

getReadableSignature

protected java.lang.String getReadableSignature(JvmExecutable executable)

doGetReadableSignature

protected java.lang.String doGetReadableSignature(java.lang.String simpleName,
                                                  java.util.List<JvmFormalParameter> parameters)

getReadableSignature

protected java.lang.String getReadableSignature(java.lang.String elementName,
                                                java.util.List<JvmTypeReference> parameterTypes)

checkParameterNames

public void checkParameterNames(XtendFunction function)

checkAbstract

public void checkAbstract(XtendFunction function)

checkParameterNames

public void checkParameterNames(XtendConstructor constructor)

dispatchFuncWithTypeParams

public void dispatchFuncWithTypeParams(XtendFunction func)

checkDispatchFunctions

public void checkDispatchFunctions(XtendClass clazz)

checkDispatchNonDispatchConflict

protected void checkDispatchNonDispatchConflict(XtendClass clazz,
                                                com.google.common.collect.Multimap<Pair<java.lang.String,java.lang.Integer>,JvmOperation> dispatchMethods)

addDispatchError

protected void addDispatchError(JvmGenericType type,
                                java.lang.Iterable<JvmOperation> operations,
                                java.lang.String message,
                                org.eclipse.emf.ecore.EStructuralFeature preferredFeature,
                                java.lang.String ISSUE_ID)

addDispatchError

protected void addDispatchError(JvmOperation jvmOperation,
                                java.lang.String message,
                                org.eclipse.emf.ecore.EStructuralFeature preferredFeature,
                                java.lang.String ISSUE_ID)

getParamTypes

protected java.util.List<JvmType> getParamTypes(JvmOperation jvmOperation,
                                                boolean wrapPrimitives)

checkNoReturnsInCreateExtensions

public void checkNoReturnsInCreateExtensions(XtendFunction func)

checkCreateFunctionIsNotTypeVoid

public void checkCreateFunctionIsNotTypeVoid(XtendFunction func)

checkCreateFunctionIsNotGeneric

public void checkCreateFunctionIsNotGeneric(XtendFunction func)

checkCreateFunctionIsNotStatic

public void checkCreateFunctionIsNotStatic(XtendFunction func)

isValueExpectedRecursive

protected boolean isValueExpectedRecursive(XExpression expr)
Overrides:
isValueExpectedRecursive in class XbaseJavaValidator

collectReturnExpressions

protected void collectReturnExpressions(org.eclipse.emf.ecore.EObject expr,
                                        java.util.List<XReturnExpression> found)

checkClasses

public void checkClasses(XtendFile file)

checkImports

public void checkImports(XtendFile file)

doCheckValidMemberName

public boolean doCheckValidMemberName(XtendMember member)

checkLocalUsageOfDeclaredFields

public void checkLocalUsageOfDeclaredFields(XtendField field)

checkLocalUsageOfDeclaredXtendFunction

public void checkLocalUsageOfDeclaredXtendFunction(XtendFunction function)

checkDeclaredExceptions

public void checkDeclaredExceptions(XtendConstructor constructor)

checkTypeParametersAreUnsupported

public void checkTypeParametersAreUnsupported(XtendConstructor constructor)

checkDeclaredExceptions

public void checkDeclaredExceptions(XtendFunction function)

checkLeftHandSideIsVariable

public void checkLeftHandSideIsVariable(XAssignment assignment)

checkJavaKeywordConflict

public void checkJavaKeywordConflict(XtendField member)

checkJavaKeywordConflict

public void checkJavaKeywordConflict(XtendFunction member)

checkJavaKeywordConflict

public void checkJavaKeywordConflict(XtendConstructor member)

checkJavaKeywordConflict

public void checkJavaKeywordConflict(XtendClass member)

checkNoJavaKeyword

protected void checkNoJavaKeyword(org.eclipse.emf.ecore.EObject obj,
                                  org.eclipse.emf.ecore.EAttribute attribute)

checkNonInitializedFieldsHaveAType

public void checkNonInitializedFieldsHaveAType(XtendField field)

checkFinalFieldInitialization

public void checkFinalFieldInitialization(XtendClass clazz)

reportUninitializedField

protected void reportUninitializedField(JvmField field)
Overrides:
reportUninitializedField in class XbaseJavaValidator

hasAnnotation

protected boolean hasAnnotation(java.lang.Iterable<? extends XAnnotation> annotations,
                                java.lang.Class<?> annotationType)