View | Details | Raw Unified | Return to bug 203342
Collapse All | Expand All

(-)dom/org/eclipse/jdt/core/dom/ASTParser.java (-1 / +3 lines)
Lines 65-71 Link Here
65
 * for locating a raw source string in the Java model (when
65
 * for locating a raw source string in the Java model (when
66
 * resolving bindings)</li>
66
 * resolving bindings)</li>
67
 * <li>Which {@linkplain #setCompilerOptions(Map) compiler options}
67
 * <li>Which {@linkplain #setCompilerOptions(Map) compiler options}
68
 * to use.</li>
68
 * to use. This is especially important to use if the parsing/scanning of the source code requires a
69
 * different version than the default of the workspace. For example, the workspace defaults are 1.4 and
70
 * you want to create an AST for a source code that is using 1.5 constructs.</li>
69
 * <li>Whether to parse just {@linkplain #setKind(int) an expression, statements,
71
 * <li>Whether to parse just {@linkplain #setKind(int) an expression, statements,
70
 * or body declarations} rather than an entire compilation unit.</li>
72
 * or body declarations} rather than an entire compilation unit.</li>
71
 * <li>Whether to return a {@linkplain #setFocalPosition(int) abridged AST}
73
 * <li>Whether to return a {@linkplain #setFocalPosition(int) abridged AST}
(-)dom/org/eclipse/jdt/core/dom/ASTConverter.java (-6 / +5 lines)
Lines 44-49 Link Here
44
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
44
import org.eclipse.jdt.internal.compiler.ast.TypeReference;
45
import org.eclipse.jdt.internal.compiler.ast.Wildcard;
45
import org.eclipse.jdt.internal.compiler.ast.Wildcard;
46
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
46
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
47
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
47
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
48
import org.eclipse.jdt.internal.compiler.lookup.BlockScope;
48
import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers;
49
import org.eclipse.jdt.internal.compiler.lookup.ExtraCompilerModifiers;
49
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
50
import org.eclipse.jdt.internal.compiler.lookup.TypeConstants;
Lines 73-85 Link Here
73
	public ASTConverter(Map options, boolean resolveBindings, IProgressMonitor monitor) {
74
	public ASTConverter(Map options, boolean resolveBindings, IProgressMonitor monitor) {
74
		this.resolveBindings = resolveBindings;
75
		this.resolveBindings = resolveBindings;
75
		Object sourceModeSetting = options.get(JavaCore.COMPILER_SOURCE);
76
		Object sourceModeSetting = options.get(JavaCore.COMPILER_SOURCE);
76
		long sourceLevel = ClassFileConstants.JDK1_3;
77
		long sourceLevel = CompilerOptions.versionToJdkLevel(sourceModeSetting);
77
		if (JavaCore.VERSION_1_4.equals(sourceModeSetting)) {
78
		if (sourceLevel == 0) {
78
			sourceLevel = ClassFileConstants.JDK1_4;
79
			// unknown sourceModeSetting
79
		} else if (JavaCore.VERSION_1_5.equals(sourceModeSetting)) {
80
			sourceLevel = ClassFileConstants.JDK1_3;
80
			sourceLevel = ClassFileConstants.JDK1_5;
81
		}
81
		}
82
83
		this.scanner = new Scanner(
82
		this.scanner = new Scanner(
84
			true /*comment*/,
83
			true /*comment*/,
85
			false /*whitespace*/,
84
			false /*whitespace*/,

Return to bug 203342