b729405f6c47a908e78a95bd6b24bcf29b680e2c
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / impl / CompilerOptions.java
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
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package net.sourceforge.phpdt.internal.compiler.impl;
12
13 import java.io.ByteArrayInputStream;
14 import java.io.InputStreamReader;
15 import java.io.UnsupportedEncodingException;
16 import java.util.HashMap;
17 import java.util.Map;
18
19 import net.sourceforge.phpdt.core.compiler.CharOperation;
20 import net.sourceforge.phpdt.core.compiler.IProblem;
21 import net.sourceforge.phpdt.internal.compiler.Compiler;
22 import net.sourceforge.phpdt.internal.compiler.env.IConstants;
23 import net.sourceforge.phpdt.internal.compiler.lookup.ProblemReasons;
24 import net.sourceforge.phpdt.internal.compiler.problem.ProblemSeverities;
25
26 public class CompilerOptions implements ProblemReasons, ProblemSeverities, IConstants {
27         
28         /**
29          * Option IDs
30          */
31     public static final String OPTION_PHPVarDeprecatedWarning = "net.sourceforge.phpeclipse.compiler.problem.phpVarDeprecatedWarning"; //$NON-NLS-1$
32     public static final String OPTION_PHPBadStyleKeywordWarning = "net.sourceforge.phpeclipse.compiler.problem.phpBadStyleKeywordWarning"; //$NON-NLS-1$
33     public static final String OPTION_PHPBadStyleUppercaseIdentifierWarning = "net.sourceforge.phpeclipse.compiler.problem.phpBadStyleUppercaseIdentifierWarning"; //$NON-NLS-1$
34     public static final String OPTION_PHPIncludeNotExistWarning = "net.sourceforge.phpeclipse.compiler.problem.phpIncludeNotExistWarning"; //$NON-NLS-1$
35     public static final String OPTION_UninitializedLocalVariableWarning = "net.sourceforge.phpeclipse.compiler.problem.uninitializedLocalVariableWarning"; //$NON-NLS-1$
36     public static final String OPTION_CodeCannotBeReachedWarning = "net.sourceforge.phpeclipse.compiler.problem.codeCannotBeReachedWarning"; //$NON-NLS-1$
37     
38     public static final String OPTION_LocalVariableAttribute = "net.sourceforge.phpeclipse.compiler.debug.localVariable"; //$NON-NLS-1$
39         public static final String OPTION_LineNumberAttribute = "net.sourceforge.phpeclipse.compiler.debug.lineNumber"; //$NON-NLS-1$
40         public static final String OPTION_SourceFileAttribute = "net.sourceforge.phpeclipse.compiler.debug.sourceFile"; //$NON-NLS-1$
41 //      public static final String OPTION_PreserveUnusedLocal = "net.sourceforge.phpeclipse.compiler.codegen.unusedLocal"; //$NON-NLS-1$
42         public static final String OPTION_DocCommentSupport= "net.sourceforge.phpeclipse.compiler.doc.comment.support"; //$NON-NLS-1$
43         public static final String OPTION_ReportMethodWithConstructorName = "net.sourceforge.phpeclipse.compiler.problem.methodWithConstructorName"; //$NON-NLS-1$
44         public static final String OPTION_ReportOverridingPackageDefaultMethod = "net.sourceforge.phpeclipse.compiler.problem.overridingPackageDefaultMethod"; //$NON-NLS-1$
45         public static final String OPTION_ReportDeprecation = "net.sourceforge.phpeclipse.compiler.problem.deprecation"; //$NON-NLS-1$
46         public static final String OPTION_ReportDeprecationInDeprecatedCode = "net.sourceforge.phpeclipse.compiler.problem.deprecationInDeprecatedCode"; //$NON-NLS-1$
47         public static final String OPTION_ReportDeprecationWhenOverridingDeprecatedMethod = "net.sourceforge.phpeclipse.compiler.problem.deprecationWhenOverridingDeprecatedMethod"; //$NON-NLS-1$
48         public static final String OPTION_ReportHiddenCatchBlock = "net.sourceforge.phpeclipse.compiler.problem.hiddenCatchBlock"; //$NON-NLS-1$
49         public static final String OPTION_ReportUnusedLocal = "net.sourceforge.phpeclipse.compiler.problem.unusedLocal"; //$NON-NLS-1$
50         public static final String OPTION_ReportUnusedParameter = "net.sourceforge.phpeclipse.compiler.problem.unusedParameter"; //$NON-NLS-1$
51         public static final String OPTION_ReportUnusedParameterWhenImplementingAbstract = "net.sourceforge.phpeclipse.compiler.problem.unusedParameterWhenImplementingAbstract"; //$NON-NLS-1$
52         public static final String OPTION_ReportUnusedParameterWhenOverridingConcrete = "net.sourceforge.phpeclipse.compiler.problem.unusedParameterWhenOverridingConcrete"; //$NON-NLS-1$
53         public static final String OPTION_ReportUnusedImport = "net.sourceforge.phpeclipse.compiler.problem.unusedImport"; //$NON-NLS-1$
54         public static final String OPTION_ReportSyntheticAccessEmulation = "net.sourceforge.phpeclipse.compiler.problem.syntheticAccessEmulation"; //$NON-NLS-1$
55         public static final String OPTION_ReportNoEffectAssignment = "net.sourceforge.phpeclipse.compiler.problem.noEffectAssignment"; //$NON-NLS-1$
56         public static final String OPTION_ReportLocalVariableHiding = "net.sourceforge.phpeclipse.compiler.problem.localVariableHiding"; //$NON-NLS-1$
57         public static final String OPTION_ReportSpecialParameterHidingField = "net.sourceforge.phpeclipse.compiler.problem.specialParameterHidingField"; //$NON-NLS-1$
58         public static final String OPTION_ReportFieldHiding = "net.sourceforge.phpeclipse.compiler.problem.fieldHiding"; //$NON-NLS-1$
59         public static final String OPTION_ReportPossibleAccidentalBooleanAssignment = "net.sourceforge.phpeclipse.compiler.problem.possibleAccidentalBooleanAssignment"; //$NON-NLS-1$
60         public static final String OPTION_ReportNonExternalizedStringLiteral = "net.sourceforge.phpeclipse.compiler.problem.nonExternalizedStringLiteral"; //$NON-NLS-1$
61         public static final String OPTION_ReportIncompatibleNonInheritedInterfaceMethod = "net.sourceforge.phpeclipse.compiler.problem.incompatibleNonInheritedInterfaceMethod"; //$NON-NLS-1$
62         public static final String OPTION_ReportUnusedPrivateMember = "net.sourceforge.phpeclipse.compiler.problem.unusedPrivateMember"; //$NON-NLS-1$
63         public static final String OPTION_ReportNoImplicitStringConversion = "net.sourceforge.phpeclipse.compiler.problem.noImplicitStringConversion"; //$NON-NLS-1$
64         public static final String OPTION_ReportAssertIdentifier = "net.sourceforge.phpeclipse.compiler.problem.assertIdentifier"; //$NON-NLS-1$
65         public static final String OPTION_ReportNonStaticAccessToStatic = "net.sourceforge.phpeclipse.compiler.problem.staticAccessReceiver"; //$NON-NLS-1$
66         public static final String OPTION_ReportIndirectStaticAccess = "net.sourceforge.phpeclipse.compiler.problem.indirectStaticAccess"; //$NON-NLS-1$
67         public static final String OPTION_ReportSuperfluousSemicolon = "net.sourceforge.phpeclipse.compiler.problem.superfluousSemicolon"; //$NON-NLS-1$
68         public static final String OPTION_ReportUnnecessaryTypeCheck = "net.sourceforge.phpeclipse.compiler.problem.unnecessaryTypeCheck"; //$NON-NLS-1$
69         public static final String OPTION_ReportUndocumentedEmptyBlock = "net.sourceforge.phpeclipse.compiler.problem.undocumentedEmptyBlock"; //$NON-NLS-1$
70         public static final String OPTION_ReportInvalidJavadoc = "net.sourceforge.phpeclipse.compiler.problem.invalidJavadoc"; //$NON-NLS-1$
71         public static final String OPTION_ReportInvalidJavadocTags = "net.sourceforge.phpeclipse.compiler.problem.invalidJavadocTags"; //$NON-NLS-1$
72         public static final String OPTION_ReportInvalidJavadocTagsVisibility = "net.sourceforge.phpeclipse.compiler.problem.invalidJavadocTagsVisibility"; //$NON-NLS-1$
73         public static final String OPTION_ReportMissingJavadocTags = "net.sourceforge.phpeclipse.compiler.problem.missingJavadocTags"; //$NON-NLS-1$
74         public static final String OPTION_ReportMissingJavadocTagsVisibility = "net.sourceforge.phpeclipse.compiler.problem.missingJavadocTagsVisibility"; //$NON-NLS-1$
75         public static final String OPTION_ReportMissingJavadocTagsOverriding = "net.sourceforge.phpeclipse.compiler.problem.missingJavadocTagsOverriding"; //$NON-NLS-1$
76         public static final String OPTION_ReportMissingJavadocComments = "net.sourceforge.phpeclipse.compiler.problem.missingJavadocComments"; //$NON-NLS-1$
77         public static final String OPTION_ReportMissingJavadocCommentsVisibility = "net.sourceforge.phpeclipse.compiler.problem.missingJavadocCommentsVisibility"; //$NON-NLS-1$
78         public static final String OPTION_ReportMissingJavadocCommentsOverriding = "net.sourceforge.phpeclipse.compiler.problem.missingJavadocCommentsOverriding"; //$NON-NLS-1$
79         public static final String OPTION_ReportFinallyBlockNotCompletingNormally = "net.sourceforge.phpeclipse.compiler.problem.finallyBlockNotCompletingNormally"; //$NON-NLS-1$
80         public static final String OPTION_ReportUnusedDeclaredThrownException = "net.sourceforge.phpeclipse.compiler.problem.unusedDeclaredThrownException"; //$NON-NLS-1$
81         public static final String OPTION_ReportUnusedDeclaredThrownExceptionWhenOverriding = "net.sourceforge.phpeclipse.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding"; //$NON-NLS-1$
82         public static final String OPTION_ReportUnqualifiedFieldAccess = "net.sourceforge.phpeclipse.compiler.problem.unqualifiedFieldAccess"; //$NON-NLS-1$
83 //      public static final String OPTION_Source = "net.sourceforge.phpeclipse.compiler.source"; //$NON-NLS-1$
84 //      public static final String OPTION_TargetPlatform = "net.sourceforge.phpeclipse.compiler.codegen.targetPlatform"; //$NON-NLS-1$
85 //      public static final String OPTION_Compliance = "net.sourceforge.phpeclipse.compiler.compliance"; //$NON-NLS-1$
86         public static final String OPTION_Encoding = "net.sourceforge.phpeclipse.encoding"; //$NON-NLS-1$
87         public static final String OPTION_MaxProblemPerUnit = "net.sourceforge.phpeclipse.compiler.maxProblemPerUnit"; //$NON-NLS-1$
88         public static final String OPTION_TaskTags = "net.sourceforge.phpeclipse.compiler.taskTags"; //$NON-NLS-1$
89         public static final String OPTION_TaskPriorities = "net.sourceforge.phpeclipse.compiler.taskPriorities"; //$NON-NLS-1$
90         
91         // Backward compatibility
92         public static final String OPTION_ReportInvalidAnnotation = "net.sourceforge.phpeclipse.compiler.problem.invalidAnnotation"; //$NON-NLS-1$
93         public static final String OPTION_ReportMissingAnnotation = "net.sourceforge.phpeclipse.compiler.problem.missingAnnotation"; //$NON-NLS-1$
94         public static final String OPTION_ReportMissingJavadoc = "net.sourceforge.phpeclipse.compiler.problem.missingJavadoc"; //$NON-NLS-1$
95
96         /* should surface ??? */
97 //      public static final String OPTION_PrivateConstructorAccess = "net.sourceforge.phpeclipse.compiler.codegen.constructorAccessEmulation"; //$NON-NLS-1$
98
99         /**
100          * Possible values for configurable options
101          */
102         public static final String GENERATE = "generate";//$NON-NLS-1$
103         public static final String DO_NOT_GENERATE = "do not generate"; //$NON-NLS-1$ 
104         public static final String PRESERVE = "preserve"; //$NON-NLS-1$
105 //      public static final String OPTIMIZE_OUT = "optimize out"; //$NON-NLS-1$
106 //      public static final String VERSION_1_1 = "1.1"; //$NON-NLS-1$
107 //      public static final String VERSION_1_2 = "1.2"; //$NON-NLS-1$
108 //      public static final String VERSION_1_3 = "1.3"; //$NON-NLS-1$
109 //      public static final String VERSION_1_4 = "1.4"; //$NON-NLS-1$
110 //      public static final String VERSION_1_5 = "1.5"; //$NON-NLS-1$
111         public static final String ERROR = "error"; //$NON-NLS-1$
112         public static final String WARNING = "warning"; //$NON-NLS-1$
113         public static final String IGNORE = "ignore"; //$NON-NLS-1$
114         public static final String ENABLED = "enabled"; //$NON-NLS-1$
115         public static final String DISABLED = "disabled"; //$NON-NLS-1$
116         public static final String PUBLIC = "public";   //$NON-NLS-1$
117         public static final String PROTECTED = "protected";     //$NON-NLS-1$
118         public static final String DEFAULT = "default"; //$NON-NLS-1$
119         public static final String PRIVATE = "private"; //$NON-NLS-1$
120         
121         /**
122          * Bit mask for configurable problems (error/warning threshold)
123          */
124         // 0x100L unused
125         // 0x200L unused
126         // 0x400L unused
127         // 0x800L unused
128         public static final long MethodWithConstructorName = 0x1000L;
129         public static final long OverriddenPackageDefaultMethod = 0x2000L;
130         public static final long UsingDeprecatedAPI = 0x4000L;
131         public static final long MaskedCatchBlock = 0x8000L;
132         public static final long UnusedLocalVariable = 0x10000L;
133         public static final long UnusedArgument = 0x20000L;
134         public static final long NoImplicitStringConversion = 0x40000L;
135         public static final long AccessEmulation = 0x80000L;
136         public static final long NonExternalizedString = 0x100000L;
137         public static final long AssertUsedAsAnIdentifier = 0x200000L;
138         public static final long UnusedImport = 0x400000L;
139         public static final long NonStaticAccessToStatic = 0x800000L;
140         public static final long Task = 0x1000000L;
141         public static final long NoEffectAssignment = 0x2000000L;
142         public static final long IncompatibleNonInheritedInterfaceMethod = 0x4000000L;
143         public static final long UnusedPrivateMember = 0x8000000L;
144         public static final long LocalVariableHiding = 0x10000000L;
145         public static final long FieldHiding = 0x20000000L;
146         public static final long AccidentalBooleanAssign = 0x40000000L;
147         public static final long SuperfluousSemicolon = 0x80000000L;
148         public static final long IndirectStaticAccess = 0x100000000L;
149         public static final long UndocumentedEmptyBlock = 0x200000000L;
150         public static final long UnnecessaryTypeCheck = 0x400000000L;
151         public static final long InvalidJavadoc = 0x800000000L;
152         public static final long FinallyBlockNotCompleting = 0x1000000000L;
153         public static final long UnusedDeclaredThrownException = 0x2000000000L;
154         public static final long UnqualifiedFieldAccess = 0x4000000000L;
155         public static final long MissingJavadocTags = 0x8000000000L;
156         public static final long MissingJavadocComments  = 0x10000000000L;
157         
158         
159         public static final long PHPVarDeprecatedWarning  = 0x20000000000L;
160         public static final long PHPBadStyleKeywordWarning = 0x40000000000L;
161         public static final long PHPBadStyleUppercaseIdentifierWarning  = 0x80000000000L;
162         public static final long PHPIncludeNotExistWarning = 0x100000000000L;
163         public static final long UninitializedLocalVariableWarning = 0x200000000000L;
164         public static final long CodeCannotBeReachedWarning = 0x400000000000L;
165         // Default severity level for handlers
166         public long errorThreshold = 0;
167                 
168         public long warningThreshold = 
169                 MethodWithConstructorName 
170                 | UsingDeprecatedAPI 
171                 | MaskedCatchBlock 
172                 | OverriddenPackageDefaultMethod
173                 | UnusedImport
174                 | NonStaticAccessToStatic
175                 | NoEffectAssignment
176                 | IncompatibleNonInheritedInterfaceMethod
177                 | NoImplicitStringConversion
178                 | FinallyBlockNotCompleting
179                 | AssertUsedAsAnIdentifier
180                 | PHPVarDeprecatedWarning
181                 | PHPBadStyleKeywordWarning
182                 | PHPBadStyleUppercaseIdentifierWarning
183                 | PHPIncludeNotExistWarning
184                 | UninitializedLocalVariableWarning
185                 | CodeCannotBeReachedWarning;
186                 ;
187
188         // Debug attributes
189         public static final int Source = 1; // SourceFileAttribute
190         public static final int Lines = 2; // LineNumberAttribute
191         public static final int Vars = 4; // LocalVariableTableAttribute
192
193         // By default only lines and source attributes are generated.
194         public int produceDebugAttributes = Lines | Source;
195
196 //      public long complianceLevel = JDK1_4; // by default be compliant with 1.4
197 //      public long sourceLevel = JDK1_3; //1.3 source behavior by default
198 //      public long targetJDK = JDK1_2; // default generates for JVM1.2
199
200         // 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)
201         public boolean isPrivateConstructorAccessChangingVisibility = false; // by default, follows 1.2
202         
203         // source encoding format
204         public String defaultEncoding = null; // will use the platform default encoding
205         
206         // print what unit is being processed
207         public boolean verbose = Compiler.DEBUG;
208
209         // indicates if reference info is desired
210         public boolean produceReferenceInfo = false;
211
212         // indicates if unused/optimizable local variables need to be preserved (debugging purpose)
213         public boolean preserveAllLocalVariables = false;
214
215         // indicates whether literal expressions are inlined at parse-time or not
216         public boolean parseLiteralExpressionsAsConstants = true;
217
218         // max problems per compilation unit
219         public int maxProblemsPerUnit = 100; // no more than 100 problems per default
220         
221         // tags used to recognize tasks in comments
222         public char[][] taskTags = null;
223
224         // priorities of tasks in comments
225         public char[][] taskPriorites = null;
226
227         // deprecation report
228         public boolean reportDeprecationInsideDeprecatedCode = false;
229         public boolean reportDeprecationWhenOverridingDeprecatedMethod = false;
230         
231         // unused parameters report
232         public boolean reportUnusedParameterWhenImplementingAbstract = false;
233         public boolean reportUnusedParameterWhenOverridingConcrete = false;
234
235         // unused declaration of thrown exception
236         public boolean reportUnusedDeclaredThrownExceptionWhenOverriding = false;
237         
238         // constructor/setter parameter hiding
239         public boolean reportSpecialParameterHidingField = false;
240
241         // check javadoc comments
242         public int reportInvalidJavadocTagsVisibility = AccPrivate; 
243         public boolean reportInvalidJavadocTags = true; 
244
245         // check missing javadoc tags
246         public int reportMissingJavadocTagsVisibility = AccPrivate; 
247         public boolean reportMissingJavadocTagsOverriding = true;
248
249         // check missing javadoc comments
250         public int reportMissingJavadocCommentsVisibility = AccPublic; 
251         public boolean reportMissingJavadocCommentsOverriding = true; 
252 //       javadoc comment support
253         public boolean docCommentSupport = false;
254         
255         /** 
256          * Initializing the compiler options with defaults
257          */
258         public CompilerOptions(){
259                 // use default options
260         }
261
262         /** 
263          * Initializing the compiler options with external settings
264          * @param settings
265          */
266         public CompilerOptions(Map settings){
267
268                 if (settings == null) return;
269                 set(settings);          
270         }
271
272         public Map getMap() {
273                 Map optionsMap = new HashMap(30);
274                 optionsMap.put(OPTION_PHPVarDeprecatedWarning, getSeverityString(PHPIncludeNotExistWarning));
275                 optionsMap.put(OPTION_PHPVarDeprecatedWarning, getSeverityString(PHPVarDeprecatedWarning)); 
276                 optionsMap.put(OPTION_PHPBadStyleKeywordWarning, getSeverityString(PHPBadStyleKeywordWarning)); 
277                 optionsMap.put(OPTION_PHPBadStyleUppercaseIdentifierWarning, getSeverityString(PHPBadStyleUppercaseIdentifierWarning)); 
278                 optionsMap.put(OPTION_UninitializedLocalVariableWarning, getSeverityString(UninitializedLocalVariableWarning)); 
279                 optionsMap.put(OPTION_CodeCannotBeReachedWarning, getSeverityString(CodeCannotBeReachedWarning)); 
280                 
281                 optionsMap.put(OPTION_LocalVariableAttribute, (this.produceDebugAttributes & Vars) != 0 ? GENERATE : DO_NOT_GENERATE); 
282                 optionsMap.put(OPTION_LineNumberAttribute, (this.produceDebugAttributes & Lines) != 0 ? GENERATE : DO_NOT_GENERATE);
283                 optionsMap.put(OPTION_SourceFileAttribute, (this.produceDebugAttributes & Source) != 0 ? GENERATE : DO_NOT_GENERATE);
284 //              optionsMap.put(OPTION_PreserveUnusedLocal, this.preserveAllLocalVariables ? PRESERVE : OPTIMIZE_OUT);
285                 optionsMap.put(OPTION_DocCommentSupport, this.docCommentSupport ? ENABLED : DISABLED); 
286                 optionsMap.put(OPTION_ReportMethodWithConstructorName, getSeverityString(MethodWithConstructorName)); 
287                 optionsMap.put(OPTION_ReportOverridingPackageDefaultMethod, getSeverityString(OverriddenPackageDefaultMethod)); 
288                 optionsMap.put(OPTION_ReportDeprecation, getSeverityString(UsingDeprecatedAPI)); 
289                 optionsMap.put(OPTION_ReportDeprecationInDeprecatedCode, this.reportDeprecationInsideDeprecatedCode ? ENABLED : DISABLED); 
290                 optionsMap.put(OPTION_ReportDeprecationWhenOverridingDeprecatedMethod, this.reportDeprecationWhenOverridingDeprecatedMethod ? ENABLED : DISABLED); 
291                 optionsMap.put(OPTION_ReportHiddenCatchBlock, getSeverityString(MaskedCatchBlock)); 
292                 optionsMap.put(OPTION_ReportUnusedLocal, getSeverityString(UnusedLocalVariable)); 
293                 optionsMap.put(OPTION_ReportUnusedParameter, getSeverityString(UnusedArgument)); 
294                 optionsMap.put(OPTION_ReportUnusedImport, getSeverityString(UnusedImport)); 
295                 optionsMap.put(OPTION_ReportSyntheticAccessEmulation, getSeverityString(AccessEmulation)); 
296                 optionsMap.put(OPTION_ReportNoEffectAssignment, getSeverityString(NoEffectAssignment)); 
297                 optionsMap.put(OPTION_ReportNonExternalizedStringLiteral, getSeverityString(NonExternalizedString)); 
298                 optionsMap.put(OPTION_ReportNoImplicitStringConversion, getSeverityString(NoImplicitStringConversion)); 
299                 optionsMap.put(OPTION_ReportNonStaticAccessToStatic, getSeverityString(NonStaticAccessToStatic)); 
300                 optionsMap.put(OPTION_ReportIndirectStaticAccess, getSeverityString(IndirectStaticAccess)); 
301                 optionsMap.put(OPTION_ReportIncompatibleNonInheritedInterfaceMethod, getSeverityString(IncompatibleNonInheritedInterfaceMethod)); 
302                 optionsMap.put(OPTION_ReportUnusedPrivateMember, getSeverityString(UnusedPrivateMember)); 
303                 optionsMap.put(OPTION_ReportLocalVariableHiding, getSeverityString(LocalVariableHiding)); 
304                 optionsMap.put(OPTION_ReportFieldHiding, getSeverityString(FieldHiding)); 
305                 optionsMap.put(OPTION_ReportPossibleAccidentalBooleanAssignment, getSeverityString(AccidentalBooleanAssign)); 
306                 optionsMap.put(OPTION_ReportSuperfluousSemicolon, getSeverityString(SuperfluousSemicolon)); 
307                 optionsMap.put(OPTION_ReportAssertIdentifier, getSeverityString(AssertUsedAsAnIdentifier)); 
308                 optionsMap.put(OPTION_ReportUndocumentedEmptyBlock, getSeverityString(UndocumentedEmptyBlock)); 
309                 optionsMap.put(OPTION_ReportUnnecessaryTypeCheck, getSeverityString(UnnecessaryTypeCheck)); 
310                 optionsMap.put(OPTION_ReportInvalidJavadoc, getSeverityString(InvalidJavadoc));
311                 optionsMap.put(OPTION_ReportInvalidJavadocTagsVisibility, getVisibilityString(this.reportInvalidJavadocTagsVisibility));
312                 optionsMap.put(OPTION_ReportInvalidJavadocTags, this.reportInvalidJavadocTags? ENABLED : DISABLED);
313                 optionsMap.put(OPTION_ReportMissingJavadocTags, getSeverityString(MissingJavadocTags));
314                 optionsMap.put(OPTION_ReportMissingJavadocTagsVisibility, getVisibilityString(this.reportMissingJavadocTagsVisibility));
315                 optionsMap.put(OPTION_ReportMissingJavadocTagsOverriding, this.reportMissingJavadocTagsOverriding ? ENABLED : DISABLED);
316                 optionsMap.put(OPTION_ReportMissingJavadocComments, getSeverityString(MissingJavadocComments));
317                 optionsMap.put(OPTION_ReportMissingJavadocCommentsVisibility, getVisibilityString(this.reportMissingJavadocCommentsVisibility));
318                 optionsMap.put(OPTION_ReportMissingJavadocCommentsOverriding, this.reportMissingJavadocCommentsOverriding ? ENABLED : DISABLED);
319                 optionsMap.put(OPTION_ReportFinallyBlockNotCompletingNormally, getSeverityString(FinallyBlockNotCompleting));
320                 optionsMap.put(OPTION_ReportUnusedDeclaredThrownException, getSeverityString(UnusedDeclaredThrownException));
321                 optionsMap.put(OPTION_ReportUnusedDeclaredThrownExceptionWhenOverriding, this.reportUnusedDeclaredThrownExceptionWhenOverriding ? ENABLED : DISABLED); 
322                 optionsMap.put(OPTION_ReportUnqualifiedFieldAccess, getSeverityString(UnqualifiedFieldAccess));
323 //              optionsMap.put(OPTION_Compliance, versionFromJdkLevel(this.complianceLevel)); 
324 //              optionsMap.put(OPTION_Source, versionFromJdkLevel(this.sourceLevel)); 
325 //              optionsMap.put(OPTION_TargetPlatform, versionFromJdkLevel(this.targetJDK)); 
326                 if (this.defaultEncoding != null) {
327                         optionsMap.put(OPTION_Encoding, this.defaultEncoding); 
328                 }
329                 optionsMap.put(OPTION_TaskTags, this.taskTags == null ? "" : new String(CharOperation.concatWith(this.taskTags,','))); //$NON-NLS-1$
330                 optionsMap.put(OPTION_TaskPriorities, this.taskPriorites == null ? "" : new String(CharOperation.concatWith(this.taskPriorites,','))); //$NON-NLS-1$
331                 optionsMap.put(OPTION_ReportUnusedParameterWhenImplementingAbstract, this.reportUnusedParameterWhenImplementingAbstract ? ENABLED : DISABLED); 
332                 optionsMap.put(OPTION_ReportUnusedParameterWhenOverridingConcrete, this.reportUnusedParameterWhenOverridingConcrete ? ENABLED : DISABLED); 
333                 optionsMap.put(OPTION_ReportSpecialParameterHidingField, this.reportSpecialParameterHidingField ? ENABLED : DISABLED); 
334                 optionsMap.put(OPTION_MaxProblemPerUnit, String.valueOf(this.maxProblemsPerUnit));
335
336                 return optionsMap;              
337         }
338         
339         public int getSeverity(long irritant) {
340                 if((this.warningThreshold & irritant) != 0)
341                         return Warning;
342                 if((this.errorThreshold & irritant) != 0)
343                         return Error;
344                 return Ignore;
345         }
346
347         public String getSeverityString(long irritant) {
348                 if((this.warningThreshold & irritant) != 0)
349                         return WARNING;
350                 if((this.errorThreshold & irritant) != 0)
351                         return ERROR;
352                 return IGNORE;
353         }
354         
355         public String getVisibilityString(int level) {
356                 switch (level) {
357                         case AccPublic:
358                                 return PUBLIC;
359                         case AccProtected:
360                                 return PROTECTED;
361                         case AccPrivate:
362                                 return PRIVATE;
363                         default:
364                                 return DEFAULT;
365                 }
366         }
367         
368         public void set(Map optionsMap) {
369
370                 Object optionValue;
371                 if ((optionValue = optionsMap.get(OPTION_LocalVariableAttribute)) != null) {
372                         if (GENERATE.equals(optionValue)) {
373                                 this.produceDebugAttributes |= Vars;
374                         } else if (DO_NOT_GENERATE.equals(optionValue)) {
375                                 this.produceDebugAttributes &= ~Vars;
376                         }
377                 }
378                 if ((optionValue = optionsMap.get(OPTION_LineNumberAttribute)) != null) {
379                         if (GENERATE.equals(optionValue)) {
380                                 this.produceDebugAttributes |= Lines;
381                         } else if (DO_NOT_GENERATE.equals(optionValue)) {
382                                 this.produceDebugAttributes &= ~Lines;
383                         }
384                 }
385                 if ((optionValue = optionsMap.get(OPTION_SourceFileAttribute)) != null) {
386                         if (GENERATE.equals(optionValue)) {
387                                 this.produceDebugAttributes |= Source;
388                         } else if (DO_NOT_GENERATE.equals(optionValue)) {
389                                 this.produceDebugAttributes &= ~Source;
390                         }
391                 }
392 //              if ((optionValue = optionsMap.get(OPTION_PreserveUnusedLocal)) != null) {
393 //                      if (PRESERVE.equals(optionValue)) {
394 //                              this.preserveAllLocalVariables = true;
395 //                      } else if (OPTIMIZE_OUT.equals(optionValue)) {
396 //                              this.preserveAllLocalVariables = false;
397 //                      }
398 //              }
399                 if ((optionValue = optionsMap.get(OPTION_ReportDeprecationInDeprecatedCode)) != null) {
400                         if (ENABLED.equals(optionValue)) {
401                                 this.reportDeprecationInsideDeprecatedCode = true;
402                         } else if (DISABLED.equals(optionValue)) {
403                                 this.reportDeprecationInsideDeprecatedCode = false;
404                         }
405                 }
406                 if ((optionValue = optionsMap.get(OPTION_ReportDeprecationWhenOverridingDeprecatedMethod)) != null) {
407                         if (ENABLED.equals(optionValue)) {
408                                 this.reportDeprecationWhenOverridingDeprecatedMethod = true;
409                         } else if (DISABLED.equals(optionValue)) {
410                                 this.reportDeprecationWhenOverridingDeprecatedMethod = false;
411                         }
412                 }
413                 if ((optionValue = optionsMap.get(OPTION_ReportUnusedDeclaredThrownExceptionWhenOverriding)) != null) {
414                         if (ENABLED.equals(optionValue)) {
415                                 this.reportUnusedDeclaredThrownExceptionWhenOverriding = true;
416                         } else if (DISABLED.equals(optionValue)) {
417                                 this.reportUnusedDeclaredThrownExceptionWhenOverriding = false;
418                         }
419                 }
420 //              if ((optionValue = optionsMap.get(OPTION_Compliance)) != null) {
421 //                      long level = versionToJdkLevel(optionValue);
422 //                      if (level != 0) this.complianceLevel = level;
423 //              }
424 //              if ((optionValue = optionsMap.get(OPTION_Source)) != null) {
425 //                      long level = versionToJdkLevel(optionValue);
426 //                      if (level != 0) this.sourceLevel = level;
427 //              }
428 //              if ((optionValue = optionsMap.get(OPTION_TargetPlatform)) != null) {
429 //                      long level = versionToJdkLevel(optionValue);
430 //                      if (level != 0) this.targetJDK = level;
431 //              }
432                 if ((optionValue = optionsMap.get(OPTION_Encoding)) != null) {
433                         if (optionValue instanceof String) {
434                                 this.defaultEncoding = null;
435                                 String stringValue = (String) optionValue;
436                                 if (stringValue.length() > 0){
437                                         try { 
438                                                 new InputStreamReader(new ByteArrayInputStream(new byte[0]), stringValue);
439                                                 this.defaultEncoding = stringValue;
440                                         } catch(UnsupportedEncodingException e){
441                                                 // ignore unsupported encoding
442                                         }
443                                 }
444                         }
445                 }
446 //              if ((optionValue = optionsMap.get(OPTION_PrivateConstructorAccess)) != null) {
447 //                      long level = versionToJdkLevel(optionValue);
448 //                      if (level >= JDK1_3) this.isPrivateConstructorAccessChangingVisibility = true;
449 //              }
450                 if ((optionValue = optionsMap.get(OPTION_ReportUnusedParameterWhenImplementingAbstract)) != null) {
451                         if (ENABLED.equals(optionValue)) {
452                                 this.reportUnusedParameterWhenImplementingAbstract = true;
453                         } else if (DISABLED.equals(optionValue)) {
454                                 this.reportUnusedParameterWhenImplementingAbstract = false;
455                         }
456                 }
457                 if ((optionValue = optionsMap.get(OPTION_ReportUnusedParameterWhenOverridingConcrete)) != null) {
458                         if (ENABLED.equals(optionValue)) {
459                                 this.reportUnusedParameterWhenOverridingConcrete = true;
460                         } else if (DISABLED.equals(optionValue)) {
461                                 this.reportUnusedParameterWhenOverridingConcrete = false;
462                         }
463                 }
464                 if ((optionValue = optionsMap.get(OPTION_ReportSpecialParameterHidingField)) != null) {
465                         if (ENABLED.equals(optionValue)) {
466                                 this.reportSpecialParameterHidingField = true;
467                         } else if (DISABLED.equals(optionValue)) {
468                                 this.reportSpecialParameterHidingField = false;
469                         }
470                 }
471                 if ((optionValue = optionsMap.get(OPTION_MaxProblemPerUnit)) != null) {
472                         if (optionValue instanceof String) {
473                                 String stringValue = (String) optionValue;
474                                 try {
475                                         int val = Integer.parseInt(stringValue);
476                                         if (val >= 0) this.maxProblemsPerUnit = val;
477                                 } catch(NumberFormatException e){
478                                         // ignore ill-formatted limit
479                                 }                               
480                         }
481                 }
482                 if ((optionValue = optionsMap.get(OPTION_TaskTags)) != null) {
483                         if (optionValue instanceof String) {
484                                 String stringValue = (String) optionValue;
485                                 if (stringValue.length() == 0) {
486                                         this.taskTags = null;
487                                 } else {
488                                         this.taskTags = CharOperation.splitAndTrimOn(',', stringValue.toCharArray());
489                                 }
490                         }
491                 }
492                 if ((optionValue = optionsMap.get(OPTION_TaskPriorities)) != null) {
493                         if (optionValue instanceof String) {
494                                 String stringValue = (String) optionValue;
495                                 if (stringValue.length() == 0) {
496                                         this.taskPriorites = null;
497                                 } else {
498                                         this.taskPriorites = CharOperation.splitAndTrimOn(',', stringValue.toCharArray());
499                                 }
500                         }
501                 }
502                 if ((optionValue = optionsMap.get(OPTION_PHPVarDeprecatedWarning)) != null) updateSeverity(PHPVarDeprecatedWarning, optionValue);
503                 if ((optionValue = optionsMap.get(OPTION_PHPBadStyleKeywordWarning)) != null) updateSeverity(PHPBadStyleKeywordWarning, optionValue);
504                 if ((optionValue = optionsMap.get(OPTION_PHPBadStyleUppercaseIdentifierWarning)) != null) updateSeverity(PHPBadStyleUppercaseIdentifierWarning, optionValue);
505                 if ((optionValue = optionsMap.get(OPTION_PHPIncludeNotExistWarning)) != null) updateSeverity(PHPIncludeNotExistWarning, optionValue);
506                 if ((optionValue = optionsMap.get(OPTION_UninitializedLocalVariableWarning)) != null) updateSeverity(UninitializedLocalVariableWarning, optionValue);
507                 if ((optionValue = optionsMap.get(OPTION_CodeCannotBeReachedWarning)) != null) updateSeverity(CodeCannotBeReachedWarning, optionValue);
508                 
509                 if ((optionValue = optionsMap.get(OPTION_ReportMethodWithConstructorName)) != null) updateSeverity(MethodWithConstructorName, optionValue);
510                 if ((optionValue = optionsMap.get(OPTION_ReportOverridingPackageDefaultMethod)) != null) updateSeverity(OverriddenPackageDefaultMethod, optionValue);
511                 if ((optionValue = optionsMap.get(OPTION_ReportDeprecation)) != null) updateSeverity(UsingDeprecatedAPI, optionValue);
512                 if ((optionValue = optionsMap.get(OPTION_ReportHiddenCatchBlock)) != null) updateSeverity(MaskedCatchBlock, optionValue);
513                 if ((optionValue = optionsMap.get(OPTION_ReportUnusedLocal)) != null) updateSeverity(UnusedLocalVariable, optionValue);
514                 if ((optionValue = optionsMap.get(OPTION_ReportUnusedParameter)) != null) updateSeverity(UnusedArgument, optionValue);
515                 if ((optionValue = optionsMap.get(OPTION_ReportUnusedImport)) != null) updateSeverity(UnusedImport, optionValue);
516                 if ((optionValue = optionsMap.get(OPTION_ReportUnusedPrivateMember)) != null) updateSeverity(UnusedPrivateMember, optionValue);
517                 if ((optionValue = optionsMap.get(OPTION_ReportUnusedDeclaredThrownException)) != null) updateSeverity(UnusedDeclaredThrownException, optionValue);
518                 if ((optionValue = optionsMap.get(OPTION_ReportNoImplicitStringConversion)) != null) updateSeverity(NoImplicitStringConversion, optionValue);
519                 if ((optionValue = optionsMap.get(OPTION_ReportSyntheticAccessEmulation)) != null) updateSeverity(AccessEmulation, optionValue);
520                 if ((optionValue = optionsMap.get(OPTION_ReportLocalVariableHiding)) != null) updateSeverity(LocalVariableHiding, optionValue);
521                 if ((optionValue = optionsMap.get(OPTION_ReportFieldHiding)) != null) updateSeverity(FieldHiding, optionValue);
522                 if ((optionValue = optionsMap.get(OPTION_ReportPossibleAccidentalBooleanAssignment)) != null) updateSeverity(AccidentalBooleanAssign, optionValue);
523                 if ((optionValue = optionsMap.get(OPTION_ReportSuperfluousSemicolon)) != null) updateSeverity(SuperfluousSemicolon, optionValue);
524                 if ((optionValue = optionsMap.get(OPTION_ReportNonExternalizedStringLiteral)) != null) updateSeverity(NonExternalizedString, optionValue);
525                 if ((optionValue = optionsMap.get(OPTION_ReportAssertIdentifier)) != null) updateSeverity(AssertUsedAsAnIdentifier, optionValue);
526                 if ((optionValue = optionsMap.get(OPTION_ReportNonStaticAccessToStatic)) != null) updateSeverity(NonStaticAccessToStatic, optionValue);
527                 if ((optionValue = optionsMap.get(OPTION_ReportIndirectStaticAccess)) != null) updateSeverity(IndirectStaticAccess, optionValue);
528                 if ((optionValue = optionsMap.get(OPTION_ReportIncompatibleNonInheritedInterfaceMethod)) != null) updateSeverity(IncompatibleNonInheritedInterfaceMethod, optionValue);
529                 if ((optionValue = optionsMap.get(OPTION_ReportUndocumentedEmptyBlock)) != null) updateSeverity(UndocumentedEmptyBlock, optionValue);
530                 if ((optionValue = optionsMap.get(OPTION_ReportUnnecessaryTypeCheck)) != null) updateSeverity(UnnecessaryTypeCheck, optionValue);
531                 if ((optionValue = optionsMap.get(OPTION_ReportFinallyBlockNotCompletingNormally)) != null) updateSeverity(FinallyBlockNotCompleting, optionValue);
532                 if ((optionValue = optionsMap.get(OPTION_ReportUnqualifiedFieldAccess)) != null) updateSeverity(UnqualifiedFieldAccess, optionValue);
533                 if ((optionValue = optionsMap.get(OPTION_ReportNoEffectAssignment)) != null) updateSeverity(NoEffectAssignment, optionValue);
534
535                 // Javadoc options
536 //               Javadoc options
537                 if ((optionValue = optionsMap.get(OPTION_DocCommentSupport)) != null) {
538                         if (ENABLED.equals(optionValue)) {
539                                 this.docCommentSupport = true;
540                         } else if (DISABLED.equals(optionValue)) {
541                                 this.docCommentSupport = false;
542                         }
543                 }
544                 if ((optionValue = optionsMap.get(OPTION_ReportInvalidJavadoc)) != null) {
545                         updateSeverity(InvalidJavadoc, optionValue);
546                 }
547                 if ((optionValue = optionsMap.get(OPTION_ReportInvalidJavadocTagsVisibility)) != null) {
548                         if (PUBLIC.equals(optionValue)) {
549                                 this.reportInvalidJavadocTagsVisibility = AccPublic;
550                         } else if (PROTECTED.equals(optionValue)) {
551                                 this.reportInvalidJavadocTagsVisibility = AccProtected;
552 //                      } else if (DEFAULT.equals(optionValue)) {
553 //                              this.reportInvalidJavadocTagsVisibility = AccDefault;
554                         } else if (PRIVATE.equals(optionValue)) {
555                                 this.reportInvalidJavadocTagsVisibility = AccPrivate;
556                         }
557                 }
558                 if ((optionValue = optionsMap.get(OPTION_ReportInvalidJavadocTags)) != null) {
559                         if (ENABLED.equals(optionValue)) {
560                                 this.reportInvalidJavadocTags= true;
561                         } else if (DISABLED.equals(optionValue)) {
562                                 this.reportInvalidJavadocTags = false;
563                         }
564                 }
565                 if ((optionValue = optionsMap.get(OPTION_ReportMissingJavadocTags)) != null) {
566                         updateSeverity(MissingJavadocTags, optionValue);
567                 }
568                 if ((optionValue = optionsMap.get(OPTION_ReportMissingJavadocTagsVisibility)) != null) {
569                         if (PUBLIC.equals(optionValue)) {
570                                 this.reportMissingJavadocTagsVisibility = AccPublic;
571                         } else if (PROTECTED.equals(optionValue)) {
572                                 this.reportMissingJavadocTagsVisibility = AccProtected;
573 //                      } else if (DEFAULT.equals(optionValue)) {
574 //                              this.reportMissingJavadocTagsVisibility = AccDefault;
575                         } else if (PRIVATE.equals(optionValue)) {
576                                 this.reportMissingJavadocTagsVisibility = AccPrivate;
577                         }
578                 }
579                 if ((optionValue = optionsMap.get(OPTION_ReportMissingJavadocTagsOverriding)) != null) {
580                         if (ENABLED.equals(optionValue)) {
581                                 this.reportMissingJavadocTagsOverriding = true;
582                         } else if (DISABLED.equals(optionValue)) {
583                                 this.reportMissingJavadocTagsOverriding = false;
584                         }
585                 }
586                 if ((optionValue = optionsMap.get(OPTION_ReportMissingJavadocComments)) != null) {
587                         updateSeverity(MissingJavadocComments, optionValue);
588                 }
589                 if ((optionValue = optionsMap.get(OPTION_ReportMissingJavadocCommentsVisibility)) != null) {
590                         if (PUBLIC.equals(optionValue)) {
591                                 this.reportMissingJavadocCommentsVisibility = AccPublic;
592                         } else if (PROTECTED.equals(optionValue)) {
593                                 this.reportMissingJavadocCommentsVisibility = AccProtected;
594 //                      } else if (DEFAULT.equals(optionValue)) {
595 //                              this.reportMissingJavadocCommentsVisibility = AccDefault;
596                         } else if (PRIVATE.equals(optionValue)) {
597                                 this.reportMissingJavadocCommentsVisibility = AccPrivate;
598                         }
599                 }
600                 if ((optionValue = optionsMap.get(OPTION_ReportMissingJavadocCommentsOverriding)) != null) {
601                         if (ENABLED.equals(optionValue)) {
602                                 this.reportMissingJavadocCommentsOverriding = true;
603                         } else if (DISABLED.equals(optionValue)) {
604                                 this.reportMissingJavadocCommentsOverriding = false;
605                         }
606                 }
607         }
608
609         public void setVerboseMode(boolean flag) {
610                 this.verbose = flag;
611         }
612
613         public String toString() {
614         
615                 StringBuffer buf = new StringBuffer("CompilerOptions:"); //$NON-NLS-1$
616                 buf.append("\n\t- var is deprecated keyword: ").append(getSeverityString(PHPVarDeprecatedWarning)); //$NON-NLS-1$
617                 buf.append("\n\t- don't use keywords as identifiers: ").append(getSeverityString(PHPBadStyleKeywordWarning)); //$NON-NLS-1$
618                 buf.append("\n\t- non-variable idenifiers should contain only uppercase characters: ").append(getSeverityString(PHPBadStyleUppercaseIdentifierWarning)); //$NON-NLS-1$
619                 buf.append("\n\t- include filename doesn't exist in project: ").append(getSeverityString(PHPIncludeNotExistWarning)); //$NON-NLS-1$
620                 buf.append("\n\t- local variable not initialized: ").append(getSeverityString(UninitializedLocalVariableWarning)); //$NON-NLS-1$
621                 buf.append("\n\t- unreachable code: ").append(getSeverityString(CodeCannotBeReachedWarning)); //$NON-NLS-1$
622                 
623                 buf.append("\n\t- local variables debug attributes: ").append((this.produceDebugAttributes & Vars) != 0 ? "ON" : " OFF"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
624                 buf.append("\n\t- line number debug attributes: ").append((this.produceDebugAttributes & Lines) != 0 ? "ON" : " OFF"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
625                 buf.append("\n\t- source debug attributes: ").append((this.produceDebugAttributes & Source) != 0 ? "ON" : " OFF"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
626                 buf.append("\n\t- preserve all local variables: ").append(this.preserveAllLocalVariables ? "ON" : " OFF"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
627                 buf.append("\n\t- method with constructor name: ").append(getSeverityString(MethodWithConstructorName)); //$NON-NLS-1$
628                 buf.append("\n\t- overridden package default method: ").append(getSeverityString(OverriddenPackageDefaultMethod)); //$NON-NLS-1$
629                 buf.append("\n\t- deprecation: ").append(getSeverityString(UsingDeprecatedAPI)); //$NON-NLS-1$
630                 buf.append("\n\t- masked catch block: ").append(getSeverityString(MaskedCatchBlock)); //$NON-NLS-1$
631                 buf.append("\n\t- unused local variable: ").append(getSeverityString(UnusedLocalVariable)); //$NON-NLS-1$
632                 buf.append("\n\t- unused parameter: ").append(getSeverityString(UnusedArgument)); //$NON-NLS-1$
633                 buf.append("\n\t- unused import: ").append(getSeverityString(UnusedImport)); //$NON-NLS-1$
634                 buf.append("\n\t- synthetic access emulation: ").append(getSeverityString(AccessEmulation)); //$NON-NLS-1$
635                 buf.append("\n\t- assignment with no effect: ").append(getSeverityString(NoEffectAssignment)); //$NON-NLS-1$
636                 buf.append("\n\t- non externalized string: ").append(getSeverityString(NonExternalizedString)); //$NON-NLS-1$
637                 buf.append("\n\t- static access receiver: ").append(getSeverityString(NonStaticAccessToStatic)); //$NON-NLS-1$
638                 buf.append("\n\t- indirect static access: ").append(getSeverityString(IndirectStaticAccess)); //$NON-NLS-1$
639                 buf.append("\n\t- incompatible non inherited interface method: ").append(getSeverityString(IncompatibleNonInheritedInterfaceMethod)); //$NON-NLS-1$
640                 buf.append("\n\t- unused private member: ").append(getSeverityString(UnusedPrivateMember)); //$NON-NLS-1$
641                 buf.append("\n\t- local variable hiding another variable: ").append(getSeverityString(LocalVariableHiding)); //$NON-NLS-1$
642                 buf.append("\n\t- field hiding another variable: ").append(getSeverityString(FieldHiding)); //$NON-NLS-1$
643                 buf.append("\n\t- possible accidental boolean assignment: ").append(getSeverityString(AccidentalBooleanAssign)); //$NON-NLS-1$
644                 buf.append("\n\t- superfluous semicolon: ").append(getSeverityString(SuperfluousSemicolon)); //$NON-NLS-1$
645                 buf.append("\n\t- uncommented empty block: ").append(getSeverityString(UndocumentedEmptyBlock)); //$NON-NLS-1$
646                 buf.append("\n\t- unnecessary type check: ").append(getSeverityString(UnnecessaryTypeCheck)); //$NON-NLS-1$
647                 buf.append("\n\t- invalid javadoc: ").append(getSeverityString(InvalidJavadoc)); //$NON-NLS-1$
648                 buf.append("\n\t- report invalid javadoc tags: ").append(this.reportInvalidJavadocTags ? ENABLED : DISABLED); //$NON-NLS-1$
649                 buf.append("\n\t- visibility level to report invalid javadoc tags: ").append(getVisibilityString(this.reportInvalidJavadocTagsVisibility)); //$NON-NLS-1$
650                 buf.append("\n\t- missing javadoc tags: ").append(getSeverityString(MissingJavadocTags)); //$NON-NLS-1$
651                 buf.append("\n\t- visibility level to report missing javadoc tags: ").append(getVisibilityString(this.reportMissingJavadocTagsVisibility)); //$NON-NLS-1$
652                 buf.append("\n\t- report missing javadoc tags in overriding methods: ").append(this.reportMissingJavadocTagsOverriding ? ENABLED : DISABLED); //$NON-NLS-1$
653                 buf.append("\n\t- missing javadoc comments: ").append(getSeverityString(MissingJavadocComments)); //$NON-NLS-1$
654                 buf.append("\n\t- visibility level to report missing javadoc comments: ").append(getVisibilityString(this.reportMissingJavadocCommentsVisibility)); //$NON-NLS-1$
655                 buf.append("\n\t- report missing javadoc comments in overriding methods: ").append(this.reportMissingJavadocCommentsOverriding ? ENABLED : DISABLED); //$NON-NLS-1$
656                 buf.append("\n\t- finally block not completing normally: ").append(getSeverityString(FinallyBlockNotCompleting)); //$NON-NLS-1$
657                 buf.append("\n\t- unused declared thrown exception: ").append(getSeverityString(UnusedDeclaredThrownException)); //$NON-NLS-1$
658                 buf.append("\n\t- unused declared thrown exception when overriding ").append(this.reportUnusedDeclaredThrownExceptionWhenOverriding ? ENABLED : DISABLED); //$NON-NLS-1$
659 //              buf.append("\n\t- JDK compliance level: "+ versionFromJdkLevel(this.complianceLevel)); //$NON-NLS-1$
660 //              buf.append("\n\t- JDK source level: "+ versionFromJdkLevel(this.sourceLevel)); //$NON-NLS-1$
661 //              buf.append("\n\t- JDK target level: "+ versionFromJdkLevel(this.targetJDK)); //$NON-NLS-1$
662                 buf.append("\n\t- private constructor access: ").append(this.isPrivateConstructorAccessChangingVisibility ? "extra argument" : "make default access"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
663                 buf.append("\n\t- verbose : ").append(this.verbose ? "ON" : "OFF"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
664                 buf.append("\n\t- produce reference info : ").append(this.produceReferenceInfo ? "ON" : "OFF"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
665                 buf.append("\n\t- parse literal expressions as constants : ").append(this.parseLiteralExpressionsAsConstants ? "ON" : "OFF"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
666                 buf.append("\n\t- encoding : ").append(this.defaultEncoding == null ? "<default>" : this.defaultEncoding); //$NON-NLS-1$ //$NON-NLS-2$
667                 buf.append("\n\t- task tags: ").append(this.taskTags == null ? "" : new String(CharOperation.concatWith(this.taskTags,',')));  //$NON-NLS-1$ //$NON-NLS-2$
668                 buf.append("\n\t- task priorities : ").append(this.taskPriorites == null ? "" : new String(CharOperation.concatWith(this.taskPriorites,','))); //$NON-NLS-1$ //$NON-NLS-2$
669                 buf.append("\n\t- report deprecation inside deprecated code : ").append(this.reportDeprecationInsideDeprecatedCode ? "ENABLED" : "DISABLED"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
670                 buf.append("\n\t- report deprecation when overriding deprecated method : ").append(this.reportDeprecationWhenOverridingDeprecatedMethod ? "ENABLED" : "DISABLED"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
671                 buf.append("\n\t- report unused parameter when implementing abstract method : ").append(this.reportUnusedParameterWhenImplementingAbstract ? "ENABLED" : "DISABLED"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
672                 buf.append("\n\t- report unused parameter when overriding concrete method : ").append(this.reportUnusedParameterWhenOverridingConcrete ? "ENABLED" : "DISABLED"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
673                 buf.append("\n\t- report constructor/setter parameter hiding existing field : ").append(this.reportSpecialParameterHidingField ? "ENABLED" : "DISABLED"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
674                 return buf.toString();
675         }
676
677         void updateSeverity(long irritant, Object severityString) {
678                 if (ERROR.equals(severityString)) {
679                         this.errorThreshold |= irritant;
680                         this.warningThreshold &= ~irritant;
681                 } else if (WARNING.equals(severityString)) {
682                         this.errorThreshold &= ~irritant;
683                         this.warningThreshold |= irritant;
684                 } else if (IGNORE.equals(severityString)) {
685                         this.errorThreshold &= ~irritant;
686                         this.warningThreshold &= ~irritant;
687                 }
688         }                               
689 //      public static long versionToJdkLevel(Object versionID) {
690 //              if (VERSION_1_1.equals(versionID)) {
691 //                      return JDK1_1;
692 //              } else if (VERSION_1_2.equals(versionID)) {
693 //                      return JDK1_2;
694 //              } else if (VERSION_1_3.equals(versionID)) {
695 //                      return JDK1_3;
696 //              } else if (VERSION_1_4.equals(versionID)) {
697 //                      return JDK1_4;
698 //              } else if (VERSION_1_5.equals(versionID)) {
699 //                      return JDK1_5;
700 //              }
701 //              return 0; // unknown
702 //      }
703
704 //      public static String versionFromJdkLevel(long jdkLevel) {
705 //              if (jdkLevel == JDK1_1) {
706 //                      return VERSION_1_1;
707 //              } else if (jdkLevel == JDK1_2) {
708 //                      return VERSION_1_2;
709 //              } else if (jdkLevel == JDK1_3) {
710 //                      return VERSION_1_3;
711 //              } else if (jdkLevel == JDK1_4) {
712 //                      return VERSION_1_4;
713 //              } else if (jdkLevel == JDK1_5) {
714 //                      return VERSION_1_5;
715 //              }
716 //              return ""; // unknown version //$NON-NLS-1$
717 //      }
718 }