@ Check public void checkDefaultValueFieldReference ( SarlFormalParameter param ) { final XExpression defaultValue = param . getDefaultValue ( ) ; if ( defaultValue != null ) { final Iterator < XFeatureCall > iter ; if ( defaultValue instanceof XFeatureCall ) { iter = Iterators . singletonIterator ( ( XFeatureCall ) defaultValue ) ; } else { iter = Iterators . filter ( defaultValue . eAllContents ( ) , XFeatureCall . class ) ; } while ( iter . hasNext ( ) ) { final XFeatureCall call = iter . next ( ) ; final JvmIdentifiableElement feature = call . getFeature ( ) ; String invalidFieldName = null ; if ( feature instanceof XtendField ) { final XtendField field = ( XtendField ) feature ; if ( ! field . isFinal ( ) ) { invalidFieldName = field . getName ( ) ; } } else if ( feature instanceof JvmField ) { final JvmField field = ( JvmField ) feature ; if ( ! field . isFinal ( ) ) { invalidFieldName = field . getSimpleName ( ) ; } } if ( invalidFieldName != null ) { error ( MessageFormat . format ( Messages . SARLValidator_19 , invalidFieldName ) , call , XbasePackage . Literals . XABSTRACT_FEATURE_CALL__FEATURE , ValidationMessageAcceptor . INSIGNIFICANT_INDEX , FORBIDDEN_REFERENCE ) ; } } } }
Check if the default values has not a reference to the not final fields .