Index: dom/org/eclipse/jdt/core/dom/AST.java =================================================================== RCS file: /home/eclipse/org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java,v retrieving revision 1.138 diff -u -r1.138 AST.java --- dom/org/eclipse/jdt/core/dom/AST.java 15 Mar 2005 04:30:05 -0000 1.138 +++ dom/org/eclipse/jdt/core/dom/AST.java 23 Mar 2005 13:11:58 -0000 @@ -196,17 +196,25 @@ * @since 3.0 */ private AST(int level) { - if ((level != AST.JLS2) - && (level != AST.JLS3)) { - throw new IllegalArgumentException(); + long sourceLevel = ClassFileConstants.JDK1_3; + long complianceLevel = ClassFileConstants.JDK1_3; + switch (level) { + case AST.JLS3: + sourceLevel = ClassFileConstants.JDK1_5; + complianceLevel = ClassFileConstants.JDK1_5; + case AST.JLS2: + this.apiLevel = level; + break; + default: + throw new IllegalArgumentException(); } - this.apiLevel = level; // initialize a scanner this.scanner = new Scanner( true /*comment*/, true /*whitespace*/, false /*nls*/, - ClassFileConstants.JDK1_3 /*sourceLevel*/, + sourceLevel /*sourceLevel*/, + complianceLevel /*complianceLevel*/, null/*taskTag*/, null/*taskPriorities*/, true/*taskCaseSensitive*/); @@ -296,12 +304,20 @@ } else if (JavaCore.VERSION_1_5.equals(sourceLevelOption)) { sourceLevel = ClassFileConstants.JDK1_5; } + Object complianceLevelOption = options.get(JavaCore.COMPILER_COMPLIANCE); + long complianceLevel = ClassFileConstants.JDK1_3; + if (JavaCore.VERSION_1_4.equals(complianceLevelOption)) { + complianceLevel = ClassFileConstants.JDK1_4; + } else if (JavaCore.VERSION_1_5.equals(complianceLevelOption)) { + complianceLevel = ClassFileConstants.JDK1_5; + } // override scanner if 1.4 or 1.5 asked for this.scanner = new Scanner( true /*comment*/, true /*whitespace*/, false /*nls*/, sourceLevel /*sourceLevel*/, + complianceLevel /*complianceLevel*/, null/*taskTag*/, null/*taskPriorities*/, true/*taskCaseSensitive*/);