Example usage for org.eclipse.jdt.core JavaCore VERSION_11

List of usage examples for org.eclipse.jdt.core JavaCore VERSION_11

Introduction

In this page you can find the example usage for org.eclipse.jdt.core JavaCore VERSION_11.

Prototype

String VERSION_11

To view the source code for org.eclipse.jdt.core JavaCore VERSION_11.

Click Source Link

Document

Configurable option value: .

Usage

From source file:org.springframework.ide.vscode.boot.java.utils.CompilationUnitCache.java

License:Open Source License

public static CompilationUnit parse(char[] source, String docURI, String unitName, String[] classpathEntries)
        throws Exception {
    ASTParser parser = ASTParser.newParser(AST.JLS11);
    Map<String, String> options = JavaCore.getOptions();
    JavaCore.setComplianceOptions(JavaCore.VERSION_11, options);
    parser.setCompilerOptions(options);//from  w w  w .j  a v  a2  s .c  o m
    parser.setKind(ASTParser.K_COMPILATION_UNIT);
    parser.setStatementsRecovery(true);
    parser.setBindingsRecovery(true);
    parser.setResolveBindings(true);

    String[] sourceEntries = new String[] {};
    parser.setEnvironment(classpathEntries, sourceEntries, null, false);

    parser.setUnitName(unitName);
    parser.setSource(source);

    CompilationUnit cu = (CompilationUnit) parser.createAST(null);

    return cu;
}

From source file:org.springframework.ide.vscode.boot.java.utils.SpringIndexerJava.java

License:Open Source License

private ASTParser createParser(IJavaProject project) throws Exception {
    String[] classpathEntries = getClasspathEntries(project);

    ASTParser parser = ASTParser.newParser(AST.JLS11);
    Map<String, String> options = JavaCore.getOptions();
    JavaCore.setComplianceOptions(JavaCore.VERSION_11, options);
    parser.setCompilerOptions(options);//from   w  ww.  j  a  va2  s .c om
    parser.setKind(ASTParser.K_COMPILATION_UNIT);
    parser.setStatementsRecovery(true);
    parser.setBindingsRecovery(true);
    parser.setResolveBindings(true);

    boolean ignoreMethodBodies = "true"
            .equals(System.getProperty("boot.ls.symbols.ignoreMethodBodies", "false"));
    parser.setIgnoreMethodBodies(ignoreMethodBodies);

    String[] sourceEntries = new String[] {};
    parser.setEnvironment(classpathEntries, sourceEntries, null, false);
    return parser;
}