1 /*******************************************************************************
2 * Copyright (c) 2000, 2004 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package org.eclipse.jdt.internal.compiler.impl;
13 import java.io.ByteArrayInputStream;
14 import java.io.InputStreamReader;
15 import java.io.UnsupportedEncodingException;
16 import java.util.HashMap;
19 import org.eclipse.jdt.core.compiler.CharOperation;
20 import org.eclipse.jdt.internal.compiler.Compiler;
21 import org.eclipse.jdt.internal.compiler.ast.ASTNode;
22 import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
23 import org.eclipse.jdt.internal.compiler.lookup.ProblemReasons;
24 import org.eclipse.jdt.internal.compiler.problem.ProblemSeverities;
26 public class CompilerOptions implements ProblemReasons, ProblemSeverities, ClassFileConstants {
31 public static final String OPTION_LocalVariableAttribute = "org.eclipse.jdt.core.compiler.debug.localVariable"; //$NON-NLS-1$
32 public static final String OPTION_LineNumberAttribute = "org.eclipse.jdt.core.compiler.debug.lineNumber"; //$NON-NLS-1$
33 public static final String OPTION_SourceFileAttribute = "org.eclipse.jdt.core.compiler.debug.sourceFile"; //$NON-NLS-1$
34 public static final String OPTION_PreserveUnusedLocal = "org.eclipse.jdt.core.compiler.codegen.unusedLocal"; //$NON-NLS-1$
35 public static final String OPTION_DocCommentSupport= "org.eclipse.jdt.core.compiler.doc.comment.support"; //$NON-NLS-1$
36 public static final String OPTION_ReportMethodWithConstructorName = "org.eclipse.jdt.core.compiler.problem.methodWithConstructorName"; //$NON-NLS-1$
37 public static final String OPTION_ReportOverridingPackageDefaultMethod = "org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod"; //$NON-NLS-1$
38 public static final String OPTION_ReportDeprecation = "org.eclipse.jdt.core.compiler.problem.deprecation"; //$NON-NLS-1$
39 public static final String OPTION_ReportDeprecationInDeprecatedCode = "org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode"; //$NON-NLS-1$
40 public static final String OPTION_ReportDeprecationWhenOverridingDeprecatedMethod = "org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod"; //$NON-NLS-1$
41 public static final String OPTION_ReportHiddenCatchBlock = "org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock"; //$NON-NLS-1$
42 public static final String OPTION_ReportUnusedLocal = "org.eclipse.jdt.core.compiler.problem.unusedLocal"; //$NON-NLS-1$
43 public static final String OPTION_ReportUnusedParameter = "org.eclipse.jdt.core.compiler.problem.unusedParameter"; //$NON-NLS-1$
44 public static final String OPTION_ReportUnusedParameterWhenImplementingAbstract = "org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract"; //$NON-NLS-1$
45 public static final String OPTION_ReportUnusedParameterWhenOverridingConcrete = "org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete"; //$NON-NLS-1$
46 public static final String OPTION_ReportUnusedImport = "org.eclipse.jdt.core.compiler.problem.unusedImport"; //$NON-NLS-1$
47 public static final String OPTION_ReportSyntheticAccessEmulation = "org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation"; //$NON-NLS-1$
48 public static final String OPTION_ReportNoEffectAssignment = "org.eclipse.jdt.core.compiler.problem.noEffectAssignment"; //$NON-NLS-1$
49 public static final String OPTION_ReportLocalVariableHiding = "org.eclipse.jdt.core.compiler.problem.localVariableHiding"; //$NON-NLS-1$
50 public static final String OPTION_ReportSpecialParameterHidingField = "org.eclipse.jdt.core.compiler.problem.specialParameterHidingField"; //$NON-NLS-1$
51 public static final String OPTION_ReportFieldHiding = "org.eclipse.jdt.core.compiler.problem.fieldHiding"; //$NON-NLS-1$
52 public static final String OPTION_ReportPossibleAccidentalBooleanAssignment = "org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment"; //$NON-NLS-1$
53 public static final String OPTION_ReportNonExternalizedStringLiteral = "org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral"; //$NON-NLS-1$
54 public static final String OPTION_ReportIncompatibleNonInheritedInterfaceMethod = "org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod"; //$NON-NLS-1$
55 public static final String OPTION_ReportUnusedPrivateMember = "org.eclipse.jdt.core.compiler.problem.unusedPrivateMember"; //$NON-NLS-1$
56 public static final String OPTION_ReportNoImplicitStringConversion = "org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion"; //$NON-NLS-1$
57 public static final String OPTION_ReportAssertIdentifier = "org.eclipse.jdt.core.compiler.problem.assertIdentifier"; //$NON-NLS-1$
58 public static final String OPTION_ReportNonStaticAccessToStatic = "org.eclipse.jdt.core.compiler.problem.staticAccessReceiver"; //$NON-NLS-1$
59 public static final String OPTION_ReportIndirectStaticAccess = "org.eclipse.jdt.core.compiler.problem.indirectStaticAccess"; //$NON-NLS-1$
60 public static final String OPTION_ReportEmptyStatement = "org.eclipse.jdt.core.compiler.problem.emptyStatement"; //$NON-NLS-1$
61 public static final String OPTION_ReportUnnecessaryTypeCheck = "org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck"; //$NON-NLS-1$
62 public static final String OPTION_ReportUnnecessaryElse = "org.eclipse.jdt.core.compiler.problem.unnecessaryElse"; //$NON-NLS-1$
63 public static final String OPTION_ReportUndocumentedEmptyBlock = "org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock"; //$NON-NLS-1$
64 public static final String OPTION_ReportInvalidJavadoc = "org.eclipse.jdt.core.compiler.problem.invalidJavadoc"; //$NON-NLS-1$
65 public static final String OPTION_ReportInvalidJavadocTags = "org.eclipse.jdt.core.compiler.problem.invalidJavadocTags"; //$NON-NLS-1$
66 public static final String OPTION_ReportInvalidJavadocTagsVisibility = "org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility"; //$NON-NLS-1$
67 public static final String OPTION_ReportMissingJavadocTags = "org.eclipse.jdt.core.compiler.problem.missingJavadocTags"; //$NON-NLS-1$
68 public static final String OPTION_ReportMissingJavadocTagsVisibility = "org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility"; //$NON-NLS-1$
69 public static final String OPTION_ReportMissingJavadocTagsOverriding = "org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding"; //$NON-NLS-1$
70 public static final String OPTION_ReportMissingJavadocComments = "org.eclipse.jdt.core.compiler.problem.missingJavadocComments"; //$NON-NLS-1$
71 public static final String OPTION_ReportMissingJavadocCommentsVisibility = "org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility"; //$NON-NLS-1$
72 public static final String OPTION_ReportMissingJavadocCommentsOverriding = "org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding"; //$NON-NLS-1$
73 public static final String OPTION_ReportFinallyBlockNotCompletingNormally = "org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally"; //$NON-NLS-1$
74 public static final String OPTION_ReportUnusedDeclaredThrownException = "org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException"; //$NON-NLS-1$
75 public static final String OPTION_ReportUnusedDeclaredThrownExceptionWhenOverriding = "org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding"; //$NON-NLS-1$
76 public static final String OPTION_ReportUnqualifiedFieldAccess = "org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess"; //$NON-NLS-1$
77 public static final String OPTION_Source = "org.eclipse.jdt.core.compiler.source"; //$NON-NLS-1$
78 public static final String OPTION_TargetPlatform = "org.eclipse.jdt.core.compiler.codegen.targetPlatform"; //$NON-NLS-1$
79 public static final String OPTION_Compliance = "org.eclipse.jdt.core.compiler.compliance"; //$NON-NLS-1$
80 public static final String OPTION_Encoding = "org.eclipse.jdt.core.encoding"; //$NON-NLS-1$
81 public static final String OPTION_MaxProblemPerUnit = "org.eclipse.jdt.core.compiler.maxProblemPerUnit"; //$NON-NLS-1$
82 public static final String OPTION_TaskTags = "org.eclipse.jdt.core.compiler.taskTags"; //$NON-NLS-1$
83 public static final String OPTION_TaskPriorities = "org.eclipse.jdt.core.compiler.taskPriorities"; //$NON-NLS-1$
84 public static final String OPTION_TaskCaseSensitive = "org.eclipse.jdt.core.compiler.taskCaseSensitive"; //$NON-NLS-1$
85 public static final String OPTION_InlineJsr = "org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode"; //$NON-NLS-1$
87 // Backward compatibility
88 public static final String OPTION_ReportInvalidAnnotation = "org.eclipse.jdt.core.compiler.problem.invalidAnnotation"; //$NON-NLS-1$
89 public static final String OPTION_ReportMissingAnnotation = "org.eclipse.jdt.core.compiler.problem.missingAnnotation"; //$NON-NLS-1$
90 public static final String OPTION_ReportMissingJavadoc = "org.eclipse.jdt.core.compiler.problem.missingJavadoc"; //$NON-NLS-1$
92 /* should surface ??? */
93 public static final String OPTION_PrivateConstructorAccess = "org.eclipse.jdt.core.compiler.codegen.constructorAccessEmulation"; //$NON-NLS-1$
96 * Possible values for configurable options
98 public static final String GENERATE = "generate";//$NON-NLS-1$
99 public static final String DO_NOT_GENERATE = "do not generate"; //$NON-NLS-1$
100 public static final String PRESERVE = "preserve"; //$NON-NLS-1$
101 public static final String OPTIMIZE_OUT = "optimize out"; //$NON-NLS-1$
102 public static final String VERSION_1_1 = "1.1"; //$NON-NLS-1$
103 public static final String VERSION_1_2 = "1.2"; //$NON-NLS-1$
104 public static final String VERSION_1_3 = "1.3"; //$NON-NLS-1$
105 public static final String VERSION_1_4 = "1.4"; //$NON-NLS-1$
106 public static final String VERSION_1_5 = "1.5"; //$NON-NLS-1$
107 public static final String ERROR = "error"; //$NON-NLS-1$
108 public static final String WARNING = "warning"; //$NON-NLS-1$
109 public static final String IGNORE = "ignore"; //$NON-NLS-1$
110 public static final String ENABLED = "enabled"; //$NON-NLS-1$
111 public static final String DISABLED = "disabled"; //$NON-NLS-1$
112 public static final String PUBLIC = "public"; //$NON-NLS-1$
113 public static final String PROTECTED = "protected"; //$NON-NLS-1$
114 public static final String DEFAULT = "default"; //$NON-NLS-1$
115 public static final String PRIVATE = "private"; //$NON-NLS-1$
118 * Bit mask for configurable problems (error/warning threshold)
120 public static final long MethodWithConstructorName = ASTNode.Bit1;
121 public static final long OverriddenPackageDefaultMethod = ASTNode.Bit2;
122 public static final long UsingDeprecatedAPI = ASTNode.Bit3;
123 public static final long MaskedCatchBlock = ASTNode.Bit4;
124 public static final long UnusedLocalVariable = ASTNode.Bit5;
125 public static final long UnusedArgument = ASTNode.Bit6;
126 public static final long NoImplicitStringConversion = ASTNode.Bit7;
127 public static final long AccessEmulation = ASTNode.Bit8;
128 public static final long NonExternalizedString = ASTNode.Bit9;
129 public static final long AssertUsedAsAnIdentifier = ASTNode.Bit10;
130 public static final long UnusedImport = ASTNode.Bit11;
131 public static final long NonStaticAccessToStatic = ASTNode.Bit12;
132 public static final long Task = ASTNode.Bit13;
133 public static final long NoEffectAssignment = ASTNode.Bit14;
134 public static final long IncompatibleNonInheritedInterfaceMethod = ASTNode.Bit15;
135 public static final long UnusedPrivateMember = ASTNode.Bit16;
136 public static final long LocalVariableHiding = ASTNode.Bit17;
137 public static final long FieldHiding = ASTNode.Bit18;
138 public static final long AccidentalBooleanAssign = ASTNode.Bit19;
139 public static final long EmptyStatement = ASTNode.Bit20;
140 public static final long MissingJavadocComments = ASTNode.Bit21;
141 public static final long MissingJavadocTags = ASTNode.Bit22;
142 public static final long UnqualifiedFieldAccess = ASTNode.Bit23;
143 public static final long UnusedDeclaredThrownException = ASTNode.Bit24;
144 public static final long FinallyBlockNotCompleting = ASTNode.Bit25;
145 public static final long InvalidJavadoc = ASTNode.Bit26;
146 public static final long UnnecessaryTypeCheck = ASTNode.Bit27;
147 public static final long UndocumentedEmptyBlock = ASTNode.Bit28;
148 public static final long IndirectStaticAccess = ASTNode.Bit29;
149 public static final long UnnecessaryElse = ASTNode.Bit30;
151 // Default severity level for handlers
152 public long errorThreshold = 0;
154 public long warningThreshold =
155 MethodWithConstructorName
158 | OverriddenPackageDefaultMethod
160 | NonStaticAccessToStatic
162 | IncompatibleNonInheritedInterfaceMethod
163 | NoImplicitStringConversion
164 | FinallyBlockNotCompleting
165 | AssertUsedAsAnIdentifier;
168 public static final int Source = 1; // SourceFileAttribute
169 public static final int Lines = 2; // LineNumberAttribute
170 public static final int Vars = 4; // LocalVariableTableAttribute
172 // By default only lines and source attributes are generated.
173 public int produceDebugAttributes = Lines | Source;
175 public long complianceLevel = JDK1_4; // by default be compliant with 1.4
176 public long sourceLevel = JDK1_3; //1.3 source behavior by default
177 public long targetJDK = JDK1_2; // default generates for JVM1.2
179 // toggle private access emulation for 1.2 (constr. accessor has extra arg on constructor) or 1.3 (make private constructor default access when access needed)
180 public boolean isPrivateConstructorAccessChangingVisibility = false; // by default, follows 1.2
182 // source encoding format
183 public String defaultEncoding = null; // will use the platform default encoding
185 // print what unit is being processed
186 public boolean verbose = Compiler.DEBUG;
188 // indicates if reference info is desired
189 public boolean produceReferenceInfo = false;
191 // indicates if unused/optimizable local variables need to be preserved (debugging purpose)
192 public boolean preserveAllLocalVariables = false;
194 // indicates whether literal expressions are inlined at parse-time or not
195 public boolean parseLiteralExpressionsAsConstants = true;
197 // max problems per compilation unit
198 public int maxProblemsPerUnit = 100; // no more than 100 problems per default
200 // tags used to recognize tasks in comments
201 public char[][] taskTags = null;
202 public char[][] taskPriorites = null;
203 public boolean isTaskCaseSensitive = true;
205 // deprecation report
206 public boolean reportDeprecationInsideDeprecatedCode = false;
207 public boolean reportDeprecationWhenOverridingDeprecatedMethod = false;
209 // unused parameters report
210 public boolean reportUnusedParameterWhenImplementingAbstract = false;
211 public boolean reportUnusedParameterWhenOverridingConcrete = false;
213 // unused declaration of thrown exception
214 public boolean reportUnusedDeclaredThrownExceptionWhenOverriding = false;
216 // constructor/setter parameter hiding
217 public boolean reportSpecialParameterHidingField = false;
219 // check javadoc comments
220 public int reportInvalidJavadocTagsVisibility = AccPrivate;
221 public boolean reportInvalidJavadocTags = true;
223 // check missing javadoc tags
224 public int reportMissingJavadocTagsVisibility = AccPrivate;
225 public boolean reportMissingJavadocTagsOverriding = true;
227 // check missing javadoc comments
228 public int reportMissingJavadocCommentsVisibility = AccPublic;
229 public boolean reportMissingJavadocCommentsOverriding = true;
231 // JSR bytecode inlining
232 public boolean inlineJsrBytecode = false;
234 // javadoc comment support
235 public boolean docCommentSupport = false;
239 * Initializing the compiler options with defaults
241 public CompilerOptions(){
242 // use default options
246 * Initializing the compiler options with external settings
249 public CompilerOptions(Map settings){
251 if (settings == null) return;
255 public Map getMap() {
256 Map optionsMap = new HashMap(30);
257 optionsMap.put(OPTION_LocalVariableAttribute, (this.produceDebugAttributes & Vars) != 0 ? GENERATE : DO_NOT_GENERATE);
258 optionsMap.put(OPTION_LineNumberAttribute, (this.produceDebugAttributes & Lines) != 0 ? GENERATE : DO_NOT_GENERATE);
259 optionsMap.put(OPTION_SourceFileAttribute, (this.produceDebugAttributes & Source) != 0 ? GENERATE : DO_NOT_GENERATE);
260 optionsMap.put(OPTION_PreserveUnusedLocal, this.preserveAllLocalVariables ? PRESERVE : OPTIMIZE_OUT);
261 optionsMap.put(OPTION_DocCommentSupport, this.docCommentSupport ? ENABLED : DISABLED);
262 optionsMap.put(OPTION_ReportMethodWithConstructorName, getSeverityString(MethodWithConstructorName));
263 optionsMap.put(OPTION_ReportOverridingPackageDefaultMethod, getSeverityString(OverriddenPackageDefaultMethod));
264 optionsMap.put(OPTION_ReportDeprecation, getSeverityString(UsingDeprecatedAPI));
265 optionsMap.put(OPTION_ReportDeprecationInDeprecatedCode, this.reportDeprecationInsideDeprecatedCode ? ENABLED : DISABLED);
266 optionsMap.put(OPTION_ReportDeprecationWhenOverridingDeprecatedMethod, this.reportDeprecationWhenOverridingDeprecatedMethod ? ENABLED : DISABLED);
267 optionsMap.put(OPTION_ReportHiddenCatchBlock, getSeverityString(MaskedCatchBlock));
268 optionsMap.put(OPTION_ReportUnusedLocal, getSeverityString(UnusedLocalVariable));
269 optionsMap.put(OPTION_ReportUnusedParameter, getSeverityString(UnusedArgument));
270 optionsMap.put(OPTION_ReportUnusedImport, getSeverityString(UnusedImport));
271 optionsMap.put(OPTION_ReportSyntheticAccessEmulation, getSeverityString(AccessEmulation));
272 optionsMap.put(OPTION_ReportNoEffectAssignment, getSeverityString(NoEffectAssignment));
273 optionsMap.put(OPTION_ReportNonExternalizedStringLiteral, getSeverityString(NonExternalizedString));
274 optionsMap.put(OPTION_ReportNoImplicitStringConversion, getSeverityString(NoImplicitStringConversion));
275 optionsMap.put(OPTION_ReportNonStaticAccessToStatic, getSeverityString(NonStaticAccessToStatic));
276 optionsMap.put(OPTION_ReportIndirectStaticAccess, getSeverityString(IndirectStaticAccess));
277 optionsMap.put(OPTION_ReportIncompatibleNonInheritedInterfaceMethod, getSeverityString(IncompatibleNonInheritedInterfaceMethod));
278 optionsMap.put(OPTION_ReportUnusedPrivateMember, getSeverityString(UnusedPrivateMember));
279 optionsMap.put(OPTION_ReportLocalVariableHiding, getSeverityString(LocalVariableHiding));
280 optionsMap.put(OPTION_ReportFieldHiding, getSeverityString(FieldHiding));
281 optionsMap.put(OPTION_ReportPossibleAccidentalBooleanAssignment, getSeverityString(AccidentalBooleanAssign));
282 optionsMap.put(OPTION_ReportEmptyStatement, getSeverityString(EmptyStatement));
283 optionsMap.put(OPTION_ReportAssertIdentifier, getSeverityString(AssertUsedAsAnIdentifier));
284 optionsMap.put(OPTION_ReportUndocumentedEmptyBlock, getSeverityString(UndocumentedEmptyBlock));
285 optionsMap.put(OPTION_ReportUnnecessaryTypeCheck, getSeverityString(UnnecessaryTypeCheck));
286 optionsMap.put(OPTION_ReportUnnecessaryElse, getSeverityString(UnnecessaryElse));
287 optionsMap.put(OPTION_ReportInvalidJavadoc, getSeverityString(InvalidJavadoc));
288 optionsMap.put(OPTION_ReportInvalidJavadocTagsVisibility, getVisibilityString(this.reportInvalidJavadocTagsVisibility));
289 optionsMap.put(OPTION_ReportInvalidJavadocTags, this.reportInvalidJavadocTags? ENABLED : DISABLED);
290 optionsMap.put(OPTION_ReportMissingJavadocTags, getSeverityString(MissingJavadocTags));
291 optionsMap.put(OPTION_ReportMissingJavadocTagsVisibility, getVisibilityString(this.reportMissingJavadocTagsVisibility));
292 optionsMap.put(OPTION_ReportMissingJavadocTagsOverriding, this.reportMissingJavadocTagsOverriding ? ENABLED : DISABLED);
293 optionsMap.put(OPTION_ReportMissingJavadocComments, getSeverityString(MissingJavadocComments));
294 optionsMap.put(OPTION_ReportMissingJavadocCommentsVisibility, getVisibilityString(this.reportMissingJavadocCommentsVisibility));
295 optionsMap.put(OPTION_ReportMissingJavadocCommentsOverriding, this.reportMissingJavadocCommentsOverriding ? ENABLED : DISABLED);
296 optionsMap.put(OPTION_ReportFinallyBlockNotCompletingNormally, getSeverityString(FinallyBlockNotCompleting));
297 optionsMap.put(OPTION_ReportUnusedDeclaredThrownException, getSeverityString(UnusedDeclaredThrownException));
298 optionsMap.put(OPTION_ReportUnusedDeclaredThrownExceptionWhenOverriding, this.reportUnusedDeclaredThrownExceptionWhenOverriding ? ENABLED : DISABLED);
299 optionsMap.put(OPTION_ReportUnqualifiedFieldAccess, getSeverityString(UnqualifiedFieldAccess));
300 optionsMap.put(OPTION_Compliance, versionFromJdkLevel(this.complianceLevel));
301 optionsMap.put(OPTION_Source, versionFromJdkLevel(this.sourceLevel));
302 optionsMap.put(OPTION_TargetPlatform, versionFromJdkLevel(this.targetJDK));
303 if (this.defaultEncoding != null) {
304 optionsMap.put(OPTION_Encoding, this.defaultEncoding);
306 optionsMap.put(OPTION_TaskTags, this.taskTags == null ? "" : new String(CharOperation.concatWith(this.taskTags,','))); //$NON-NLS-1$
307 optionsMap.put(OPTION_TaskPriorities, this.taskPriorites == null ? "" : new String(CharOperation.concatWith(this.taskPriorites,','))); //$NON-NLS-1$
308 optionsMap.put(OPTION_TaskCaseSensitive, this.isTaskCaseSensitive ? ENABLED : DISABLED);
309 optionsMap.put(OPTION_ReportUnusedParameterWhenImplementingAbstract, this.reportUnusedParameterWhenImplementingAbstract ? ENABLED : DISABLED);
310 optionsMap.put(OPTION_ReportUnusedParameterWhenOverridingConcrete, this.reportUnusedParameterWhenOverridingConcrete ? ENABLED : DISABLED);
311 optionsMap.put(OPTION_ReportSpecialParameterHidingField, this.reportSpecialParameterHidingField ? ENABLED : DISABLED);
312 optionsMap.put(OPTION_MaxProblemPerUnit, String.valueOf(this.maxProblemsPerUnit));
313 optionsMap.put(OPTION_InlineJsr, this.inlineJsrBytecode ? ENABLED : DISABLED);
317 public int getSeverity(long irritant) {
318 if((this.warningThreshold & irritant) != 0)
320 if((this.errorThreshold & irritant) != 0)
325 public String getSeverityString(long irritant) {
326 if((this.warningThreshold & irritant) != 0)
328 if((this.errorThreshold & irritant) != 0)
333 public String getVisibilityString(int level) {
346 public void set(Map optionsMap) {
349 if ((optionValue = optionsMap.get(OPTION_LocalVariableAttribute)) != null) {
350 if (GENERATE.equals(optionValue)) {
351 this.produceDebugAttributes |= Vars;
352 } else if (DO_NOT_GENERATE.equals(optionValue)) {
353 this.produceDebugAttributes &= ~Vars;
356 if ((optionValue = optionsMap.get(OPTION_LineNumberAttribute)) != null) {
357 if (GENERATE.equals(optionValue)) {
358 this.produceDebugAttributes |= Lines;
359 } else if (DO_NOT_GENERATE.equals(optionValue)) {
360 this.produceDebugAttributes &= ~Lines;
363 if ((optionValue = optionsMap.get(OPTION_SourceFileAttribute)) != null) {
364 if (GENERATE.equals(optionValue)) {
365 this.produceDebugAttributes |= Source;
366 } else if (DO_NOT_GENERATE.equals(optionValue)) {
367 this.produceDebugAttributes &= ~Source;
370 if ((optionValue = optionsMap.get(OPTION_PreserveUnusedLocal)) != null) {
371 if (PRESERVE.equals(optionValue)) {
372 this.preserveAllLocalVariables = true;
373 } else if (OPTIMIZE_OUT.equals(optionValue)) {
374 this.preserveAllLocalVariables = false;
377 if ((optionValue = optionsMap.get(OPTION_ReportDeprecationInDeprecatedCode)) != null) {
378 if (ENABLED.equals(optionValue)) {
379 this.reportDeprecationInsideDeprecatedCode = true;
380 } else if (DISABLED.equals(optionValue)) {
381 this.reportDeprecationInsideDeprecatedCode = false;
384 if ((optionValue = optionsMap.get(OPTION_ReportDeprecationWhenOverridingDeprecatedMethod)) != null) {
385 if (ENABLED.equals(optionValue)) {
386 this.reportDeprecationWhenOverridingDeprecatedMethod = true;
387 } else if (DISABLED.equals(optionValue)) {
388 this.reportDeprecationWhenOverridingDeprecatedMethod = false;
391 if ((optionValue = optionsMap.get(OPTION_ReportUnusedDeclaredThrownExceptionWhenOverriding)) != null) {
392 if (ENABLED.equals(optionValue)) {
393 this.reportUnusedDeclaredThrownExceptionWhenOverriding = true;
394 } else if (DISABLED.equals(optionValue)) {
395 this.reportUnusedDeclaredThrownExceptionWhenOverriding = false;
398 if ((optionValue = optionsMap.get(OPTION_Compliance)) != null) {
399 long level = versionToJdkLevel(optionValue);
400 if (level != 0) this.complianceLevel = level;
402 if ((optionValue = optionsMap.get(OPTION_Source)) != null) {
403 long level = versionToJdkLevel(optionValue);
404 if (level != 0) this.sourceLevel = level;
406 if ((optionValue = optionsMap.get(OPTION_TargetPlatform)) != null) {
407 long level = versionToJdkLevel(optionValue);
408 if (level != 0) this.targetJDK = level;
410 if ((optionValue = optionsMap.get(OPTION_Encoding)) != null) {
411 if (optionValue instanceof String) {
412 this.defaultEncoding = null;
413 String stringValue = (String) optionValue;
414 if (stringValue.length() > 0){
416 new InputStreamReader(new ByteArrayInputStream(new byte[0]), stringValue);
417 this.defaultEncoding = stringValue;
418 } catch(UnsupportedEncodingException e){
419 // ignore unsupported encoding
424 if ((optionValue = optionsMap.get(OPTION_PrivateConstructorAccess)) != null) {
425 long level = versionToJdkLevel(optionValue);
426 if (level >= JDK1_3) this.isPrivateConstructorAccessChangingVisibility = true;
428 if ((optionValue = optionsMap.get(OPTION_ReportUnusedParameterWhenImplementingAbstract)) != null) {
429 if (ENABLED.equals(optionValue)) {
430 this.reportUnusedParameterWhenImplementingAbstract = true;
431 } else if (DISABLED.equals(optionValue)) {
432 this.reportUnusedParameterWhenImplementingAbstract = false;
435 if ((optionValue = optionsMap.get(OPTION_ReportUnusedParameterWhenOverridingConcrete)) != null) {
436 if (ENABLED.equals(optionValue)) {
437 this.reportUnusedParameterWhenOverridingConcrete = true;
438 } else if (DISABLED.equals(optionValue)) {
439 this.reportUnusedParameterWhenOverridingConcrete = false;
442 if ((optionValue = optionsMap.get(OPTION_ReportSpecialParameterHidingField)) != null) {
443 if (ENABLED.equals(optionValue)) {
444 this.reportSpecialParameterHidingField = true;
445 } else if (DISABLED.equals(optionValue)) {
446 this.reportSpecialParameterHidingField = false;
449 if ((optionValue = optionsMap.get(OPTION_MaxProblemPerUnit)) != null) {
450 if (optionValue instanceof String) {
451 String stringValue = (String) optionValue;
453 int val = Integer.parseInt(stringValue);
454 if (val >= 0) this.maxProblemsPerUnit = val;
455 } catch(NumberFormatException e){
456 // ignore ill-formatted limit
460 if ((optionValue = optionsMap.get(OPTION_TaskTags)) != null) {
461 if (optionValue instanceof String) {
462 String stringValue = (String) optionValue;
463 if (stringValue.length() == 0) {
464 this.taskTags = null;
466 this.taskTags = CharOperation.splitAndTrimOn(',', stringValue.toCharArray());
470 if ((optionValue = optionsMap.get(OPTION_TaskPriorities)) != null) {
471 if (optionValue instanceof String) {
472 String stringValue = (String) optionValue;
473 if (stringValue.length() == 0) {
474 this.taskPriorites = null;
476 this.taskPriorites = CharOperation.splitAndTrimOn(',', stringValue.toCharArray());
480 if ((optionValue = optionsMap.get(OPTION_TaskCaseSensitive)) != null) {
481 if (ENABLED.equals(optionValue)) {
482 this.isTaskCaseSensitive = true;
483 } else if (DISABLED.equals(optionValue)) {
484 this.isTaskCaseSensitive = false;
487 if ((optionValue = optionsMap.get(OPTION_InlineJsr)) != null) {
488 if (ENABLED.equals(optionValue)) {
489 this.inlineJsrBytecode = true;
490 } else if (DISABLED.equals(optionValue)) {
491 this.inlineJsrBytecode = false;
494 if ((optionValue = optionsMap.get(OPTION_ReportMethodWithConstructorName)) != null) updateSeverity(MethodWithConstructorName, optionValue);
495 if ((optionValue = optionsMap.get(OPTION_ReportOverridingPackageDefaultMethod)) != null) updateSeverity(OverriddenPackageDefaultMethod, optionValue);
496 if ((optionValue = optionsMap.get(OPTION_ReportDeprecation)) != null) updateSeverity(UsingDeprecatedAPI, optionValue);
497 if ((optionValue = optionsMap.get(OPTION_ReportHiddenCatchBlock)) != null) updateSeverity(MaskedCatchBlock, optionValue);
498 if ((optionValue = optionsMap.get(OPTION_ReportUnusedLocal)) != null) updateSeverity(UnusedLocalVariable, optionValue);
499 if ((optionValue = optionsMap.get(OPTION_ReportUnusedParameter)) != null) updateSeverity(UnusedArgument, optionValue);
500 if ((optionValue = optionsMap.get(OPTION_ReportUnusedImport)) != null) updateSeverity(UnusedImport, optionValue);
501 if ((optionValue = optionsMap.get(OPTION_ReportUnusedPrivateMember)) != null) updateSeverity(UnusedPrivateMember, optionValue);
502 if ((optionValue = optionsMap.get(OPTION_ReportUnusedDeclaredThrownException)) != null) updateSeverity(UnusedDeclaredThrownException, optionValue);
503 if ((optionValue = optionsMap.get(OPTION_ReportNoImplicitStringConversion)) != null) updateSeverity(NoImplicitStringConversion, optionValue);
504 if ((optionValue = optionsMap.get(OPTION_ReportSyntheticAccessEmulation)) != null) updateSeverity(AccessEmulation, optionValue);
505 if ((optionValue = optionsMap.get(OPTION_ReportLocalVariableHiding)) != null) updateSeverity(LocalVariableHiding, optionValue);
506 if ((optionValue = optionsMap.get(OPTION_ReportFieldHiding)) != null) updateSeverity(FieldHiding, optionValue);
507 if ((optionValue = optionsMap.get(OPTION_ReportPossibleAccidentalBooleanAssignment)) != null) updateSeverity(AccidentalBooleanAssign, optionValue);
508 if ((optionValue = optionsMap.get(OPTION_ReportEmptyStatement)) != null) updateSeverity(EmptyStatement, optionValue);
509 if ((optionValue = optionsMap.get(OPTION_ReportNonExternalizedStringLiteral)) != null) updateSeverity(NonExternalizedString, optionValue);
510 if ((optionValue = optionsMap.get(OPTION_ReportAssertIdentifier)) != null) updateSeverity(AssertUsedAsAnIdentifier, optionValue);
511 if ((optionValue = optionsMap.get(OPTION_ReportNonStaticAccessToStatic)) != null) updateSeverity(NonStaticAccessToStatic, optionValue);
512 if ((optionValue = optionsMap.get(OPTION_ReportIndirectStaticAccess)) != null) updateSeverity(IndirectStaticAccess, optionValue);
513 if ((optionValue = optionsMap.get(OPTION_ReportIncompatibleNonInheritedInterfaceMethod)) != null) updateSeverity(IncompatibleNonInheritedInterfaceMethod, optionValue);
514 if ((optionValue = optionsMap.get(OPTION_ReportUndocumentedEmptyBlock)) != null) updateSeverity(UndocumentedEmptyBlock, optionValue);
515 if ((optionValue = optionsMap.get(OPTION_ReportUnnecessaryTypeCheck)) != null) updateSeverity(UnnecessaryTypeCheck, optionValue);
516 if ((optionValue = optionsMap.get(OPTION_ReportFinallyBlockNotCompletingNormally)) != null) updateSeverity(FinallyBlockNotCompleting, optionValue);
517 if ((optionValue = optionsMap.get(OPTION_ReportUnqualifiedFieldAccess)) != null) updateSeverity(UnqualifiedFieldAccess, optionValue);
518 if ((optionValue = optionsMap.get(OPTION_ReportNoEffectAssignment)) != null) updateSeverity(NoEffectAssignment, optionValue);
519 if ((optionValue = optionsMap.get(OPTION_ReportUnnecessaryElse)) != null) updateSeverity(UnnecessaryElse, optionValue);
522 if ((optionValue = optionsMap.get(OPTION_DocCommentSupport)) != null) {
523 if (ENABLED.equals(optionValue)) {
524 this.docCommentSupport = true;
525 } else if (DISABLED.equals(optionValue)) {
526 this.docCommentSupport = false;
529 if ((optionValue = optionsMap.get(OPTION_ReportInvalidJavadoc)) != null) {
530 updateSeverity(InvalidJavadoc, optionValue);
532 if ((optionValue = optionsMap.get(OPTION_ReportInvalidJavadocTagsVisibility)) != null) {
533 if (PUBLIC.equals(optionValue)) {
534 this.reportInvalidJavadocTagsVisibility = AccPublic;
535 } else if (PROTECTED.equals(optionValue)) {
536 this.reportInvalidJavadocTagsVisibility = AccProtected;
537 } else if (DEFAULT.equals(optionValue)) {
538 this.reportInvalidJavadocTagsVisibility = AccDefault;
539 } else if (PRIVATE.equals(optionValue)) {
540 this.reportInvalidJavadocTagsVisibility = AccPrivate;
543 if ((optionValue = optionsMap.get(OPTION_ReportInvalidJavadocTags)) != null) {
544 if (ENABLED.equals(optionValue)) {
545 this.reportInvalidJavadocTags= true;
546 } else if (DISABLED.equals(optionValue)) {
547 this.reportInvalidJavadocTags = false;
550 if ((optionValue = optionsMap.get(OPTION_ReportMissingJavadocTags)) != null) {
551 updateSeverity(MissingJavadocTags, optionValue);
553 if ((optionValue = optionsMap.get(OPTION_ReportMissingJavadocTagsVisibility)) != null) {
554 if (PUBLIC.equals(optionValue)) {
555 this.reportMissingJavadocTagsVisibility = AccPublic;
556 } else if (PROTECTED.equals(optionValue)) {
557 this.reportMissingJavadocTagsVisibility = AccProtected;
558 } else if (DEFAULT.equals(optionValue)) {
559 this.reportMissingJavadocTagsVisibility = AccDefault;
560 } else if (PRIVATE.equals(optionValue)) {
561 this.reportMissingJavadocTagsVisibility = AccPrivate;
564 if ((optionValue = optionsMap.get(OPTION_ReportMissingJavadocTagsOverriding)) != null) {
565 if (ENABLED.equals(optionValue)) {
566 this.reportMissingJavadocTagsOverriding = true;
567 } else if (DISABLED.equals(optionValue)) {
568 this.reportMissingJavadocTagsOverriding = false;
571 if ((optionValue = optionsMap.get(OPTION_ReportMissingJavadocComments)) != null) {
572 updateSeverity(MissingJavadocComments, optionValue);
574 if ((optionValue = optionsMap.get(OPTION_ReportMissingJavadocCommentsVisibility)) != null) {
575 if (PUBLIC.equals(optionValue)) {
576 this.reportMissingJavadocCommentsVisibility = AccPublic;
577 } else if (PROTECTED.equals(optionValue)) {
578 this.reportMissingJavadocCommentsVisibility = AccProtected;
579 } else if (DEFAULT.equals(optionValue)) {
580 this.reportMissingJavadocCommentsVisibility = AccDefault;
581 } else if (PRIVATE.equals(optionValue)) {
582 this.reportMissingJavadocCommentsVisibility = AccPrivate;
585 if ((optionValue = optionsMap.get(OPTION_ReportMissingJavadocCommentsOverriding)) != null) {
586 if (ENABLED.equals(optionValue)) {
587 this.reportMissingJavadocCommentsOverriding = true;
588 } else if (DISABLED.equals(optionValue)) {
589 this.reportMissingJavadocCommentsOverriding = false;
594 public String toString() {
596 StringBuffer buf = new StringBuffer("CompilerOptions:"); //$NON-NLS-1$
597 buf.append("\n\t- local variables debug attributes: ").append((this.produceDebugAttributes & Vars) != 0 ? "ON" : " OFF"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
598 buf.append("\n\t- line number debug attributes: ").append((this.produceDebugAttributes & Lines) != 0 ? "ON" : " OFF"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
599 buf.append("\n\t- source debug attributes: ").append((this.produceDebugAttributes & Source) != 0 ? "ON" : " OFF"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
600 buf.append("\n\t- preserve all local variables: ").append(this.preserveAllLocalVariables ? "ON" : " OFF"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
601 buf.append("\n\t- method with constructor name: ").append(getSeverityString(MethodWithConstructorName)); //$NON-NLS-1$
602 buf.append("\n\t- overridden package default method: ").append(getSeverityString(OverriddenPackageDefaultMethod)); //$NON-NLS-1$
603 buf.append("\n\t- deprecation: ").append(getSeverityString(UsingDeprecatedAPI)); //$NON-NLS-1$
604 buf.append("\n\t- masked catch block: ").append(getSeverityString(MaskedCatchBlock)); //$NON-NLS-1$
605 buf.append("\n\t- unused local variable: ").append(getSeverityString(UnusedLocalVariable)); //$NON-NLS-1$
606 buf.append("\n\t- unused parameter: ").append(getSeverityString(UnusedArgument)); //$NON-NLS-1$
607 buf.append("\n\t- unused import: ").append(getSeverityString(UnusedImport)); //$NON-NLS-1$
608 buf.append("\n\t- synthetic access emulation: ").append(getSeverityString(AccessEmulation)); //$NON-NLS-1$
609 buf.append("\n\t- assignment with no effect: ").append(getSeverityString(NoEffectAssignment)); //$NON-NLS-1$
610 buf.append("\n\t- non externalized string: ").append(getSeverityString(NonExternalizedString)); //$NON-NLS-1$
611 buf.append("\n\t- static access receiver: ").append(getSeverityString(NonStaticAccessToStatic)); //$NON-NLS-1$
612 buf.append("\n\t- indirect static access: ").append(getSeverityString(IndirectStaticAccess)); //$NON-NLS-1$
613 buf.append("\n\t- incompatible non inherited interface method: ").append(getSeverityString(IncompatibleNonInheritedInterfaceMethod)); //$NON-NLS-1$
614 buf.append("\n\t- unused private member: ").append(getSeverityString(UnusedPrivateMember)); //$NON-NLS-1$
615 buf.append("\n\t- local variable hiding another variable: ").append(getSeverityString(LocalVariableHiding)); //$NON-NLS-1$
616 buf.append("\n\t- field hiding another variable: ").append(getSeverityString(FieldHiding)); //$NON-NLS-1$
617 buf.append("\n\t- possible accidental boolean assignment: ").append(getSeverityString(AccidentalBooleanAssign)); //$NON-NLS-1$
618 buf.append("\n\t- superfluous semicolon: ").append(getSeverityString(EmptyStatement)); //$NON-NLS-1$
619 buf.append("\n\t- uncommented empty block: ").append(getSeverityString(UndocumentedEmptyBlock)); //$NON-NLS-1$
620 buf.append("\n\t- unnecessary type check: ").append(getSeverityString(UnnecessaryTypeCheck)); //$NON-NLS-1$
621 buf.append("\n\t- javadoc comment support: ").append(this.docCommentSupport ? "ON" : " OFF"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
622 buf.append("\n\t\t+ invalid javadoc: ").append(getSeverityString(InvalidJavadoc)); //$NON-NLS-1$
623 buf.append("\n\t\t+ report invalid javadoc tags: ").append(this.reportInvalidJavadocTags ? ENABLED : DISABLED); //$NON-NLS-1$
624 buf.append("\n\t\t+ visibility level to report invalid javadoc tags: ").append(getVisibilityString(this.reportInvalidJavadocTagsVisibility)); //$NON-NLS-1$
625 buf.append("\n\t\t+ missing javadoc tags: ").append(getSeverityString(MissingJavadocTags)); //$NON-NLS-1$
626 buf.append("\n\t\t+ visibility level to report missing javadoc tags: ").append(getVisibilityString(this.reportMissingJavadocTagsVisibility)); //$NON-NLS-1$
627 buf.append("\n\t\t+ report missing javadoc tags in overriding methods: ").append(this.reportMissingJavadocTagsOverriding ? ENABLED : DISABLED); //$NON-NLS-1$
628 buf.append("\n\t\t+ missing javadoc comments: ").append(getSeverityString(MissingJavadocComments)); //$NON-NLS-1$
629 buf.append("\n\t\t+ visibility level to report missing javadoc comments: ").append(getVisibilityString(this.reportMissingJavadocCommentsVisibility)); //$NON-NLS-1$
630 buf.append("\n\t\t+ report missing javadoc comments in overriding methods: ").append(this.reportMissingJavadocCommentsOverriding ? ENABLED : DISABLED); //$NON-NLS-1$
631 buf.append("\n\t- finally block not completing normally: ").append(getSeverityString(FinallyBlockNotCompleting)); //$NON-NLS-1$
632 buf.append("\n\t- unused declared thrown exception: ").append(getSeverityString(UnusedDeclaredThrownException)); //$NON-NLS-1$
633 buf.append("\n\t- unused declared thrown exception when overriding: ").append(this.reportUnusedDeclaredThrownExceptionWhenOverriding ? ENABLED : DISABLED); //$NON-NLS-1$
634 buf.append("\n\t- unnecessary else: ").append(getSeverityString(UnnecessaryElse)); //$NON-NLS-1$
635 buf.append("\n\t- JDK compliance level: "+ versionFromJdkLevel(this.complianceLevel)); //$NON-NLS-1$
636 buf.append("\n\t- JDK source level: "+ versionFromJdkLevel(this.sourceLevel)); //$NON-NLS-1$
637 buf.append("\n\t- JDK target level: "+ versionFromJdkLevel(this.targetJDK)); //$NON-NLS-1$
638 buf.append("\n\t- private constructor access: ").append(this.isPrivateConstructorAccessChangingVisibility ? "extra argument" : "make default access"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
639 buf.append("\n\t- verbose : ").append(this.verbose ? "ON" : "OFF"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
640 buf.append("\n\t- produce reference info : ").append(this.produceReferenceInfo ? "ON" : "OFF"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
641 buf.append("\n\t- parse literal expressions as constants : ").append(this.parseLiteralExpressionsAsConstants ? "ON" : "OFF"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
642 buf.append("\n\t- encoding : ").append(this.defaultEncoding == null ? "<default>" : this.defaultEncoding); //$NON-NLS-1$ //$NON-NLS-2$
643 buf.append("\n\t- task tags: ").append(this.taskTags == null ? "" : new String(CharOperation.concatWith(this.taskTags,','))); //$NON-NLS-1$ //$NON-NLS-2$
644 buf.append("\n\t- task priorities : ").append(this.taskPriorites == null ? "" : new String(CharOperation.concatWith(this.taskPriorites,','))); //$NON-NLS-1$ //$NON-NLS-2$
645 buf.append("\n\t- report deprecation inside deprecated code : ").append(this.reportDeprecationInsideDeprecatedCode ? ENABLED : DISABLED); //$NON-NLS-1$
646 buf.append("\n\t- report deprecation when overriding deprecated method : ").append(this.reportDeprecationWhenOverridingDeprecatedMethod ? ENABLED : DISABLED); //$NON-NLS-1$
647 buf.append("\n\t- report unused parameter when implementing abstract method : ").append(this.reportUnusedParameterWhenImplementingAbstract ? ENABLED : DISABLED); //$NON-NLS-1$
648 buf.append("\n\t- report unused parameter when overriding concrete method : ").append(this.reportUnusedParameterWhenOverridingConcrete ? ENABLED : DISABLED); //$NON-NLS-1$
649 buf.append("\n\t- report constructor/setter parameter hiding existing field : ").append(this.reportSpecialParameterHidingField ? ENABLED : DISABLED); //$NON-NLS-1$
650 buf.append("\n\t- inline JSR bytecode : ").append(this.inlineJsrBytecode ? ENABLED : DISABLED); //$NON-NLS-1$
651 return buf.toString();
654 void updateSeverity(long irritant, Object severityString) {
655 if (ERROR.equals(severityString)) {
656 this.errorThreshold |= irritant;
657 this.warningThreshold &= ~irritant;
658 } else if (WARNING.equals(severityString)) {
659 this.errorThreshold &= ~irritant;
660 this.warningThreshold |= irritant;
661 } else if (IGNORE.equals(severityString)) {
662 this.errorThreshold &= ~irritant;
663 this.warningThreshold &= ~irritant;
666 public static long versionToJdkLevel(Object versionID) {
667 if (VERSION_1_1.equals(versionID)) {
669 } else if (VERSION_1_2.equals(versionID)) {
671 } else if (VERSION_1_3.equals(versionID)) {
673 } else if (VERSION_1_4.equals(versionID)) {
675 } else if (VERSION_1_5.equals(versionID)) {
681 public static String versionFromJdkLevel(long jdkLevel) {
682 if (jdkLevel == JDK1_1) {
684 } else if (jdkLevel == JDK1_2) {
686 } else if (jdkLevel == JDK1_3) {
688 } else if (jdkLevel == JDK1_4) {
690 } else if (jdkLevel == JDK1_5) {
693 return ""; // unknown version //$NON-NLS-1$