reverted test
[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.internal.compiler.Compiler;
21 import net.sourceforge.phpdt.internal.compiler.env.IConstants;
22 import net.sourceforge.phpdt.internal.compiler.lookup.ProblemReasons;
23 import net.sourceforge.phpdt.internal.compiler.problem.ProblemSeverities;
24
25 public class CompilerOptions implements ProblemReasons, ProblemSeverities,
26                 IConstants {
27
28         /**
29          * Option IDs
30          */
31         public static final String OPTION_PHPVarDeprecatedWarning = "net.sourceforge.phpeclipse.compiler.problem.phpVarDeprecatedWarning"; //$NON-NLS-1$
32
33         public static final String OPTION_PHPBadStyleKeywordWarning = "net.sourceforge.phpeclipse.compiler.problem.phpBadStyleKeywordWarning"; //$NON-NLS-1$
34
35         public static final String OPTION_PHPBadStyleUppercaseIdentifierWarning = "net.sourceforge.phpeclipse.compiler.problem.phpBadStyleUppercaseIdentifierWarning"; //$NON-NLS-1$
36
37         public static final String OPTION_PHPIncludeNotExistWarning = "net.sourceforge.phpeclipse.compiler.problem.phpIncludeNotExistWarning"; //$NON-NLS-1$
38
39         public static final String OPTION_UninitializedLocalVariableWarning = "net.sourceforge.phpeclipse.compiler.problem.uninitializedLocalVariableWarning"; //$NON-NLS-1$
40
41         public static final String OPTION_CodeCannotBeReachedWarning = "net.sourceforge.phpeclipse.compiler.problem.codeCannotBeReachedWarning"; //$NON-NLS-1$
42
43         public static final String OPTION_LocalVariableAttribute = "net.sourceforge.phpeclipse.compiler.debug.localVariable"; //$NON-NLS-1$
44
45         public static final String OPTION_LineNumberAttribute = "net.sourceforge.phpeclipse.compiler.debug.lineNumber"; //$NON-NLS-1$
46
47         public static final String OPTION_SourceFileAttribute = "net.sourceforge.phpeclipse.compiler.debug.sourceFile"; //$NON-NLS-1$
48         // public static final String OPTION_PreserveUnusedLocal =
49         // "net.sourceforge.phpeclipse.compiler.codegen.unusedLocal"; //$NON-NLS-1$
50
51         public static final String OPTION_DocCommentSupport = "net.sourceforge.phpeclipse.compiler.doc.comment.support"; //$NON-NLS-1$
52
53         public static final String OPTION_ReportMethodWithConstructorName = "net.sourceforge.phpeclipse.compiler.problem.methodWithConstructorName"; //$NON-NLS-1$
54
55         public static final String OPTION_ReportOverridingPackageDefaultMethod = "net.sourceforge.phpeclipse.compiler.problem.overridingPackageDefaultMethod"; //$NON-NLS-1$
56
57         public static final String OPTION_ReportDeprecation = "net.sourceforge.phpeclipse.compiler.problem.deprecation"; //$NON-NLS-1$
58
59         public static final String OPTION_ReportDeprecationInDeprecatedCode = "net.sourceforge.phpeclipse.compiler.problem.deprecationInDeprecatedCode"; //$NON-NLS-1$
60
61         public static final String OPTION_ReportDeprecationWhenOverridingDeprecatedMethod = "net.sourceforge.phpeclipse.compiler.problem.deprecationWhenOverridingDeprecatedMethod"; //$NON-NLS-1$
62
63         public static final String OPTION_ReportHiddenCatchBlock = "net.sourceforge.phpeclipse.compiler.problem.hiddenCatchBlock"; //$NON-NLS-1$
64
65         public static final String OPTION_ReportUnusedLocal = "net.sourceforge.phpeclipse.compiler.problem.unusedLocal"; //$NON-NLS-1$
66
67         public static final String OPTION_ReportUnusedParameter = "net.sourceforge.phpeclipse.compiler.problem.unusedParameter"; //$NON-NLS-1$
68
69         public static final String OPTION_ReportUnusedParameterWhenImplementingAbstract = "net.sourceforge.phpeclipse.compiler.problem.unusedParameterWhenImplementingAbstract"; //$NON-NLS-1$
70
71         public static final String OPTION_ReportUnusedParameterWhenOverridingConcrete = "net.sourceforge.phpeclipse.compiler.problem.unusedParameterWhenOverridingConcrete"; //$NON-NLS-1$
72
73         public static final String OPTION_ReportUnusedImport = "net.sourceforge.phpeclipse.compiler.problem.unusedImport"; //$NON-NLS-1$
74
75         public static final String OPTION_ReportSyntheticAccessEmulation = "net.sourceforge.phpeclipse.compiler.problem.syntheticAccessEmulation"; //$NON-NLS-1$
76
77         public static final String OPTION_ReportNoEffectAssignment = "net.sourceforge.phpeclipse.compiler.problem.noEffectAssignment"; //$NON-NLS-1$
78
79         public static final String OPTION_ReportLocalVariableHiding = "net.sourceforge.phpeclipse.compiler.problem.localVariableHiding"; //$NON-NLS-1$
80
81         public static final String OPTION_ReportSpecialParameterHidingField = "net.sourceforge.phpeclipse.compiler.problem.specialParameterHidingField"; //$NON-NLS-1$
82
83         public static final String OPTION_ReportFieldHiding = "net.sourceforge.phpeclipse.compiler.problem.fieldHiding"; //$NON-NLS-1$
84
85         public static final String OPTION_ReportPossibleAccidentalBooleanAssignment = "net.sourceforge.phpeclipse.compiler.problem.possibleAccidentalBooleanAssignment"; //$NON-NLS-1$
86
87         public static final String OPTION_ReportNonExternalizedStringLiteral = "net.sourceforge.phpeclipse.compiler.problem.nonExternalizedStringLiteral"; //$NON-NLS-1$
88
89         public static final String OPTION_ReportIncompatibleNonInheritedInterfaceMethod = "net.sourceforge.phpeclipse.compiler.problem.incompatibleNonInheritedInterfaceMethod"; //$NON-NLS-1$
90
91         public static final String OPTION_ReportUnusedPrivateMember = "net.sourceforge.phpeclipse.compiler.problem.unusedPrivateMember"; //$NON-NLS-1$
92
93         public static final String OPTION_ReportNoImplicitStringConversion = "net.sourceforge.phpeclipse.compiler.problem.noImplicitStringConversion"; //$NON-NLS-1$
94
95         public static final String OPTION_ReportAssertIdentifier = "net.sourceforge.phpeclipse.compiler.problem.assertIdentifier"; //$NON-NLS-1$
96
97         public static final String OPTION_ReportNonStaticAccessToStatic = "net.sourceforge.phpeclipse.compiler.problem.staticAccessReceiver"; //$NON-NLS-1$
98
99         public static final String OPTION_ReportIndirectStaticAccess = "net.sourceforge.phpeclipse.compiler.problem.indirectStaticAccess"; //$NON-NLS-1$
100
101         public static final String OPTION_ReportSuperfluousSemicolon = "net.sourceforge.phpeclipse.compiler.problem.superfluousSemicolon"; //$NON-NLS-1$
102
103         public static final String OPTION_ReportUnnecessaryTypeCheck = "net.sourceforge.phpeclipse.compiler.problem.unnecessaryTypeCheck"; //$NON-NLS-1$
104
105         public static final String OPTION_ReportUndocumentedEmptyBlock = "net.sourceforge.phpeclipse.compiler.problem.undocumentedEmptyBlock"; //$NON-NLS-1$
106
107         public static final String OPTION_ReportInvalidJavadoc = "net.sourceforge.phpeclipse.compiler.problem.invalidJavadoc"; //$NON-NLS-1$
108
109         public static final String OPTION_ReportInvalidJavadocTags = "net.sourceforge.phpeclipse.compiler.problem.invalidJavadocTags"; //$NON-NLS-1$
110
111         public static final String OPTION_ReportInvalidJavadocTagsVisibility = "net.sourceforge.phpeclipse.compiler.problem.invalidJavadocTagsVisibility"; //$NON-NLS-1$
112
113         public static final String OPTION_ReportMissingJavadocTags = "net.sourceforge.phpeclipse.compiler.problem.missingJavadocTags"; //$NON-NLS-1$
114
115         public static final String OPTION_ReportMissingJavadocTagsVisibility = "net.sourceforge.phpeclipse.compiler.problem.missingJavadocTagsVisibility"; //$NON-NLS-1$
116
117         public static final String OPTION_ReportMissingJavadocTagsOverriding = "net.sourceforge.phpeclipse.compiler.problem.missingJavadocTagsOverriding"; //$NON-NLS-1$
118
119         public static final String OPTION_ReportMissingJavadocComments = "net.sourceforge.phpeclipse.compiler.problem.missingJavadocComments"; //$NON-NLS-1$
120
121         public static final String OPTION_ReportMissingJavadocCommentsVisibility = "net.sourceforge.phpeclipse.compiler.problem.missingJavadocCommentsVisibility"; //$NON-NLS-1$
122
123         public static final String OPTION_ReportMissingJavadocCommentsOverriding = "net.sourceforge.phpeclipse.compiler.problem.missingJavadocCommentsOverriding"; //$NON-NLS-1$
124
125         public static final String OPTION_ReportFinallyBlockNotCompletingNormally = "net.sourceforge.phpeclipse.compiler.problem.finallyBlockNotCompletingNormally"; //$NON-NLS-1$
126
127         public static final String OPTION_ReportUnusedDeclaredThrownException = "net.sourceforge.phpeclipse.compiler.problem.unusedDeclaredThrownException"; //$NON-NLS-1$
128
129         public static final String OPTION_ReportUnusedDeclaredThrownExceptionWhenOverriding = "net.sourceforge.phpeclipse.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding"; //$NON-NLS-1$
130
131         public static final String OPTION_ReportUnqualifiedFieldAccess = "net.sourceforge.phpeclipse.compiler.problem.unqualifiedFieldAccess"; //$NON-NLS-1$
132         // public static final String OPTION_Source =
133         // "net.sourceforge.phpeclipse.compiler.source"; //$NON-NLS-1$
134         // public static final String OPTION_TargetPlatform =
135         // "net.sourceforge.phpeclipse.compiler.codegen.targetPlatform";
136         // //$NON-NLS-1$
137         // public static final String OPTION_Compliance =
138         // "net.sourceforge.phpeclipse.compiler.compliance"; //$NON-NLS-1$
139
140         public static final String OPTION_Encoding = "net.sourceforge.phpeclipse.encoding"; //$NON-NLS-1$
141
142         public static final String OPTION_MaxProblemPerUnit = "net.sourceforge.phpeclipse.compiler.maxProblemPerUnit"; //$NON-NLS-1$
143
144         public static final String OPTION_TaskTags = "net.sourceforge.phpeclipse.compiler.taskTags"; //$NON-NLS-1$
145
146         public static final String OPTION_TaskPriorities = "net.sourceforge.phpeclipse.compiler.taskPriorities"; //$NON-NLS-1$
147
148         // Backward compatibility
149         public static final String OPTION_ReportInvalidAnnotation = "net.sourceforge.phpeclipse.compiler.problem.invalidAnnotation"; //$NON-NLS-1$
150
151         public static final String OPTION_ReportMissingAnnotation = "net.sourceforge.phpeclipse.compiler.problem.missingAnnotation"; //$NON-NLS-1$
152
153         public static final String OPTION_ReportMissingJavadoc = "net.sourceforge.phpeclipse.compiler.problem.missingJavadoc"; //$NON-NLS-1$
154
155         /* should surface ??? */
156         // public static final String OPTION_PrivateConstructorAccess =
157         // "net.sourceforge.phpeclipse.compiler.codegen.constructorAccessEmulation";
158         // //$NON-NLS-1$
159         /**
160          * Possible values for configurable options
161          */
162         public static final String GENERATE = "generate";//$NON-NLS-1$
163
164         public static final String DO_NOT_GENERATE = "do not generate"; //$NON-NLS-1$ 
165
166         public static final String PRESERVE = "preserve"; //$NON-NLS-1$
167         // public static final String OPTIMIZE_OUT = "optimize out"; //$NON-NLS-1$
168         // public static final String VERSION_1_1 = "1.1"; //$NON-NLS-1$
169         // public static final String VERSION_1_2 = "1.2"; //$NON-NLS-1$
170         // public static final String VERSION_1_3 = "1.3"; //$NON-NLS-1$
171         // public static final String VERSION_1_4 = "1.4"; //$NON-NLS-1$
172         // public static final String VERSION_1_5 = "1.5"; //$NON-NLS-1$
173
174         public static final String ERROR = "error"; //$NON-NLS-1$
175
176         public static final String WARNING = "warning"; //$NON-NLS-1$
177
178         public static final String IGNORE = "ignore"; //$NON-NLS-1$
179
180         public static final String ENABLED = "enabled"; //$NON-NLS-1$
181
182         public static final String DISABLED = "disabled"; //$NON-NLS-1$
183
184         public static final String PUBLIC = "public"; //$NON-NLS-1$
185
186         public static final String PROTECTED = "protected"; //$NON-NLS-1$
187
188         public static final String DEFAULT = "default"; //$NON-NLS-1$
189
190         public static final String PRIVATE = "private"; //$NON-NLS-1$
191
192         /**
193          * Bit mask for configurable problems (error/warning threshold)
194          */
195         // 0x100L unused
196         // 0x200L unused
197         // 0x400L unused
198         // 0x800L unused
199         public static final long MethodWithConstructorName = 0x1000L;
200
201         public static final long OverriddenPackageDefaultMethod = 0x2000L;
202
203         public static final long UsingDeprecatedAPI = 0x4000L;
204
205         public static final long MaskedCatchBlock = 0x8000L;
206
207         public static final long UnusedLocalVariable = 0x10000L;
208
209         public static final long UnusedArgument = 0x20000L;
210
211         public static final long NoImplicitStringConversion = 0x40000L;
212
213         public static final long AccessEmulation = 0x80000L;
214
215         public static final long NonExternalizedString = 0x100000L;
216
217         public static final long AssertUsedAsAnIdentifier = 0x200000L;
218
219         public static final long UnusedImport = 0x400000L;
220
221         public static final long NonStaticAccessToStatic = 0x800000L;
222
223         public static final long Task = 0x1000000L;
224
225         public static final long NoEffectAssignment = 0x2000000L;
226
227         public static final long IncompatibleNonInheritedInterfaceMethod = 0x4000000L;
228
229         public static final long UnusedPrivateMember = 0x8000000L;
230
231         public static final long LocalVariableHiding = 0x10000000L;
232
233         public static final long FieldHiding = 0x20000000L;
234
235         public static final long AccidentalBooleanAssign = 0x40000000L;
236
237         public static final long SuperfluousSemicolon = 0x80000000L;
238
239         public static final long IndirectStaticAccess = 0x100000000L;
240
241         public static final long UndocumentedEmptyBlock = 0x200000000L;
242
243         public static final long UnnecessaryTypeCheck = 0x400000000L;
244
245         public static final long InvalidJavadoc = 0x800000000L;
246
247         public static final long FinallyBlockNotCompleting = 0x1000000000L;
248
249         public static final long UnusedDeclaredThrownException = 0x2000000000L;
250
251         public static final long UnqualifiedFieldAccess = 0x4000000000L;
252
253         public static final long MissingJavadocTags = 0x8000000000L;
254
255         public static final long MissingJavadocComments = 0x10000000000L;
256
257         public static final long PHPVarDeprecatedWarning = 0x20000000000L;
258
259         public static final long PHPBadStyleKeywordWarning = 0x40000000000L;
260
261         public static final long PHPBadStyleUppercaseIdentifierWarning = 0x80000000000L;
262
263         public static final long PHPIncludeNotExistWarning = 0x100000000000L;
264
265         public static final long UninitializedLocalVariableWarning = 0x200000000000L;
266
267         public static final long CodeCannotBeReachedWarning = 0x400000000000L;
268
269         // Default severity level for handlers
270         public long errorThreshold = 0;
271
272         public long warningThreshold = MethodWithConstructorName
273                         | UsingDeprecatedAPI | MaskedCatchBlock
274                         | OverriddenPackageDefaultMethod | UnusedImport
275                         | NonStaticAccessToStatic | NoEffectAssignment
276                         | IncompatibleNonInheritedInterfaceMethod
277                         | NoImplicitStringConversion | FinallyBlockNotCompleting
278                         | AssertUsedAsAnIdentifier | PHPVarDeprecatedWarning
279                         | PHPBadStyleKeywordWarning | PHPBadStyleUppercaseIdentifierWarning
280                         | PHPIncludeNotExistWarning | UninitializedLocalVariableWarning
281                         | CodeCannotBeReachedWarning;;
282
283         // Debug attributes
284         public static final int Source = 1; // SourceFileAttribute
285
286         public static final int Lines = 2; // LineNumberAttribute
287
288         public static final int Vars = 4; // LocalVariableTableAttribute
289
290         // By default only lines and source attributes are generated.
291         public int produceDebugAttributes = Lines | Source;
292
293         // public long complianceLevel = JDK1_4; // by default be compliant with 1.4
294         // public long sourceLevel = JDK1_3; //1.3 source behavior by default
295         // public long targetJDK = JDK1_2; // default generates for JVM1.2
296
297         // toggle private access emulation for 1.2 (constr. accessor has extra arg
298         // on constructor) or 1.3 (make private constructor default access when
299         // access needed)
300         public boolean isPrivateConstructorAccessChangingVisibility = false; // by
301                                                                                                                                                         // default,
302                                                                                                                                                         // follows
303                                                                                                                                                         // 1.2
304
305         // source encoding format
306         public String defaultEncoding = null; // will use the platform default
307                                                                                         // encoding
308
309         // print what unit is being processed
310         public boolean verbose = Compiler.DEBUG;
311
312         // indicates if reference info is desired
313         public boolean produceReferenceInfo = false;
314
315         // indicates if unused/optimizable local variables need to be preserved
316         // (debugging purpose)
317         public boolean preserveAllLocalVariables = false;
318
319         // indicates whether literal expressions are inlined at parse-time or not
320         public boolean parseLiteralExpressionsAsConstants = true;
321
322         // max problems per compilation unit
323         public int maxProblemsPerUnit = 100; // no more than 100 problems per
324                                                                                         // default
325
326         // tags used to recognize tasks in comments
327         public char[][] taskTags = null;
328
329         // priorities of tasks in comments
330         public char[][] taskPriorites = null;
331
332         // deprecation report
333         public boolean reportDeprecationInsideDeprecatedCode = false;
334
335         public boolean reportDeprecationWhenOverridingDeprecatedMethod = false;
336
337         // unused parameters report
338         public boolean reportUnusedParameterWhenImplementingAbstract = false;
339
340         public boolean reportUnusedParameterWhenOverridingConcrete = false;
341
342         // unused declaration of thrown exception
343         public boolean reportUnusedDeclaredThrownExceptionWhenOverriding = false;
344
345         // constructor/setter parameter hiding
346         public boolean reportSpecialParameterHidingField = false;
347
348         // check javadoc comments
349         public int reportInvalidJavadocTagsVisibility = AccPrivate;
350
351         public boolean reportInvalidJavadocTags = true;
352
353         // check missing javadoc tags
354         public int reportMissingJavadocTagsVisibility = AccPrivate;
355
356         public boolean reportMissingJavadocTagsOverriding = true;
357
358         // check missing javadoc comments
359         public int reportMissingJavadocCommentsVisibility = AccPublic;
360
361         public boolean reportMissingJavadocCommentsOverriding = true;
362
363         // javadoc comment support
364         public boolean docCommentSupport = false;
365
366         /**
367          * Initializing the compiler options with defaults
368          */
369         public CompilerOptions() {
370                 // use default options
371         }
372
373         /**
374          * Initializing the compiler options with external settings
375          * 
376          * @param settings
377          */
378         public CompilerOptions(Map settings) {
379
380                 if (settings == null)
381                         return;
382                 set(settings);
383         }
384
385         public Map getMap() {
386                 Map optionsMap = new HashMap(30);
387                 optionsMap.put(OPTION_PHPIncludeNotExistWarning,
388                                 getSeverityString(PHPIncludeNotExistWarning));
389                 optionsMap.put(OPTION_PHPVarDeprecatedWarning,
390                                 getSeverityString(PHPVarDeprecatedWarning));
391                 optionsMap.put(OPTION_PHPBadStyleKeywordWarning,
392                                 getSeverityString(PHPBadStyleKeywordWarning));
393                 optionsMap.put(OPTION_PHPBadStyleUppercaseIdentifierWarning,
394                                 getSeverityString(PHPBadStyleUppercaseIdentifierWarning));
395                 optionsMap.put(OPTION_UninitializedLocalVariableWarning,
396                                 getSeverityString(UninitializedLocalVariableWarning));
397                 optionsMap.put(OPTION_CodeCannotBeReachedWarning,
398                                 getSeverityString(CodeCannotBeReachedWarning));
399
400                 optionsMap.put(OPTION_LocalVariableAttribute,
401                                 (this.produceDebugAttributes & Vars) != 0 ? GENERATE
402                                                 : DO_NOT_GENERATE);
403                 optionsMap.put(OPTION_LineNumberAttribute,
404                                 (this.produceDebugAttributes & Lines) != 0 ? GENERATE
405                                                 : DO_NOT_GENERATE);
406                 optionsMap.put(OPTION_SourceFileAttribute,
407                                 (this.produceDebugAttributes & Source) != 0 ? GENERATE
408                                                 : DO_NOT_GENERATE);
409                 // optionsMap.put(OPTION_PreserveUnusedLocal,
410                 // this.preserveAllLocalVariables ? PRESERVE : OPTIMIZE_OUT);
411                 optionsMap.put(OPTION_DocCommentSupport,
412                                 this.docCommentSupport ? ENABLED : DISABLED);
413                 optionsMap.put(OPTION_ReportMethodWithConstructorName,
414                                 getSeverityString(MethodWithConstructorName));
415                 optionsMap.put(OPTION_ReportOverridingPackageDefaultMethod,
416                                 getSeverityString(OverriddenPackageDefaultMethod));
417                 optionsMap.put(OPTION_ReportDeprecation,
418                                 getSeverityString(UsingDeprecatedAPI));
419                 optionsMap
420                                 .put(OPTION_ReportDeprecationInDeprecatedCode,
421                                                 this.reportDeprecationInsideDeprecatedCode ? ENABLED
422                                                                 : DISABLED);
423                 optionsMap.put(OPTION_ReportDeprecationWhenOverridingDeprecatedMethod,
424                                 this.reportDeprecationWhenOverridingDeprecatedMethod ? ENABLED
425                                                 : DISABLED);
426                 optionsMap.put(OPTION_ReportHiddenCatchBlock,
427                                 getSeverityString(MaskedCatchBlock));
428                 optionsMap.put(OPTION_ReportUnusedLocal,
429                                 getSeverityString(UnusedLocalVariable));
430                 optionsMap.put(OPTION_ReportUnusedParameter,
431                                 getSeverityString(UnusedArgument));
432                 optionsMap.put(OPTION_ReportUnusedImport,
433                                 getSeverityString(UnusedImport));
434                 optionsMap.put(OPTION_ReportSyntheticAccessEmulation,
435                                 getSeverityString(AccessEmulation));
436                 optionsMap.put(OPTION_ReportNoEffectAssignment,
437                                 getSeverityString(NoEffectAssignment));
438                 optionsMap.put(OPTION_ReportNonExternalizedStringLiteral,
439                                 getSeverityString(NonExternalizedString));
440                 optionsMap.put(OPTION_ReportNoImplicitStringConversion,
441                                 getSeverityString(NoImplicitStringConversion));
442                 optionsMap.put(OPTION_ReportNonStaticAccessToStatic,
443                                 getSeverityString(NonStaticAccessToStatic));
444                 optionsMap.put(OPTION_ReportIndirectStaticAccess,
445                                 getSeverityString(IndirectStaticAccess));
446                 optionsMap.put(OPTION_ReportIncompatibleNonInheritedInterfaceMethod,
447                                 getSeverityString(IncompatibleNonInheritedInterfaceMethod));
448                 optionsMap.put(OPTION_ReportUnusedPrivateMember,
449                                 getSeverityString(UnusedPrivateMember));
450                 optionsMap.put(OPTION_ReportLocalVariableHiding,
451                                 getSeverityString(LocalVariableHiding));
452                 optionsMap
453                                 .put(OPTION_ReportFieldHiding, getSeverityString(FieldHiding));
454                 optionsMap.put(OPTION_ReportPossibleAccidentalBooleanAssignment,
455                                 getSeverityString(AccidentalBooleanAssign));
456                 optionsMap.put(OPTION_ReportSuperfluousSemicolon,
457                                 getSeverityString(SuperfluousSemicolon));
458                 optionsMap.put(OPTION_ReportAssertIdentifier,
459                                 getSeverityString(AssertUsedAsAnIdentifier));
460                 optionsMap.put(OPTION_ReportUndocumentedEmptyBlock,
461                                 getSeverityString(UndocumentedEmptyBlock));
462                 optionsMap.put(OPTION_ReportUnnecessaryTypeCheck,
463                                 getSeverityString(UnnecessaryTypeCheck));
464                 optionsMap.put(OPTION_ReportInvalidJavadoc,
465                                 getSeverityString(InvalidJavadoc));
466                 optionsMap.put(OPTION_ReportInvalidJavadocTagsVisibility,
467                                 getVisibilityString(this.reportInvalidJavadocTagsVisibility));
468                 optionsMap.put(OPTION_ReportInvalidJavadocTags,
469                                 this.reportInvalidJavadocTags ? ENABLED : DISABLED);
470                 optionsMap.put(OPTION_ReportMissingJavadocTags,
471                                 getSeverityString(MissingJavadocTags));
472                 optionsMap.put(OPTION_ReportMissingJavadocTagsVisibility,
473                                 getVisibilityString(this.reportMissingJavadocTagsVisibility));
474                 optionsMap.put(OPTION_ReportMissingJavadocTagsOverriding,
475                                 this.reportMissingJavadocTagsOverriding ? ENABLED : DISABLED);
476                 optionsMap.put(OPTION_ReportMissingJavadocComments,
477                                 getSeverityString(MissingJavadocComments));
478                 optionsMap
479                                 .put(
480                                                 OPTION_ReportMissingJavadocCommentsVisibility,
481                                                 getVisibilityString(this.reportMissingJavadocCommentsVisibility));
482                 optionsMap.put(OPTION_ReportMissingJavadocCommentsOverriding,
483                                 this.reportMissingJavadocCommentsOverriding ? ENABLED
484                                                 : DISABLED);
485                 optionsMap.put(OPTION_ReportFinallyBlockNotCompletingNormally,
486                                 getSeverityString(FinallyBlockNotCompleting));
487                 optionsMap.put(OPTION_ReportUnusedDeclaredThrownException,
488                                 getSeverityString(UnusedDeclaredThrownException));
489                 optionsMap
490                                 .put(
491                                                 OPTION_ReportUnusedDeclaredThrownExceptionWhenOverriding,
492                                                 this.reportUnusedDeclaredThrownExceptionWhenOverriding ? ENABLED
493                                                                 : DISABLED);
494                 optionsMap.put(OPTION_ReportUnqualifiedFieldAccess,
495                                 getSeverityString(UnqualifiedFieldAccess));
496                 // optionsMap.put(OPTION_Compliance,
497                 // versionFromJdkLevel(this.complianceLevel));
498                 // optionsMap.put(OPTION_Source, versionFromJdkLevel(this.sourceLevel));
499                 // optionsMap.put(OPTION_TargetPlatform,
500                 // versionFromJdkLevel(this.targetJDK));
501                 if (this.defaultEncoding != null) {
502                         optionsMap.put(OPTION_Encoding, this.defaultEncoding);
503                 }
504                 optionsMap
505                                 .put(
506                                                 OPTION_TaskTags,
507                                                 this.taskTags == null ? "" : new String(CharOperation.concatWith(this.taskTags, ','))); //$NON-NLS-1$
508                 optionsMap
509                                 .put(
510                                                 OPTION_TaskPriorities,
511                                                 this.taskPriorites == null ? "" : new String(CharOperation.concatWith(this.taskPriorites, ','))); //$NON-NLS-1$
512                 optionsMap.put(OPTION_ReportUnusedParameterWhenImplementingAbstract,
513                                 this.reportUnusedParameterWhenImplementingAbstract ? ENABLED
514                                                 : DISABLED);
515                 optionsMap.put(OPTION_ReportUnusedParameterWhenOverridingConcrete,
516                                 this.reportUnusedParameterWhenOverridingConcrete ? ENABLED
517                                                 : DISABLED);
518                 optionsMap.put(OPTION_ReportSpecialParameterHidingField,
519                                 this.reportSpecialParameterHidingField ? ENABLED : DISABLED);
520                 optionsMap.put(OPTION_MaxProblemPerUnit, String
521                                 .valueOf(this.maxProblemsPerUnit));
522
523                 return optionsMap;
524         }
525
526         public int getSeverity(long irritant) {
527                 if ((this.warningThreshold & irritant) != 0)
528                         return Warning;
529                 if ((this.errorThreshold & irritant) != 0)
530                         return Error;
531                 return Ignore;
532         }
533
534         public String getSeverityString(long irritant) {
535                 if ((this.warningThreshold & irritant) != 0)
536                         return WARNING;
537                 if ((this.errorThreshold & irritant) != 0)
538                         return ERROR;
539                 return IGNORE;
540         }
541
542         public String getVisibilityString(int level) {
543                 switch (level) {
544                 case AccPublic:
545                         return PUBLIC;
546                 case AccProtected:
547                         return PROTECTED;
548                 case AccPrivate:
549                         return PRIVATE;
550                 default:
551                         return DEFAULT;
552                 }
553         }
554
555         public void set(Map optionsMap) {
556
557                 Object optionValue;
558                 if ((optionValue = optionsMap.get(OPTION_LocalVariableAttribute)) != null) {
559                         if (GENERATE.equals(optionValue)) {
560                                 this.produceDebugAttributes |= Vars;
561                         } else if (DO_NOT_GENERATE.equals(optionValue)) {
562                                 this.produceDebugAttributes &= ~Vars;
563                         }
564                 }
565                 if ((optionValue = optionsMap.get(OPTION_LineNumberAttribute)) != null) {
566                         if (GENERATE.equals(optionValue)) {
567                                 this.produceDebugAttributes |= Lines;
568                         } else if (DO_NOT_GENERATE.equals(optionValue)) {
569                                 this.produceDebugAttributes &= ~Lines;
570                         }
571                 }
572                 if ((optionValue = optionsMap.get(OPTION_SourceFileAttribute)) != null) {
573                         if (GENERATE.equals(optionValue)) {
574                                 this.produceDebugAttributes |= Source;
575                         } else if (DO_NOT_GENERATE.equals(optionValue)) {
576                                 this.produceDebugAttributes &= ~Source;
577                         }
578                 }
579                 // if ((optionValue = optionsMap.get(OPTION_PreserveUnusedLocal)) !=
580                 // null) {
581                 // if (PRESERVE.equals(optionValue)) {
582                 // this.preserveAllLocalVariables = true;
583                 // } else if (OPTIMIZE_OUT.equals(optionValue)) {
584                 // this.preserveAllLocalVariables = false;
585                 // }
586                 // }
587                 if ((optionValue = optionsMap
588                                 .get(OPTION_ReportDeprecationInDeprecatedCode)) != null) {
589                         if (ENABLED.equals(optionValue)) {
590                                 this.reportDeprecationInsideDeprecatedCode = true;
591                         } else if (DISABLED.equals(optionValue)) {
592                                 this.reportDeprecationInsideDeprecatedCode = false;
593                         }
594                 }
595                 if ((optionValue = optionsMap
596                                 .get(OPTION_ReportDeprecationWhenOverridingDeprecatedMethod)) != null) {
597                         if (ENABLED.equals(optionValue)) {
598                                 this.reportDeprecationWhenOverridingDeprecatedMethod = true;
599                         } else if (DISABLED.equals(optionValue)) {
600                                 this.reportDeprecationWhenOverridingDeprecatedMethod = false;
601                         }
602                 }
603                 if ((optionValue = optionsMap
604                                 .get(OPTION_ReportUnusedDeclaredThrownExceptionWhenOverriding)) != null) {
605                         if (ENABLED.equals(optionValue)) {
606                                 this.reportUnusedDeclaredThrownExceptionWhenOverriding = true;
607                         } else if (DISABLED.equals(optionValue)) {
608                                 this.reportUnusedDeclaredThrownExceptionWhenOverriding = false;
609                         }
610                 }
611                 // if ((optionValue = optionsMap.get(OPTION_Compliance)) != null) {
612                 // long level = versionToJdkLevel(optionValue);
613                 // if (level != 0) this.complianceLevel = level;
614                 // }
615                 // if ((optionValue = optionsMap.get(OPTION_Source)) != null) {
616                 // long level = versionToJdkLevel(optionValue);
617                 // if (level != 0) this.sourceLevel = level;
618                 // }
619                 // if ((optionValue = optionsMap.get(OPTION_TargetPlatform)) != null) {
620                 // long level = versionToJdkLevel(optionValue);
621                 // if (level != 0) this.targetJDK = level;
622                 // }
623                 if ((optionValue = optionsMap.get(OPTION_Encoding)) != null) {
624                         if (optionValue instanceof String) {
625                                 this.defaultEncoding = null;
626                                 String stringValue = (String) optionValue;
627                                 if (stringValue.length() > 0) {
628                                         try {
629                                                 new InputStreamReader(new ByteArrayInputStream(
630                                                                 new byte[0]), stringValue);
631                                                 this.defaultEncoding = stringValue;
632                                         } catch (UnsupportedEncodingException e) {
633                                                 // ignore unsupported encoding
634                                         }
635                                 }
636                         }
637                 }
638                 // if ((optionValue = optionsMap.get(OPTION_PrivateConstructorAccess))
639                 // != null) {
640                 // long level = versionToJdkLevel(optionValue);
641                 // if (level >= JDK1_3)
642                 // this.isPrivateConstructorAccessChangingVisibility = true;
643                 // }
644                 if ((optionValue = optionsMap
645                                 .get(OPTION_ReportUnusedParameterWhenImplementingAbstract)) != null) {
646                         if (ENABLED.equals(optionValue)) {
647                                 this.reportUnusedParameterWhenImplementingAbstract = true;
648                         } else if (DISABLED.equals(optionValue)) {
649                                 this.reportUnusedParameterWhenImplementingAbstract = false;
650                         }
651                 }
652                 if ((optionValue = optionsMap
653                                 .get(OPTION_ReportUnusedParameterWhenOverridingConcrete)) != null) {
654                         if (ENABLED.equals(optionValue)) {
655                                 this.reportUnusedParameterWhenOverridingConcrete = true;
656                         } else if (DISABLED.equals(optionValue)) {
657                                 this.reportUnusedParameterWhenOverridingConcrete = false;
658                         }
659                 }
660                 if ((optionValue = optionsMap
661                                 .get(OPTION_ReportSpecialParameterHidingField)) != null) {
662                         if (ENABLED.equals(optionValue)) {
663                                 this.reportSpecialParameterHidingField = true;
664                         } else if (DISABLED.equals(optionValue)) {
665                                 this.reportSpecialParameterHidingField = false;
666                         }
667                 }
668                 if ((optionValue = optionsMap.get(OPTION_MaxProblemPerUnit)) != null) {
669                         if (optionValue instanceof String) {
670                                 String stringValue = (String) optionValue;
671                                 try {
672                                         int val = Integer.parseInt(stringValue);
673                                         if (val >= 0)
674                                                 this.maxProblemsPerUnit = val;
675                                 } catch (NumberFormatException e) {
676                                         // ignore ill-formatted limit
677                                 }
678                         }
679                 }
680                 if ((optionValue = optionsMap.get(OPTION_TaskTags)) != null) {
681                         if (optionValue instanceof String) {
682                                 String stringValue = (String) optionValue;
683                                 if (stringValue.length() == 0) {
684                                         this.taskTags = null;
685                                 } else {
686                                         this.taskTags = CharOperation.splitAndTrimOn(',',
687                                                         stringValue.toCharArray());
688                                 }
689                         }
690                 }
691                 if ((optionValue = optionsMap.get(OPTION_TaskPriorities)) != null) {
692                         if (optionValue instanceof String) {
693                                 String stringValue = (String) optionValue;
694                                 if (stringValue.length() == 0) {
695                                         this.taskPriorites = null;
696                                 } else {
697                                         this.taskPriorites = CharOperation.splitAndTrimOn(',',
698                                                         stringValue.toCharArray());
699                                 }
700                         }
701                 }
702                 if ((optionValue = optionsMap.get(OPTION_PHPVarDeprecatedWarning)) != null)
703                         updateSeverity(PHPVarDeprecatedWarning, optionValue);
704                 if ((optionValue = optionsMap.get(OPTION_PHPBadStyleKeywordWarning)) != null)
705                         updateSeverity(PHPBadStyleKeywordWarning, optionValue);
706                 if ((optionValue = optionsMap
707                                 .get(OPTION_PHPBadStyleUppercaseIdentifierWarning)) != null)
708                         updateSeverity(PHPBadStyleUppercaseIdentifierWarning, optionValue);
709                 if ((optionValue = optionsMap.get(OPTION_PHPIncludeNotExistWarning)) != null)
710                         updateSeverity(PHPIncludeNotExistWarning, optionValue);
711                 if ((optionValue = optionsMap
712                                 .get(OPTION_UninitializedLocalVariableWarning)) != null)
713                         updateSeverity(UninitializedLocalVariableWarning, optionValue);
714                 if ((optionValue = optionsMap.get(OPTION_CodeCannotBeReachedWarning)) != null)
715                         updateSeverity(CodeCannotBeReachedWarning, optionValue);
716
717                 if ((optionValue = optionsMap
718                                 .get(OPTION_ReportMethodWithConstructorName)) != null)
719                         updateSeverity(MethodWithConstructorName, optionValue);
720                 if ((optionValue = optionsMap
721                                 .get(OPTION_ReportOverridingPackageDefaultMethod)) != null)
722                         updateSeverity(OverriddenPackageDefaultMethod, optionValue);
723                 if ((optionValue = optionsMap.get(OPTION_ReportDeprecation)) != null)
724                         updateSeverity(UsingDeprecatedAPI, optionValue);
725                 if ((optionValue = optionsMap.get(OPTION_ReportHiddenCatchBlock)) != null)
726                         updateSeverity(MaskedCatchBlock, optionValue);
727                 if ((optionValue = optionsMap.get(OPTION_ReportUnusedLocal)) != null)
728                         updateSeverity(UnusedLocalVariable, optionValue);
729                 if ((optionValue = optionsMap.get(OPTION_ReportUnusedParameter)) != null)
730                         updateSeverity(UnusedArgument, optionValue);
731                 if ((optionValue = optionsMap.get(OPTION_ReportUnusedImport)) != null)
732                         updateSeverity(UnusedImport, optionValue);
733                 if ((optionValue = optionsMap.get(OPTION_ReportUnusedPrivateMember)) != null)
734                         updateSeverity(UnusedPrivateMember, optionValue);
735                 if ((optionValue = optionsMap
736                                 .get(OPTION_ReportUnusedDeclaredThrownException)) != null)
737                         updateSeverity(UnusedDeclaredThrownException, optionValue);
738                 if ((optionValue = optionsMap
739                                 .get(OPTION_ReportNoImplicitStringConversion)) != null)
740                         updateSeverity(NoImplicitStringConversion, optionValue);
741                 if ((optionValue = optionsMap
742                                 .get(OPTION_ReportSyntheticAccessEmulation)) != null)
743                         updateSeverity(AccessEmulation, optionValue);
744                 if ((optionValue = optionsMap.get(OPTION_ReportLocalVariableHiding)) != null)
745                         updateSeverity(LocalVariableHiding, optionValue);
746                 if ((optionValue = optionsMap.get(OPTION_ReportFieldHiding)) != null)
747                         updateSeverity(FieldHiding, optionValue);
748                 if ((optionValue = optionsMap
749                                 .get(OPTION_ReportPossibleAccidentalBooleanAssignment)) != null)
750                         updateSeverity(AccidentalBooleanAssign, optionValue);
751                 if ((optionValue = optionsMap.get(OPTION_ReportSuperfluousSemicolon)) != null)
752                         updateSeverity(SuperfluousSemicolon, optionValue);
753                 if ((optionValue = optionsMap
754                                 .get(OPTION_ReportNonExternalizedStringLiteral)) != null)
755                         updateSeverity(NonExternalizedString, optionValue);
756                 if ((optionValue = optionsMap.get(OPTION_ReportAssertIdentifier)) != null)
757                         updateSeverity(AssertUsedAsAnIdentifier, optionValue);
758                 if ((optionValue = optionsMap.get(OPTION_ReportNonStaticAccessToStatic)) != null)
759                         updateSeverity(NonStaticAccessToStatic, optionValue);
760                 if ((optionValue = optionsMap.get(OPTION_ReportIndirectStaticAccess)) != null)
761                         updateSeverity(IndirectStaticAccess, optionValue);
762                 if ((optionValue = optionsMap
763                                 .get(OPTION_ReportIncompatibleNonInheritedInterfaceMethod)) != null)
764                         updateSeverity(IncompatibleNonInheritedInterfaceMethod, optionValue);
765                 if ((optionValue = optionsMap.get(OPTION_ReportUndocumentedEmptyBlock)) != null)
766                         updateSeverity(UndocumentedEmptyBlock, optionValue);
767                 if ((optionValue = optionsMap.get(OPTION_ReportUnnecessaryTypeCheck)) != null)
768                         updateSeverity(UnnecessaryTypeCheck, optionValue);
769                 if ((optionValue = optionsMap
770                                 .get(OPTION_ReportFinallyBlockNotCompletingNormally)) != null)
771                         updateSeverity(FinallyBlockNotCompleting, optionValue);
772                 if ((optionValue = optionsMap.get(OPTION_ReportUnqualifiedFieldAccess)) != null)
773                         updateSeverity(UnqualifiedFieldAccess, optionValue);
774                 if ((optionValue = optionsMap.get(OPTION_ReportNoEffectAssignment)) != null)
775                         updateSeverity(NoEffectAssignment, optionValue);
776
777                 // Javadoc options
778                 // Javadoc options
779                 if ((optionValue = optionsMap.get(OPTION_DocCommentSupport)) != null) {
780                         if (ENABLED.equals(optionValue)) {
781                                 this.docCommentSupport = true;
782                         } else if (DISABLED.equals(optionValue)) {
783                                 this.docCommentSupport = false;
784                         }
785                 }
786                 if ((optionValue = optionsMap.get(OPTION_ReportInvalidJavadoc)) != null) {
787                         updateSeverity(InvalidJavadoc, optionValue);
788                 }
789                 if ((optionValue = optionsMap
790                                 .get(OPTION_ReportInvalidJavadocTagsVisibility)) != null) {
791                         if (PUBLIC.equals(optionValue)) {
792                                 this.reportInvalidJavadocTagsVisibility = AccPublic;
793                         } else if (PROTECTED.equals(optionValue)) {
794                                 this.reportInvalidJavadocTagsVisibility = AccProtected;
795                                 // } else if (DEFAULT.equals(optionValue)) {
796                                 // this.reportInvalidJavadocTagsVisibility = AccDefault;
797                         } else if (PRIVATE.equals(optionValue)) {
798                                 this.reportInvalidJavadocTagsVisibility = AccPrivate;
799                         }
800                 }
801                 if ((optionValue = optionsMap.get(OPTION_ReportInvalidJavadocTags)) != null) {
802                         if (ENABLED.equals(optionValue)) {
803                                 this.reportInvalidJavadocTags = true;
804                         } else if (DISABLED.equals(optionValue)) {
805                                 this.reportInvalidJavadocTags = false;
806                         }
807                 }
808                 if ((optionValue = optionsMap.get(OPTION_ReportMissingJavadocTags)) != null) {
809                         updateSeverity(MissingJavadocTags, optionValue);
810                 }
811                 if ((optionValue = optionsMap
812                                 .get(OPTION_ReportMissingJavadocTagsVisibility)) != null) {
813                         if (PUBLIC.equals(optionValue)) {
814                                 this.reportMissingJavadocTagsVisibility = AccPublic;
815                         } else if (PROTECTED.equals(optionValue)) {
816                                 this.reportMissingJavadocTagsVisibility = AccProtected;
817                                 // } else if (DEFAULT.equals(optionValue)) {
818                                 // this.reportMissingJavadocTagsVisibility = AccDefault;
819                         } else if (PRIVATE.equals(optionValue)) {
820                                 this.reportMissingJavadocTagsVisibility = AccPrivate;
821                         }
822                 }
823                 if ((optionValue = optionsMap
824                                 .get(OPTION_ReportMissingJavadocTagsOverriding)) != null) {
825                         if (ENABLED.equals(optionValue)) {
826                                 this.reportMissingJavadocTagsOverriding = true;
827                         } else if (DISABLED.equals(optionValue)) {
828                                 this.reportMissingJavadocTagsOverriding = false;
829                         }
830                 }
831                 if ((optionValue = optionsMap.get(OPTION_ReportMissingJavadocComments)) != null) {
832                         updateSeverity(MissingJavadocComments, optionValue);
833                 }
834                 if ((optionValue = optionsMap
835                                 .get(OPTION_ReportMissingJavadocCommentsVisibility)) != null) {
836                         if (PUBLIC.equals(optionValue)) {
837                                 this.reportMissingJavadocCommentsVisibility = AccPublic;
838                         } else if (PROTECTED.equals(optionValue)) {
839                                 this.reportMissingJavadocCommentsVisibility = AccProtected;
840                                 // } else if (DEFAULT.equals(optionValue)) {
841                                 // this.reportMissingJavadocCommentsVisibility = AccDefault;
842                         } else if (PRIVATE.equals(optionValue)) {
843                                 this.reportMissingJavadocCommentsVisibility = AccPrivate;
844                         }
845                 }
846                 if ((optionValue = optionsMap
847                                 .get(OPTION_ReportMissingJavadocCommentsOverriding)) != null) {
848                         if (ENABLED.equals(optionValue)) {
849                                 this.reportMissingJavadocCommentsOverriding = true;
850                         } else if (DISABLED.equals(optionValue)) {
851                                 this.reportMissingJavadocCommentsOverriding = false;
852                         }
853                 }
854         }
855
856         public void setVerboseMode(boolean flag) {
857                 this.verbose = flag;
858         }
859
860         public String toString() {
861
862                 StringBuffer buf = new StringBuffer("CompilerOptions:"); //$NON-NLS-1$
863                 buf
864                                 .append("\n\t- var is deprecated keyword: ").append(getSeverityString(PHPVarDeprecatedWarning)); //$NON-NLS-1$
865                 buf
866                                 .append("\n\t- don't use keywords as identifiers: ").append(getSeverityString(PHPBadStyleKeywordWarning)); //$NON-NLS-1$
867                 buf
868                                 .append(
869                                                 "\n\t- non-variable idenifiers should contain only uppercase characters: ").append(getSeverityString(PHPBadStyleUppercaseIdentifierWarning)); //$NON-NLS-1$
870                 buf
871                                 .append("\n\t- include filename doesn't exist in project: ").append(getSeverityString(PHPIncludeNotExistWarning)); //$NON-NLS-1$
872                 buf
873                                 .append("\n\t- local variable not initialized: ").append(getSeverityString(UninitializedLocalVariableWarning)); //$NON-NLS-1$
874                 buf
875                                 .append("\n\t- unreachable code: ").append(getSeverityString(CodeCannotBeReachedWarning)); //$NON-NLS-1$
876
877                 buf
878                                 .append("\n\t- local variables debug attributes: ").append((this.produceDebugAttributes & Vars) != 0 ? "ON" : " OFF"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
879                 buf
880                                 .append("\n\t- line number debug attributes: ").append((this.produceDebugAttributes & Lines) != 0 ? "ON" : " OFF"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
881                 buf
882                                 .append("\n\t- source debug attributes: ").append((this.produceDebugAttributes & Source) != 0 ? "ON" : " OFF"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
883                 buf
884                                 .append("\n\t- preserve all local variables: ").append(this.preserveAllLocalVariables ? "ON" : " OFF"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
885                 buf
886                                 .append("\n\t- method with constructor name: ").append(getSeverityString(MethodWithConstructorName)); //$NON-NLS-1$
887                 buf
888                                 .append("\n\t- overridden package default method: ").append(getSeverityString(OverriddenPackageDefaultMethod)); //$NON-NLS-1$
889                 buf
890                                 .append("\n\t- deprecation: ").append(getSeverityString(UsingDeprecatedAPI)); //$NON-NLS-1$
891                 buf
892                                 .append("\n\t- masked catch block: ").append(getSeverityString(MaskedCatchBlock)); //$NON-NLS-1$
893                 buf
894                                 .append("\n\t- unused local variable: ").append(getSeverityString(UnusedLocalVariable)); //$NON-NLS-1$
895                 buf
896                                 .append("\n\t- unused parameter: ").append(getSeverityString(UnusedArgument)); //$NON-NLS-1$
897                 buf
898                                 .append("\n\t- unused import: ").append(getSeverityString(UnusedImport)); //$NON-NLS-1$
899                 buf
900                                 .append("\n\t- synthetic access emulation: ").append(getSeverityString(AccessEmulation)); //$NON-NLS-1$
901                 buf
902                                 .append("\n\t- assignment with no effect: ").append(getSeverityString(NoEffectAssignment)); //$NON-NLS-1$
903                 buf
904                                 .append("\n\t- non externalized string: ").append(getSeverityString(NonExternalizedString)); //$NON-NLS-1$
905                 buf
906                                 .append("\n\t- static access receiver: ").append(getSeverityString(NonStaticAccessToStatic)); //$NON-NLS-1$
907                 buf
908                                 .append("\n\t- indirect static access: ").append(getSeverityString(IndirectStaticAccess)); //$NON-NLS-1$
909                 buf
910                                 .append("\n\t- incompatible non inherited interface method: ").append(getSeverityString(IncompatibleNonInheritedInterfaceMethod)); //$NON-NLS-1$
911                 buf
912                                 .append("\n\t- unused private member: ").append(getSeverityString(UnusedPrivateMember)); //$NON-NLS-1$
913                 buf
914                                 .append("\n\t- local variable hiding another variable: ").append(getSeverityString(LocalVariableHiding)); //$NON-NLS-1$
915                 buf
916                                 .append("\n\t- field hiding another variable: ").append(getSeverityString(FieldHiding)); //$NON-NLS-1$
917                 buf
918                                 .append("\n\t- possible accidental boolean assignment: ").append(getSeverityString(AccidentalBooleanAssign)); //$NON-NLS-1$
919                 buf
920                                 .append("\n\t- superfluous semicolon: ").append(getSeverityString(SuperfluousSemicolon)); //$NON-NLS-1$
921                 buf
922                                 .append("\n\t- uncommented empty block: ").append(getSeverityString(UndocumentedEmptyBlock)); //$NON-NLS-1$
923                 buf
924                                 .append("\n\t- unnecessary type check: ").append(getSeverityString(UnnecessaryTypeCheck)); //$NON-NLS-1$
925                 buf
926                                 .append("\n\t- invalid javadoc: ").append(getSeverityString(InvalidJavadoc)); //$NON-NLS-1$
927                 buf
928                                 .append("\n\t- report invalid javadoc tags: ").append(this.reportInvalidJavadocTags ? ENABLED : DISABLED); //$NON-NLS-1$
929                 buf
930                                 .append(
931                                                 "\n\t- visibility level to report invalid javadoc tags: ").append(getVisibilityString(this.reportInvalidJavadocTagsVisibility)); //$NON-NLS-1$
932                 buf
933                                 .append("\n\t- missing javadoc tags: ").append(getSeverityString(MissingJavadocTags)); //$NON-NLS-1$
934                 buf
935                                 .append(
936                                                 "\n\t- visibility level to report missing javadoc tags: ").append(getVisibilityString(this.reportMissingJavadocTagsVisibility)); //$NON-NLS-1$
937                 buf
938                                 .append(
939                                                 "\n\t- report missing javadoc tags in overriding methods: ").append(this.reportMissingJavadocTagsOverriding ? ENABLED : DISABLED); //$NON-NLS-1$
940                 buf
941                                 .append("\n\t- missing javadoc comments: ").append(getSeverityString(MissingJavadocComments)); //$NON-NLS-1$
942                 buf
943                                 .append(
944                                                 "\n\t- visibility level to report missing javadoc comments: ").append(getVisibilityString(this.reportMissingJavadocCommentsVisibility)); //$NON-NLS-1$
945                 buf
946                                 .append(
947                                                 "\n\t- report missing javadoc comments in overriding methods: ").append(this.reportMissingJavadocCommentsOverriding ? ENABLED : DISABLED); //$NON-NLS-1$
948                 buf
949                                 .append("\n\t- finally block not completing normally: ").append(getSeverityString(FinallyBlockNotCompleting)); //$NON-NLS-1$
950                 buf
951                                 .append("\n\t- unused declared thrown exception: ").append(getSeverityString(UnusedDeclaredThrownException)); //$NON-NLS-1$
952                 buf
953                                 .append(
954                                                 "\n\t- unused declared thrown exception when overriding ").append(this.reportUnusedDeclaredThrownExceptionWhenOverriding ? ENABLED : DISABLED); //$NON-NLS-1$
955                 // buf.append("\n\t- JDK compliance level: "+
956                 // versionFromJdkLevel(this.complianceLevel)); //$NON-NLS-1$
957                 // buf.append("\n\t- JDK source level: "+
958                 // versionFromJdkLevel(this.sourceLevel)); //$NON-NLS-1$
959                 // buf.append("\n\t- JDK target level: "+
960                 // versionFromJdkLevel(this.targetJDK)); //$NON-NLS-1$
961                 buf
962                                 .append("\n\t- private constructor access: ").append(this.isPrivateConstructorAccessChangingVisibility ? "extra argument" : "make default access"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
963                 buf.append("\n\t- verbose : ").append(this.verbose ? "ON" : "OFF"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
964                 buf
965                                 .append("\n\t- produce reference info : ").append(this.produceReferenceInfo ? "ON" : "OFF"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
966                 buf
967                                 .append("\n\t- parse literal expressions as constants : ").append(this.parseLiteralExpressionsAsConstants ? "ON" : "OFF"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
968                 buf
969                                 .append("\n\t- encoding : ").append(this.defaultEncoding == null ? "<default>" : this.defaultEncoding); //$NON-NLS-1$ //$NON-NLS-2$
970                 buf
971                                 .append("\n\t- task tags: ").append(this.taskTags == null ? "" : new String(CharOperation.concatWith(this.taskTags, ','))); //$NON-NLS-1$ //$NON-NLS-2$
972                 buf
973                                 .append("\n\t- task priorities : ").append(this.taskPriorites == null ? "" : new String(CharOperation.concatWith(this.taskPriorites, ','))); //$NON-NLS-1$ //$NON-NLS-2$
974                 buf
975                                 .append("\n\t- report deprecation inside deprecated code : ").append(this.reportDeprecationInsideDeprecatedCode ? "ENABLED" : "DISABLED"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
976                 buf
977                                 .append(
978                                                 "\n\t- report deprecation when overriding deprecated method : ").append(this.reportDeprecationWhenOverridingDeprecatedMethod ? "ENABLED" : "DISABLED"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
979                 buf
980                                 .append(
981                                                 "\n\t- report unused parameter when implementing abstract method : ").append(this.reportUnusedParameterWhenImplementingAbstract ? "ENABLED" : "DISABLED"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
982                 buf
983                                 .append(
984                                                 "\n\t- report unused parameter when overriding concrete method : ").append(this.reportUnusedParameterWhenOverridingConcrete ? "ENABLED" : "DISABLED"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
985                 buf
986                                 .append(
987                                                 "\n\t- report constructor/setter parameter hiding existing field : ").append(this.reportSpecialParameterHidingField ? "ENABLED" : "DISABLED"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
988                 return buf.toString();
989         }
990
991         void updateSeverity(long irritant, Object severityString) {
992                 if (ERROR.equals(severityString)) {
993                         this.errorThreshold |= irritant;
994                         this.warningThreshold &= ~irritant;
995                 } else if (WARNING.equals(severityString)) {
996                         this.errorThreshold &= ~irritant;
997                         this.warningThreshold |= irritant;
998                 } else if (IGNORE.equals(severityString)) {
999                         this.errorThreshold &= ~irritant;
1000                         this.warningThreshold &= ~irritant;
1001                 }
1002         }
1003         // public static long versionToJdkLevel(Object versionID) {
1004         // if (VERSION_1_1.equals(versionID)) {
1005         // return JDK1_1;
1006         // } else if (VERSION_1_2.equals(versionID)) {
1007         // return JDK1_2;
1008         // } else if (VERSION_1_3.equals(versionID)) {
1009         // return JDK1_3;
1010         // } else if (VERSION_1_4.equals(versionID)) {
1011         // return JDK1_4;
1012         // } else if (VERSION_1_5.equals(versionID)) {
1013         // return JDK1_5;
1014         // }
1015         // return 0; // unknown
1016         // }
1017
1018         // public static String versionFromJdkLevel(long jdkLevel) {
1019         // if (jdkLevel == JDK1_1) {
1020         // return VERSION_1_1;
1021         // } else if (jdkLevel == JDK1_2) {
1022         // return VERSION_1_2;
1023         // } else if (jdkLevel == JDK1_3) {
1024         // return VERSION_1_3;
1025         // } else if (jdkLevel == JDK1_4) {
1026         // return VERSION_1_4;
1027         // } else if (jdkLevel == JDK1_5) {
1028         // return VERSION_1_5;
1029         // }
1030         // return ""; // unknown version //$NON-NLS-1$
1031         // }
1032 }