Allow to set the class loader for the grammar provider.

This commit is contained in:
Sebastian Zarnekow 2015-11-15 23:41:54 +01:00
parent 6a8ea1a411
commit 730eb96464
2 changed files with 11 additions and 3 deletions

View file

@ -74,4 +74,14 @@ public class GrammarProvider {
}
return grammar;
}
/**
* Public for testing purpose.
* @nooverride This method is not intended to be re-implemented or extended by clients.
* @noreference This method is not intended to be referenced by clients.
* @since 2.9
*/
public void setClassLoader(ClassLoader classLoader) {
this.classLoader = classLoader;
}
}

View file

@ -45,9 +45,6 @@ public class XtextSerializerTest extends AbstractXtextTests {
@Override
public void setUp() throws Exception {
super.setUp();
// StandaloneSetup standaloneSetup = new StandaloneSetup();
// standaloneSetup.setIgnoreBrokenProjectFiles(true);
// standaloneSetup.setPlatformUri("../..");
with(new XtextStandaloneSetup());
getInjector().injectMembers(this);
}
@ -81,6 +78,7 @@ public class XtextSerializerTest extends AbstractXtextTests {
return XtextSerializerTest.this.get(XtextResourceSet.class);
}
});
grammarProvider.setClassLoader(getClass().getClassLoader());
TerminalsGrammarAccess gaTerminals = new TerminalsGrammarAccess(grammarProvider);
BaseInheritanceTestLanguageGrammarAccess gaBaseInheritanceTestLanguage = new BaseInheritanceTestLanguageGrammarAccess(grammarProvider, gaTerminals);
InheritanceTestLanguageGrammarAccess grammarAccess = new InheritanceTestLanguageGrammarAccess(grammarProvider, gaBaseInheritanceTestLanguage, gaTerminals);