protected String getInvalidWritableVariableAccessMessage ( XVariableDeclaration variable , XAbstractFeatureCall featureCall , IResolvedTypes resolvedTypes ) { // TODO this should be part of a separate validation service XClosure containingClosure = EcoreUtil2 . getContainerOfType ( featureCall , XClosure . class ) ; if ( containingClosure != null && ! EcoreUtil . isAncestor ( containingClosure , variable ) ) { return String . format ( "Cannot %srefer to the non-final variable %s inside a lambda expression" , getImplicitlyMessagePart ( featureCall ) , variable . getSimpleName ( ) ) ; } return null ; }
Provide the error message for mutable variables that may not be captured in lambdas .