本文整理匯總了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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
}
示例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;
}