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