1 /*******************************************************************************
2 * Copyright (c) 2000, 2004 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package net.sourceforge.phpdt.internal.compiler.impl;
13 import java.io.ByteArrayInputStream;
14 import java.io.InputStreamReader;
15 import java.io.UnsupportedEncodingException;
16 //import java.util.HashMap;
19 import 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;
25 public class CompilerOptions implements ProblemReasons, ProblemSeverities,
31 public static final String OPTION_PHPVarDeprecatedWarning = "net.sourceforge.phpeclipse.compiler.problem.phpVarDeprecatedWarning"; //$NON-NLS-1$
33 public static final String OPTION_PHPBadStyleKeywordWarning = "net.sourceforge.phpeclipse.compiler.problem.phpBadStyleKeywordWarning"; //$NON-NLS-1$
35 public static final String OPTION_PHPBadStyleUppercaseIdentifierWarning = "net.sourceforge.phpeclipse.compiler.problem.phpBadStyleUppercaseIdentifierWarning"; //$NON-NLS-1$
37 public static final String OPTION_PHPIncludeNotExistWarning = "net.sourceforge.phpeclipse.compiler.problem.phpIncludeNotExistWarning"; //$NON-NLS-1$
39 public static final String OPTION_UninitializedLocalVariableWarning = "net.sourceforge.phpeclipse.compiler.problem.uninitializedLocalVariableWarning"; //$NON-NLS-1$
41 public static final String OPTION_CodeCannotBeReachedWarning = "net.sourceforge.phpeclipse.compiler.problem.codeCannotBeReachedWarning"; //$NON-NLS-1$
43 public static final String OPTION_LocalVariableAttribute = "net.sourceforge.phpeclipse.compiler.debug.localVariable"; //$NON-NLS-1$
45 public static final String OPTION_LineNumberAttribute = "net.sourceforge.phpeclipse.compiler.debug.lineNumber"; //$NON-NLS-1$
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$
51 public static final String OPTION_DocCommentSupport = "net.sourceforge.phpeclipse.compiler.doc.comment.support"; //$NON-NLS-1$
53 public static final String OPTION_ReportMethodWithConstructorName = "net.sourceforge.phpeclipse.compiler.problem.methodWithConstructorName"; //$NON-NLS-1$
55 public static final String OPTION_ReportOverridingPackageDefaultMethod = "net.sourceforge.phpeclipse.compiler.problem.overridingPackageDefaultMethod"; //$NON-NLS-1$
57 public static final String OPTION_ReportDeprecation = "net.sourceforge.phpeclipse.compiler.problem.deprecation"; //$NON-NLS-1$
59 public static final String OPTION_ReportDeprecationInDeprecatedCode = "net.sourceforge.phpeclipse.compiler.problem.deprecationInDeprecatedCode"; //$NON-NLS-1$
61 public static final String OPTION_ReportDeprecationWhenOverridingDeprecatedMethod = "net.sourceforge.phpeclipse.compiler.problem.deprecationWhenOverridingDeprecatedMethod"; //$NON-NLS-1$
63 public static final String OPTION_ReportHiddenCatchBlock = "net.sourceforge.phpeclipse.compiler.problem.hiddenCatchBlock"; //$NON-NLS-1$
65 public static final String OPTION_ReportUnusedLocal = "net.sourceforge.phpeclipse.compiler.problem.unusedLocal"; //$NON-NLS-1$
67 public static final String OPTION_ReportUnusedParameter = "net.sourceforge.phpeclipse.compiler.problem.unusedParameter"; //$NON-NLS-1$
69 public static final String OPTION_ReportUnusedParameterWhenImplementingAbstract = "net.sourceforge.phpeclipse.compiler.problem.unusedParameterWhenImplementingAbstract"; //$NON-NLS-1$
71 public static final String OPTION_ReportUnusedParameterWhenOverridingConcrete = "net.sourceforge.phpeclipse.compiler.problem.unusedParameterWhenOverridingConcrete"; //$NON-NLS-1$
73 public static final String OPTION_ReportUnusedImport = "net.sourceforge.phpeclipse.compiler.problem.unusedImport"; //$NON-NLS-1$
75 public static final String OPTION_ReportSyntheticAccessEmulation = "net.sourceforge.phpeclipse.compiler.problem.syntheticAccessEmulation"; //$NON-NLS-1$
77 public static final String OPTION_ReportNoEffectAssignment = "net.sourceforge.phpeclipse.compiler.problem.noEffectAssignment"; //$NON-NLS-1$
79 public static final String OPTION_ReportLocalVariableHiding = "net.sourceforge.phpeclipse.compiler.problem.localVariableHiding"; //$NON-NLS-1$
81 public static final String OPTION_ReportSpecialParameterHidingField = "net.sourceforge.phpeclipse.compiler.problem.specialParameterHidingField"; //$NON-NLS-1$
83 public static final String OPTION_ReportFieldHiding = "net.sourceforge.phpeclipse.compiler.problem.fieldHiding"; //$NON-NLS-1$
85 public static final String OPTION_ReportPossibleAccidentalBooleanAssignment = "net.sourceforge.phpeclipse.compiler.problem.possibleAccidentalBooleanAssignment"; //$NON-NLS-1$
87 public static final String OPTION_ReportNonExternalizedStringLiteral = "net.sourceforge.phpeclipse.compiler.problem.nonExternalizedStringLiteral"; //$NON-NLS-1$
89 public static final String OPTION_ReportIncompatibleNonInheritedInterfaceMethod = "net.sourceforge.phpeclipse.compiler.problem.incompatibleNonInheritedInterfaceMethod"; //$NON-NLS-1$
91 public static final String OPTION_ReportUnusedPrivateMember = "net.sourceforge.phpeclipse.compiler.problem.unusedPrivateMember"; //$NON-NLS-1$
93 public static final String OPTION_ReportNoImplicitStringConversion = "net.sourceforge.phpeclipse.compiler.problem.noImplicitStringConversion"; //$NON-NLS-1$
95 public static final String OPTION_ReportAssertIdentifier = "net.sourceforge.phpeclipse.compiler.problem.assertIdentifier"; //$NON-NLS-1$
97 public static final String OPTION_ReportNonStaticAccessToStatic = "net.sourceforge.phpeclipse.compiler.problem.staticAccessReceiver"; //$NON-NLS-1$
99 public static final String OPTION_ReportIndirectStaticAccess = "net.sourceforge.phpeclipse.compiler.problem.indirectStaticAccess"; //$NON-NLS-1$
101 public static final String OPTION_ReportSuperfluousSemicolon = "net.sourceforge.phpeclipse.compiler.problem.superfluousSemicolon"; //$NON-NLS-1$
103 public static final String OPTION_ReportUnnecessaryTypeCheck = "net.sourceforge.phpeclipse.compiler.problem.unnecessaryTypeCheck"; //$NON-NLS-1$
105 public static final String OPTION_ReportUndocumentedEmptyBlock = "net.sourceforge.phpeclipse.compiler.problem.undocumentedEmptyBlock"; //$NON-NLS-1$
107 public static final String OPTION_ReportInvalidJavadoc = "net.sourceforge.phpeclipse.compiler.problem.invalidJavadoc"; //$NON-NLS-1$
109 public static final String OPTION_ReportInvalidJavadocTags = "net.sourceforge.phpeclipse.compiler.problem.invalidJavadocTags"; //$NON-NLS-1$
111 public static final String OPTION_ReportInvalidJavadocTagsVisibility = "net.sourceforge.phpeclipse.compiler.problem.invalidJavadocTagsVisibility"; //$NON-NLS-1$
113 public static final String OPTION_ReportMissingJavadocTags = "net.sourceforge.phpeclipse.compiler.problem.missingJavadocTags"; //$NON-NLS-1$
115 public static final String OPTION_ReportMissingJavadocTagsVisibility = "net.sourceforge.phpeclipse.compiler.problem.missingJavadocTagsVisibility"; //$NON-NLS-1$
117 public static final String OPTION_ReportMissingJavadocTagsOverriding = "net.sourceforge.phpeclipse.compiler.problem.missingJavadocTagsOverriding"; //$NON-NLS-1$
119 public static final String OPTION_ReportMissingJavadocComments = "net.sourceforge.phpeclipse.compiler.problem.missingJavadocComments"; //$NON-NLS-1$
121 public static final String OPTION_ReportMissingJavadocCommentsVisibility = "net.sourceforge.phpeclipse.compiler.problem.missingJavadocCommentsVisibility"; //$NON-NLS-1$
123 public static final String OPTION_ReportMissingJavadocCommentsOverriding = "net.sourceforge.phpeclipse.compiler.problem.missingJavadocCommentsOverriding"; //$NON-NLS-1$
125 public static final String OPTION_ReportFinallyBlockNotCompletingNormally = "net.sourceforge.phpeclipse.compiler.problem.finallyBlockNotCompletingNormally"; //$NON-NLS-1$
127 public static final String OPTION_ReportUnusedDeclaredThrownException = "net.sourceforge.phpeclipse.compiler.problem.unusedDeclaredThrownException"; //$NON-NLS-1$
129 public static final String OPTION_ReportUnusedDeclaredThrownExceptionWhenOverriding = "net.sourceforge.phpeclipse.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding"; //$NON-NLS-1$
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";
137 // public static final String OPTION_Compliance =
138 // "net.sourceforge.phpeclipse.compiler.compliance"; //$NON-NLS-1$
140 public static final String OPTION_Encoding = "net.sourceforge.phpeclipse.encoding"; //$NON-NLS-1$
142 public static final String OPTION_MaxProblemPerUnit = "net.sourceforge.phpeclipse.compiler.maxProblemPerUnit"; //$NON-NLS-1$
144 public static final String OPTION_TaskTags = "net.sourceforge.phpeclipse.compiler.taskTags"; //$NON-NLS-1$
146 public static final String OPTION_TaskPriorities = "net.sourceforge.phpeclipse.compiler.taskPriorities"; //$NON-NLS-1$
148 // Backward compatibility
149 public static final String OPTION_ReportInvalidAnnotation = "net.sourceforge.phpeclipse.compiler.problem.invalidAnnotation"; //$NON-NLS-1$
151 public static final String OPTION_ReportMissingAnnotation = "net.sourceforge.phpeclipse.compiler.problem.missingAnnotation"; //$NON-NLS-1$
153 public static final String OPTION_ReportMissingJavadoc = "net.sourceforge.phpeclipse.compiler.problem.missingJavadoc"; //$NON-NLS-1$
155 /* should surface ??? */
156 // public static final String OPTION_PrivateConstructorAccess =
157 // "net.sourceforge.phpeclipse.compiler.codegen.constructorAccessEmulation";
160 * Possible values for configurable options
162 public static final String GENERATE = "generate";//$NON-NLS-1$
164 public static final String DO_NOT_GENERATE = "do not generate"; //$NON-NLS-1$
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$
174 public static final String ERROR = "error"; //$NON-NLS-1$
176 public static final String WARNING = "warning"; //$NON-NLS-1$
178 public static final String IGNORE = "ignore"; //$NON-NLS-1$
180 public static final String ENABLED = "enabled"; //$NON-NLS-1$
182 public static final String DISABLED = "disabled"; //$NON-NLS-1$
184 public static final String PUBLIC = "public"; //$NON-NLS-1$
186 public static final String PROTECTED = "protected"; //$NON-NLS-1$
188 public static final String DEFAULT = "default"; //$NON-NLS-1$
190 public static final String PRIVATE = "private"; //$NON-NLS-1$
193 * Bit mask for configurable problems (error/warning threshold)
199 public static final long MethodWithConstructorName = 0x1000L;
201 public static final long OverriddenPackageDefaultMethod = 0x2000L;
203 public static final long UsingDeprecatedAPI = 0x4000L;
205 public static final long MaskedCatchBlock = 0x8000L;
207 public static final long UnusedLocalVariable = 0x10000L;
209 public static final long UnusedArgument = 0x20000L;
211 public static final long NoImplicitStringConversion = 0x40000L;
213 public static final long AccessEmulation = 0x80000L;
215 public static final long NonExternalizedString = 0x100000L;
217 public static final long AssertUsedAsAnIdentifier = 0x200000L;
219 public static final long UnusedImport = 0x400000L;
221 public static final long NonStaticAccessToStatic = 0x800000L;
223 public static final long Task = 0x1000000L;
225 public static final long NoEffectAssignment = 0x2000000L;
227 public static final long IncompatibleNonInheritedInterfaceMethod = 0x4000000L;
229 public static final long UnusedPrivateMember = 0x8000000L;
231 public static final long LocalVariableHiding = 0x10000000L;
233 public static final long FieldHiding = 0x20000000L;
235 public static final long AccidentalBooleanAssign = 0x40000000L;
237 public static final long SuperfluousSemicolon = 0x80000000L;
239 public static final long IndirectStaticAccess = 0x100000000L;
241 public static final long UndocumentedEmptyBlock = 0x200000000L;
243 public static final long UnnecessaryTypeCheck = 0x400000000L;
245 public static final long InvalidJavadoc = 0x800000000L;
247 public static final long FinallyBlockNotCompleting = 0x1000000000L;
249 public static final long UnusedDeclaredThrownException = 0x2000000000L;
251 public static final long UnqualifiedFieldAccess = 0x4000000000L;
253 public static final long MissingJavadocTags = 0x8000000000L;
255 public static final long MissingJavadocComments = 0x10000000000L;
257 public static final long PHPVarDeprecatedWarning = 0x20000000000L;
259 public static final long PHPBadStyleKeywordWarning = 0x40000000000L;
261 public static final long PHPBadStyleUppercaseIdentifierWarning = 0x80000000000L;
263 public static final long PHPIncludeNotExistWarning = 0x100000000000L;
265 public static final long UninitializedLocalVariableWarning = 0x200000000000L;
267 public static final long CodeCannotBeReachedWarning = 0x400000000000L;
269 // Default severity level for handlers
270 public long errorThreshold = 0;
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;;
284 public static final int Source = 1; // SourceFileAttribute
286 public static final int Lines = 2; // LineNumberAttribute
288 public static final int Vars = 4; // LocalVariableTableAttribute
290 // By default only lines and source attributes are generated.
291 public int produceDebugAttributes = Lines | Source;
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
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
300 public boolean isPrivateConstructorAccessChangingVisibility = false; // by
305 // source encoding format
306 public String defaultEncoding = null; // will use the platform default
309 // print what unit is being processed
310 public boolean verbose = Compiler.DEBUG;
312 // indicates if reference info is desired
313 public boolean produceReferenceInfo = false;
315 // indicates if unused/optimizable local variables need to be preserved
316 // (debugging purpose)
317 public boolean preserveAllLocalVariables = false;
319 // indicates whether literal expressions are inlined at parse-time or not
320 public boolean parseLiteralExpressionsAsConstants = true;
322 // max problems per compilation unit
323 public int maxProblemsPerUnit = 100; // no more than 100 problems per
326 // tags used to recognize tasks in comments
327 public char[][] taskTags = null;
329 // priorities of tasks in comments
330 public char[][] taskPriorites = null;
332 // deprecation report
333 public boolean reportDeprecationInsideDeprecatedCode = false;
335 public boolean reportDeprecationWhenOverridingDeprecatedMethod = false;
337 // unused parameters report
338 public boolean reportUnusedParameterWhenImplementingAbstract = false;
340 public boolean reportUnusedParameterWhenOverridingConcrete = false;
342 // unused declaration of thrown exception
343 public boolean reportUnusedDeclaredThrownExceptionWhenOverriding = false;
345 // constructor/setter parameter hiding
346 public boolean reportSpecialParameterHidingField = false;
348 // check javadoc comments
349 public int reportInvalidJavadocTagsVisibility = AccPrivate;
351 public boolean reportInvalidJavadocTags = true;
353 // check missing javadoc tags
354 public int reportMissingJavadocTagsVisibility = AccPrivate;
356 public boolean reportMissingJavadocTagsOverriding = true;
358 // check missing javadoc comments
359 public int reportMissingJavadocCommentsVisibility = AccPublic;
361 public boolean reportMissingJavadocCommentsOverriding = true;
363 // javadoc comment support
364 public boolean docCommentSupport = false;
367 * Initializing the compiler options with defaults
369 public CompilerOptions() {
370 // use default options
374 * Initializing the compiler options with external settings
378 public CompilerOptions(Map settings) {
380 if (settings == null)
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));
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));
420 // .put(OPTION_ReportDeprecationInDeprecatedCode,
421 // this.reportDeprecationInsideDeprecatedCode ? ENABLED
423 // optionsMap.put(OPTION_ReportDeprecationWhenOverridingDeprecatedMethod,
424 // this.reportDeprecationWhenOverridingDeprecatedMethod ? ENABLED
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));
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));
480 // OPTION_ReportMissingJavadocCommentsVisibility,
481 // getVisibilityString(this.reportMissingJavadocCommentsVisibility));
482 // optionsMap.put(OPTION_ReportMissingJavadocCommentsOverriding,
483 // this.reportMissingJavadocCommentsOverriding ? ENABLED
485 // optionsMap.put(OPTION_ReportFinallyBlockNotCompletingNormally,
486 // getSeverityString(FinallyBlockNotCompleting));
487 // optionsMap.put(OPTION_ReportUnusedDeclaredThrownException,
488 // getSeverityString(UnusedDeclaredThrownException));
491 // OPTION_ReportUnusedDeclaredThrownExceptionWhenOverriding,
492 // this.reportUnusedDeclaredThrownExceptionWhenOverriding ? ENABLED
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);
507 // this.taskTags == null ? "" : new String(CharOperation.concatWith(this.taskTags, ','))); //$NON-NLS-1$
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
515 // optionsMap.put(OPTION_ReportUnusedParameterWhenOverridingConcrete,
516 // this.reportUnusedParameterWhenOverridingConcrete ? ENABLED
518 // optionsMap.put(OPTION_ReportSpecialParameterHidingField,
519 // this.reportSpecialParameterHidingField ? ENABLED : DISABLED);
520 // optionsMap.put(OPTION_MaxProblemPerUnit, String
521 // .valueOf(this.maxProblemsPerUnit));
523 // return optionsMap;
526 public int getSeverity(long irritant) {
527 if ((this.warningThreshold & irritant) != 0)
529 if ((this.errorThreshold & irritant) != 0)
534 public String getSeverityString(long irritant) {
535 if ((this.warningThreshold & irritant) != 0)
537 if ((this.errorThreshold & irritant) != 0)
542 public String getVisibilityString(int level) {
555 public void set(Map optionsMap) {
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;
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;
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;
579 // if ((optionValue = optionsMap.get(OPTION_PreserveUnusedLocal)) !=
581 // if (PRESERVE.equals(optionValue)) {
582 // this.preserveAllLocalVariables = true;
583 // } else if (OPTIMIZE_OUT.equals(optionValue)) {
584 // this.preserveAllLocalVariables = false;
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;
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;
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;
611 // if ((optionValue = optionsMap.get(OPTION_Compliance)) != null) {
612 // long level = versionToJdkLevel(optionValue);
613 // if (level != 0) this.complianceLevel = level;
615 // if ((optionValue = optionsMap.get(OPTION_Source)) != null) {
616 // long level = versionToJdkLevel(optionValue);
617 // if (level != 0) this.sourceLevel = level;
619 // if ((optionValue = optionsMap.get(OPTION_TargetPlatform)) != null) {
620 // long level = versionToJdkLevel(optionValue);
621 // if (level != 0) this.targetJDK = level;
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) {
629 new InputStreamReader(new ByteArrayInputStream(
630 new byte[0]), stringValue);
631 this.defaultEncoding = stringValue;
632 } catch (UnsupportedEncodingException e) {
633 // ignore unsupported encoding
638 // if ((optionValue = optionsMap.get(OPTION_PrivateConstructorAccess))
640 // long level = versionToJdkLevel(optionValue);
641 // if (level >= JDK1_3)
642 // this.isPrivateConstructorAccessChangingVisibility = true;
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;
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;
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;
668 if ((optionValue = optionsMap.get(OPTION_MaxProblemPerUnit)) != null) {
669 if (optionValue instanceof String) {
670 String stringValue = (String) optionValue;
672 int val = Integer.parseInt(stringValue);
674 this.maxProblemsPerUnit = val;
675 } catch (NumberFormatException e) {
676 // ignore ill-formatted limit
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;
686 this.taskTags = CharOperation.splitAndTrimOn(',',
687 stringValue.toCharArray());
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;
697 this.taskPriorites = CharOperation.splitAndTrimOn(',',
698 stringValue.toCharArray());
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);
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);
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;
786 if ((optionValue = optionsMap.get(OPTION_ReportInvalidJavadoc)) != null) {
787 updateSeverity(InvalidJavadoc, optionValue);
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;
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;
808 if ((optionValue = optionsMap.get(OPTION_ReportMissingJavadocTags)) != null) {
809 updateSeverity(MissingJavadocTags, optionValue);
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;
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;
831 if ((optionValue = optionsMap.get(OPTION_ReportMissingJavadocComments)) != null) {
832 updateSeverity(MissingJavadocComments, optionValue);
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;
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;
856 // public void setVerboseMode(boolean flag) {
857 // this.verbose = flag;
860 public String toString() {
862 StringBuffer buf = new StringBuffer("CompilerOptions:"); //$NON-NLS-1$
864 .append("\n\t- var is deprecated keyword: ").append(getSeverityString(PHPVarDeprecatedWarning)); //$NON-NLS-1$
866 .append("\n\t- don't use keywords as identifiers: ").append(getSeverityString(PHPBadStyleKeywordWarning)); //$NON-NLS-1$
869 "\n\t- non-variable idenifiers should contain only uppercase characters: ").append(getSeverityString(PHPBadStyleUppercaseIdentifierWarning)); //$NON-NLS-1$
871 .append("\n\t- include filename doesn't exist in project: ").append(getSeverityString(PHPIncludeNotExistWarning)); //$NON-NLS-1$
873 .append("\n\t- local variable not initialized: ").append(getSeverityString(UninitializedLocalVariableWarning)); //$NON-NLS-1$
875 .append("\n\t- unreachable code: ").append(getSeverityString(CodeCannotBeReachedWarning)); //$NON-NLS-1$
878 .append("\n\t- local variables debug attributes: ").append((this.produceDebugAttributes & Vars) != 0 ? "ON" : " OFF"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
880 .append("\n\t- line number debug attributes: ").append((this.produceDebugAttributes & Lines) != 0 ? "ON" : " OFF"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
882 .append("\n\t- source debug attributes: ").append((this.produceDebugAttributes & Source) != 0 ? "ON" : " OFF"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
884 .append("\n\t- preserve all local variables: ").append(this.preserveAllLocalVariables ? "ON" : " OFF"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
886 .append("\n\t- method with constructor name: ").append(getSeverityString(MethodWithConstructorName)); //$NON-NLS-1$
888 .append("\n\t- overridden package default method: ").append(getSeverityString(OverriddenPackageDefaultMethod)); //$NON-NLS-1$
890 .append("\n\t- deprecation: ").append(getSeverityString(UsingDeprecatedAPI)); //$NON-NLS-1$
892 .append("\n\t- masked catch block: ").append(getSeverityString(MaskedCatchBlock)); //$NON-NLS-1$
894 .append("\n\t- unused local variable: ").append(getSeverityString(UnusedLocalVariable)); //$NON-NLS-1$
896 .append("\n\t- unused parameter: ").append(getSeverityString(UnusedArgument)); //$NON-NLS-1$
898 .append("\n\t- unused import: ").append(getSeverityString(UnusedImport)); //$NON-NLS-1$
900 .append("\n\t- synthetic access emulation: ").append(getSeverityString(AccessEmulation)); //$NON-NLS-1$
902 .append("\n\t- assignment with no effect: ").append(getSeverityString(NoEffectAssignment)); //$NON-NLS-1$
904 .append("\n\t- non externalized string: ").append(getSeverityString(NonExternalizedString)); //$NON-NLS-1$
906 .append("\n\t- static access receiver: ").append(getSeverityString(NonStaticAccessToStatic)); //$NON-NLS-1$
908 .append("\n\t- indirect static access: ").append(getSeverityString(IndirectStaticAccess)); //$NON-NLS-1$
910 .append("\n\t- incompatible non inherited interface method: ").append(getSeverityString(IncompatibleNonInheritedInterfaceMethod)); //$NON-NLS-1$
912 .append("\n\t- unused private member: ").append(getSeverityString(UnusedPrivateMember)); //$NON-NLS-1$
914 .append("\n\t- local variable hiding another variable: ").append(getSeverityString(LocalVariableHiding)); //$NON-NLS-1$
916 .append("\n\t- field hiding another variable: ").append(getSeverityString(FieldHiding)); //$NON-NLS-1$
918 .append("\n\t- possible accidental boolean assignment: ").append(getSeverityString(AccidentalBooleanAssign)); //$NON-NLS-1$
920 .append("\n\t- superfluous semicolon: ").append(getSeverityString(SuperfluousSemicolon)); //$NON-NLS-1$
922 .append("\n\t- uncommented empty block: ").append(getSeverityString(UndocumentedEmptyBlock)); //$NON-NLS-1$
924 .append("\n\t- unnecessary type check: ").append(getSeverityString(UnnecessaryTypeCheck)); //$NON-NLS-1$
926 .append("\n\t- invalid javadoc: ").append(getSeverityString(InvalidJavadoc)); //$NON-NLS-1$
928 .append("\n\t- report invalid javadoc tags: ").append(this.reportInvalidJavadocTags ? ENABLED : DISABLED); //$NON-NLS-1$
931 "\n\t- visibility level to report invalid javadoc tags: ").append(getVisibilityString(this.reportInvalidJavadocTagsVisibility)); //$NON-NLS-1$
933 .append("\n\t- missing javadoc tags: ").append(getSeverityString(MissingJavadocTags)); //$NON-NLS-1$
936 "\n\t- visibility level to report missing javadoc tags: ").append(getVisibilityString(this.reportMissingJavadocTagsVisibility)); //$NON-NLS-1$
939 "\n\t- report missing javadoc tags in overriding methods: ").append(this.reportMissingJavadocTagsOverriding ? ENABLED : DISABLED); //$NON-NLS-1$
941 .append("\n\t- missing javadoc comments: ").append(getSeverityString(MissingJavadocComments)); //$NON-NLS-1$
944 "\n\t- visibility level to report missing javadoc comments: ").append(getVisibilityString(this.reportMissingJavadocCommentsVisibility)); //$NON-NLS-1$
947 "\n\t- report missing javadoc comments in overriding methods: ").append(this.reportMissingJavadocCommentsOverriding ? ENABLED : DISABLED); //$NON-NLS-1$
949 .append("\n\t- finally block not completing normally: ").append(getSeverityString(FinallyBlockNotCompleting)); //$NON-NLS-1$
951 .append("\n\t- unused declared thrown exception: ").append(getSeverityString(UnusedDeclaredThrownException)); //$NON-NLS-1$
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$
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$
965 .append("\n\t- produce reference info : ").append(this.produceReferenceInfo ? "ON" : "OFF"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
967 .append("\n\t- parse literal expressions as constants : ").append(this.parseLiteralExpressionsAsConstants ? "ON" : "OFF"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
969 .append("\n\t- encoding : ").append(this.defaultEncoding == null ? "<default>" : this.defaultEncoding); //$NON-NLS-1$ //$NON-NLS-2$
971 .append("\n\t- task tags: ").append(this.taskTags == null ? "" : new String(CharOperation.concatWith(this.taskTags, ','))); //$NON-NLS-1$ //$NON-NLS-2$
973 .append("\n\t- task priorities : ").append(this.taskPriorites == null ? "" : new String(CharOperation.concatWith(this.taskPriorites, ','))); //$NON-NLS-1$ //$NON-NLS-2$
975 .append("\n\t- report deprecation inside deprecated code : ").append(this.reportDeprecationInsideDeprecatedCode ? "ENABLED" : "DISABLED"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
978 "\n\t- report deprecation when overriding deprecated method : ").append(this.reportDeprecationWhenOverridingDeprecatedMethod ? "ENABLED" : "DISABLED"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
981 "\n\t- report unused parameter when implementing abstract method : ").append(this.reportUnusedParameterWhenImplementingAbstract ? "ENABLED" : "DISABLED"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
984 "\n\t- report unused parameter when overriding concrete method : ").append(this.reportUnusedParameterWhenOverridingConcrete ? "ENABLED" : "DISABLED"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
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();
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;
1003 // public static long versionToJdkLevel(Object versionID) {
1004 // if (VERSION_1_1.equals(versionID)) {
1006 // } else if (VERSION_1_2.equals(versionID)) {
1008 // } else if (VERSION_1_3.equals(versionID)) {
1010 // } else if (VERSION_1_4.equals(versionID)) {
1012 // } else if (VERSION_1_5.equals(versionID)) {
1015 // return 0; // unknown
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;
1030 // return ""; // unknown version //$NON-NLS-1$