Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 573714

Summary: Concurrency model in ASTParser - no support for concurrent processing
Product: [Eclipse Project] JDT Reporter: Carsten Hammer <carsten.hammer>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED INVALID QA Contact:
Severity: normal    
Priority: P3    
Version: 4.20   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Carsten Hammer CLA 2021-05-23 04:33:47 EDT
According to the javadoc of ASTParser.java you can process code aligned to a certain java version like this:

char[] source = ...;
ASTParser parser = ASTParser.newParser(AST.JLS3);  // handles JDK 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6
parser.setSource(source);
 * // In order to parse 1.5 code, some compiler options need to be set to 1.5
Map options = JavaCore.getOptions();
JavaCore.setComplianceOptions(JavaCore.VERSION_1_5, options);
parser.setCompilerOptions(options);
CompilationUnit result = (CompilationUnit) parser.createAST(null);

Because the java compiler compliance setting to be used is not a parameter of the .setSource() call and not a property of the parser it is impossible to have a different compliance setting in concurrent processing.

Is this broken by design?
Comment 1 Carsten Hammer CLA 2021-05-23 04:49:16 EDT
Sorry was wrong, it *is* property of the parser..