當前位置: 首頁>>代碼示例>>Java>>正文


Java GeneratorConfig.setJavaSourceVersion方法代碼示例

本文整理匯總了Java中org.eclipse.xtext.xbase.compiler.GeneratorConfig.setJavaSourceVersion方法的典型用法代碼示例。如果您正苦於以下問題:Java GeneratorConfig.setJavaSourceVersion方法的具體用法?Java GeneratorConfig.setJavaSourceVersion怎麽用?Java GeneratorConfig.setJavaSourceVersion使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.xtext.xbase.compiler.GeneratorConfig的用法示例。


在下文中一共展示了GeneratorConfig.setJavaSourceVersion方法的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: compile

import org.eclipse.xtext.xbase.compiler.GeneratorConfig; //導入方法依賴的package包/類
/**
 * Parses, validates and compiles the given source. Calls the given acceptor for each
 * resource which is generated from the source.
 *  
 * @param resourceSet - the {@link ResourceSet} to use
 * @param acceptor gets called once for each file generated in {@link IGenerator}
 */
public void compile(final ResourceSet resourceSet, IAcceptor<Result> acceptor) {
	try {
		List<Resource> resourcesToCheck = newArrayList(resourceSet.getResources());
		if (generatorConfigProvider instanceof GeneratorConfigProvider) {
			GeneratorConfigProvider configProvider = (GeneratorConfigProvider) generatorConfigProvider;
			GeneratorConfig config = generatorConfigProvider.get(null);
			config.setJavaSourceVersion(javaCompiler.getJavaVersion());
			GeneratorConfig existent = configProvider.install(resourceSet, config);
			if (existent != null) {
				existent.setJavaSourceVersion(javaCompiler.getJavaVersion());
				configProvider.install(resourceSet, existent);
			}
		}
		Result result = resultProvider.get();
		result.setJavaCompiler(javaCompiler);
		result.setCheckMode(getCheckMode());
		result.setResources(resourcesToCheck);
		result.setResourceSet(resourceSet);
		result.setOutputConfigurations(getOutputConfigurations());
		result.doGenerate();
		acceptor.accept(result);
	} catch (Exception e) {
		Exceptions.throwUncheckedException(e);
	}
}
 
開發者ID:eclipse,項目名稱:xtext-extras,代碼行數:33,代碼來源:CompilationTestHelper.java

示例2: testBug472265_01_lamda

import org.eclipse.xtext.xbase.compiler.GeneratorConfig; //導入方法依賴的package包/類
@Test
public void testBug472265_01_lamda() throws Exception {
	GeneratorConfig generatorConfig = generatorConfigProvider.get(null);
	generatorConfig.setJavaSourceVersion(JavaVersion.JAVA8);
	assertCompilesTo("final closures.IAcceptors.IAcceptor _function = (String x) -> {\n"
			+ "};\n"
			+ "closures.IAcceptors.IAcceptor a = _function;",
			"{var closures.IAcceptors.IAcceptor a = [x|]}",
			generatorConfig);
}
 
開發者ID:eclipse,項目名稱:xtext-extras,代碼行數:11,代碼來源:CompilerTest.java

示例3: testBug472265_02_lamda

import org.eclipse.xtext.xbase.compiler.GeneratorConfig; //導入方法依賴的package包/類
@Test
public void testBug472265_02_lamda() throws Exception {
	GeneratorConfig generatorConfig = generatorConfigProvider.get(null);
	generatorConfig.setJavaSourceVersion(JavaVersion.JAVA8);
	assertCompilesTo("final closures.IAcceptors.IAcceptor2 _function = (String[] x) -> {\n"
			+ "};\n"
			+ "closures.IAcceptors.IAcceptor2 a = _function;",
			"{var closures.IAcceptors.IAcceptor2 a = [x|]}",
			generatorConfig);
}
 
開發者ID:eclipse,項目名稱:xtext-extras,代碼行數:11,代碼來源:CompilerTest.java

示例4: testBug472265_03_lamda

import org.eclipse.xtext.xbase.compiler.GeneratorConfig; //導入方法依賴的package包/類
@Test
public void testBug472265_03_lamda() throws Exception {
	GeneratorConfig generatorConfig = generatorConfigProvider.get(null);
	generatorConfig.setJavaSourceVersion(JavaVersion.JAVA8);
	assertCompilesTo("final closures.IAcceptors.IAcceptor3 _function = (String... x) -> {\n"
			+ "};\n"
			+ "closures.IAcceptors.IAcceptor3 a = _function;",
			"{var closures.IAcceptors.IAcceptor3 a = [x|]}",
			generatorConfig);
}
 
開發者ID:eclipse,項目名稱:xtext-extras,代碼行數:11,代碼來源:CompilerTest.java

示例5: testBug472265_04_lamda

import org.eclipse.xtext.xbase.compiler.GeneratorConfig; //導入方法依賴的package包/類
@Test
public void testBug472265_04_lamda() throws Exception {
	GeneratorConfig generatorConfig = generatorConfigProvider.get(null);
	generatorConfig.setJavaSourceVersion(JavaVersion.JAVA8);
	assertCompilesTo("final closures.IAcceptors.IAcceptor4 _function = (String x, String[] y) -> {\n"
			+ "};\n"
			+ "closures.IAcceptors.IAcceptor4 a = _function;",
			"{var closures.IAcceptors.IAcceptor4 a = [x,y|]}",
			generatorConfig);
}
 
開發者ID:eclipse,項目名稱:xtext-extras,代碼行數:11,代碼來源:CompilerTest.java

示例6: testBug472265_05_lamda

import org.eclipse.xtext.xbase.compiler.GeneratorConfig; //導入方法依賴的package包/類
@Test
public void testBug472265_05_lamda() throws Exception {
	GeneratorConfig generatorConfig = generatorConfigProvider.get(null);
	generatorConfig.setJavaSourceVersion(JavaVersion.JAVA8);
	assertCompilesTo("final closures.IAcceptors.IAcceptor5 _function = (String x, String... y) -> {\n"
			+ "};\n"
			+ "closures.IAcceptors.IAcceptor5 a = _function;",
			"{var closures.IAcceptors.IAcceptor5 a = [x,y|]}",
			generatorConfig);
}
 
開發者ID:eclipse,項目名稱:xtext-extras,代碼行數:11,代碼來源:CompilerTest.java

示例7: testBug472265_06_lamda

import org.eclipse.xtext.xbase.compiler.GeneratorConfig; //導入方法依賴的package包/類
@Test
public void testBug472265_06_lamda() throws Exception {
	GeneratorConfig generatorConfig = generatorConfigProvider.get(null);
	generatorConfig.setJavaSourceVersion(JavaVersion.JAVA8);
	assertCompilesTo("final closures.IAcceptors.IAcceptor6 _function = (String[] x, String[] y) -> {\n"
			+ "};\n"
			+ "closures.IAcceptors.IAcceptor6 a = _function;",
			"{var closures.IAcceptors.IAcceptor6 a = [x,y|]}",
			generatorConfig);
}
 
開發者ID:eclipse,項目名稱:xtext-extras,代碼行數:11,代碼來源:CompilerTest.java

示例8: testBug472265_07_lamda

import org.eclipse.xtext.xbase.compiler.GeneratorConfig; //導入方法依賴的package包/類
@Test
public void testBug472265_07_lamda() throws Exception {
	GeneratorConfig generatorConfig = generatorConfigProvider.get(null);
	generatorConfig.setJavaSourceVersion(JavaVersion.JAVA8);
	assertCompilesTo("final closures.IAcceptors.IAcceptor7 _function = (String[] x, String... y) -> {\n"
			+ "};\n"
			+ "closures.IAcceptors.IAcceptor7 a = _function;",
			"{var closures.IAcceptors.IAcceptor7 a = [x,y|]}",
			generatorConfig);
}
 
開發者ID:eclipse,項目名稱:xtext-extras,代碼行數:11,代碼來源:CompilerTest.java

示例9: get

import org.eclipse.xtext.xbase.compiler.GeneratorConfig; //導入方法依賴的package包/類
@Override
public GeneratorConfig get(EObject context) {
	GeneratorConfig config = new GeneratorConfig();
	config.setJavaSourceVersion(targetVersion);
	return config;
}
 
開發者ID:eclipse,項目名稱:xtext-extras,代碼行數:7,代碼來源:JavaVersionModule.java

示例10: assertCompilesTo

import org.eclipse.xtext.xbase.compiler.GeneratorConfig; //導入方法依賴的package包/類
protected void assertCompilesTo(final CharSequence expectedJavaCode, final CharSequence xbaseCode,
		JavaVersion javaVersion) throws Exception {
	GeneratorConfig generatorConfig = generatorConfigProvider.get(null);
	generatorConfig.setJavaSourceVersion(javaVersion);
	assertCompilesTo(expectedJavaCode, xbaseCode, generatorConfig);
}
 
開發者ID:eclipse,項目名稱:xtext-extras,代碼行數:7,代碼來源:AbstractOutputComparingCompilerTests.java

示例11: testEmptySwitch_11

import org.eclipse.xtext.xbase.compiler.GeneratorConfig; //導入方法依賴的package包/類
@Test
public void testEmptySwitch_11() {
  try {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("{");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("val String x = null");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("switch (x) {");
    _builder.newLine();
    _builder.append("\t");
    _builder.append("}");
    _builder.newLine();
    _builder.append("}");
    _builder.newLine();
    StringConcatenation _builder_1 = new StringConcatenation();
    _builder_1.append("Object _xblockexpression = null;");
    _builder_1.newLine();
    _builder_1.append("{");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("final String x = null;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("Object _switchResult = null;");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("if (x != null) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("switch (x) {");
    _builder_1.newLine();
    _builder_1.append("    ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("  ");
    _builder_1.append("_xblockexpression = _switchResult;");
    _builder_1.newLine();
    _builder_1.append("}");
    _builder_1.newLine();
    _builder_1.append("return _xblockexpression;");
    _builder_1.newLine();
    GeneratorConfig _generatorConfig = new GeneratorConfig();
    final Procedure1<GeneratorConfig> _function = (GeneratorConfig it) -> {
      it.setJavaSourceVersion(JavaVersion.JAVA8);
    };
    GeneratorConfig _doubleArrow = ObjectExtensions.<GeneratorConfig>operator_doubleArrow(_generatorConfig, _function);
    this.compilesTo(_builder, _builder_1, _doubleArrow);
  } catch (Throwable _e) {
    throw Exceptions.sneakyThrow(_e);
  }
}
 
開發者ID:eclipse,項目名稱:xtext-extras,代碼行數:58,代碼來源:CompilerTests2.java

示例12: get

import org.eclipse.xtext.xbase.compiler.GeneratorConfig; //導入方法依賴的package包/類
@Override
public GeneratorConfig get(EObject context) {
	GeneratorConfig gc = new GeneratorConfig();
	gc.setJavaSourceVersion(JavaVersion.JAVA8);
	return gc;
}
 
開發者ID:Quanticol,項目名稱:CARMA,代碼行數:7,代碼來源:MyGeneratorConfigProvider.java


注:本文中的org.eclipse.xtext.xbase.compiler.GeneratorConfig.setJavaSourceVersion方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。