Buggy code:
public final class XpandBackendFacade { private final OldXtendRegistry _extensions ; private final OldXpandRegistry _registry ; private final String _xpandFile ; private final BackendTypesystem _ts ; public static Object executeStatement ( String code , Collection < MetaModel > mms , Map < String , Object > variables , Collection < Outlet > outlets ) { } public static Object executeStatement ( String code , String fileEncoding , Collection < MetaModel > mms , Map < String , Object > variables , Collection < Outlet > outlets ) { fileEncoding = OldXtendHelper . normalizedFileEncoding ( fileEncoding ) ; final BackendTypesystem ts = OldXtendHelper . guessTypesystem ( mms ) ; if ( variables == null ) variables = new HashMap < String , Object > ( ) ; if ( outlets == null ) outlets = new ArrayList < Outlet > ( ) ; final Template tpl = XpandParseFacade . file ( new StringReader ( ( ( ( ( ( ( ( ( XpandTokens . LT ) + "DEFINE<seq2seq4repair_space>dUmMy<seq2seq4repair_space>FOR<seq2seq4repair_space>dUmMy" ) + ( XpandTokens . RT ) ) + code ) + ( XpandTokens . RT ) ) + ( XpandTokens . LT ) ) + "ENDDEFINE" ) + ( XpandTokens . RT ) ) ) , null ) ; final Statement [ ] statements = ( ( org . eclipse . internal . xpand2 . ast . Definition ) ( tpl . getDefinitions ( ) [ 0 ] ) ) . getBody ( ) ; XpandExecutionContext ctx = XpandBackendFacade . createOldExecutionContext ( fileEncoding , mms , outlets ) ; for ( String varName : variables . keySet ( ) ) ctx = ( ( XpandExecutionContext ) ( ctx . cloneWithVariable ( new org . eclipse . xtend . expression . Variable ( varName , ctx . getType ( variables . get ( varName ) ) ) ) ) ) ; final Set < XpandDefinitionName > referenced = new HashSet < XpandDefinitionName > ( ) ; final OldDefinitionConverter defConverter = new OldDefinitionConverter ( ctx , new TypeToBackendType ( ts , ctx ) ) ; final ExpressionBase converted = defConverter . convertStatementSequence ( statements , tpl , referenced ) ; final FunctionDefContextInternal fdc = new org . eclipse . xtend . backend . functions . FunctionDefContextFactory ( ts ) . create ( ) ; final OldXpandRegistry oxr = new OldXpandRegistry ( ctx , ts , new OldXtendRegistry ( ctx , ts ) ) ; for ( XpandDefinitionName xdn : referenced ) { oxr . registerXpandFile ( xdn . getCanonicalTemplateFileName ( ) ) ; for ( NamedFunction f : oxr . getContributedFunctions ( xdn . getCanonicalTemplateFileName ( ) ) ) fdc . register ( f ) ; } <START_BUG> final ExecutionContext backendCtx = BackendFacade . createExecutionContext ( fdc , ts ) ; <END_BUG> backendCtx . getLocalVarContext ( ) . getLocalVars ( ) . putAll ( variables ) ; XpandBackendFacade . registerOutlets ( backendCtx , outlets ) ; return converted . evaluate ( backendCtx ) ; } public static void registerOutlets ( ExecutionContext ctx , Collection < Outlet > outlets ) { } private static class InMemoryPpAdapter implements InMemoryPostprocessor { private final PostProcessor _oldPp ; private final Outlet _outlet ; public InMemoryPpAdapter ( PostProcessor oldPp , Outlet outlet ) { } public CharSequence process ( CharSequence unprocessed , String uri ) { } } private static class FileHandleImpl implements FileHandle { private CharSequence _buffer ; private final Outlet _outlet ; private final File _file ; public FileHandleImpl ( CharSequence buffer , Outlet outlet , File file ) { } public CharSequence getBuffer ( ) { } public String getFileEncoding ( ) { } public Outlet getOutlet ( ) { } public File getTargetFile ( ) { } public boolean isAppend ( ) { } public boolean isOverwrite ( ) { } public void setBuffer ( CharSequence buffer ) { } public void writeAndClose ( ) { } } private static class UriBasedPpAdapter implements UriBasedPostprocessor { private final PostProcessor _oldPp ; private final Outlet _outlet ; public UriBasedPpAdapter ( PostProcessor oldPp , Outlet outlet ) { } public void process ( String uri ) { } } public static XpandBackendFacade createForFile ( String xpandFilename , String fileEncoding , Collection < MetaModel > mms , Collection < Outlet > outlets ) { } private static XpandExecutionContext createOldExecutionContext ( String fileEncoding , Collection < MetaModel > mms , Collection < Outlet > outlets ) { } private XpandBackendFacade ( String xpandFilename , String fileEncoding , Collection < MetaModel > mms , Collection < Outlet > outlets ) { } public Collection < NamedFunction > getContributedFunctions ( ) { } public FunctionDefContext getFunctionDefContext ( ) { } }

Fix:
final ExecutionContext backendCtx = BackendFacade . createExecutionContext ( fdc , ts , true ) ;