本文整理汇总了Java中org.eclipse.jdt.core.JavaCore.setComplianceOptions方法的典型用法代码示例。如果您正苦于以下问题:Java JavaCore.setComplianceOptions方法的具体用法?Java JavaCore.setComplianceOptions怎么用?Java JavaCore.setComplianceOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.core.JavaCore
的用法示例。
在下文中一共展示了JavaCore.setComplianceOptions方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createCompilationUnitParser
import org.eclipse.jdt.core.JavaCore; //导入方法依赖的package包/类
private static ASTParser createCompilationUnitParser() {
ASTParser parser = ASTParser.newParser(AST.JLS8);
Map options = JavaCore.getOptions();
JavaCore.setComplianceOptions(JavaCore.VERSION_1_8, options);
parser.setCompilerOptions(options);
parser.setKind(ASTParser.K_COMPILATION_UNIT);
return parser;
}
示例2: buildAstParser
import org.eclipse.jdt.core.JavaCore; //导入方法依赖的package包/类
private static ASTParser buildAstParser(String[] sourceFolders) {
ASTParser parser = ASTParser.newParser(AST.JLS8);
parser.setKind(ASTParser.K_COMPILATION_UNIT);
Map options = JavaCore.getOptions();
JavaCore.setComplianceOptions(JavaCore.VERSION_1_8, options);
parser.setCompilerOptions(options);
parser.setResolveBindings(true);
parser.setBindingsRecovery(true);
parser.setEnvironment(new String[0], sourceFolders, null, true);
// parser.setEnvironment(new String[0], new String[]{"tmp\\refactoring-toy-example\\src"}, null, false);
return parser;
}
示例3: buildAstParser
import org.eclipse.jdt.core.JavaCore; //导入方法依赖的package包/类
private static ASTParser buildAstParser(String[] sourceFolders) {
ASTParser parser = ASTParser.newParser(AST.JLS8);
parser.setKind(ASTParser.K_COMPILATION_UNIT);
Map options = JavaCore.getOptions();
JavaCore.setComplianceOptions(JavaCore.VERSION_1_8, options);
parser.setCompilerOptions(options);
parser.setResolveBindings(true);
parser.setBindingsRecovery(true);
parser.setEnvironment(new String[0], sourceFolders, null, true);
//parser.setEnvironment(new String[0], new String[]{"tmp\\refactoring-toy-example\\src"}, null, false);
return parser;
}
示例4: parse
import org.eclipse.jdt.core.JavaCore; //导入方法依赖的package包/类
/**
* Parse the code and generate the JSON in outJ
*
* @param source String to parses
* @return CompilationUnit of the AST
* @throws IOException if anything related to I/O or Json generation failed
*/
public CompilationUnit parse(final String source) throws IOException {
parser.setSource(source.toCharArray());
Map options = JavaCore.getOptions();
JavaCore.setComplianceOptions(JavaCore.VERSION_1_8, options);
parser.setCompilerOptions(options);
return (CompilationUnit) parser.createAST(null);
}