X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/impl/CompilerOptions.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/impl/CompilerOptions.java index 5baf599..b729405 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/impl/CompilerOptions.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/impl/CompilerOptions.java @@ -17,6 +17,7 @@ import java.util.HashMap; import java.util.Map; import net.sourceforge.phpdt.core.compiler.CharOperation; +import net.sourceforge.phpdt.core.compiler.IProblem; import net.sourceforge.phpdt.internal.compiler.Compiler; import net.sourceforge.phpdt.internal.compiler.env.IConstants; import net.sourceforge.phpdt.internal.compiler.lookup.ProblemReasons; @@ -27,10 +28,18 @@ public class CompilerOptions implements ProblemReasons, ProblemSeverities, ICons /** * Option IDs */ - public static final String OPTION_LocalVariableAttribute = "net.sourceforge.phpeclipse.compiler.debug.localVariable"; //$NON-NLS-1$ + public static final String OPTION_PHPVarDeprecatedWarning = "net.sourceforge.phpeclipse.compiler.problem.phpVarDeprecatedWarning"; //$NON-NLS-1$ + public static final String OPTION_PHPBadStyleKeywordWarning = "net.sourceforge.phpeclipse.compiler.problem.phpBadStyleKeywordWarning"; //$NON-NLS-1$ + public static final String OPTION_PHPBadStyleUppercaseIdentifierWarning = "net.sourceforge.phpeclipse.compiler.problem.phpBadStyleUppercaseIdentifierWarning"; //$NON-NLS-1$ + public static final String OPTION_PHPIncludeNotExistWarning = "net.sourceforge.phpeclipse.compiler.problem.phpIncludeNotExistWarning"; //$NON-NLS-1$ + public static final String OPTION_UninitializedLocalVariableWarning = "net.sourceforge.phpeclipse.compiler.problem.uninitializedLocalVariableWarning"; //$NON-NLS-1$ + public static final String OPTION_CodeCannotBeReachedWarning = "net.sourceforge.phpeclipse.compiler.problem.codeCannotBeReachedWarning"; //$NON-NLS-1$ + + public static final String OPTION_LocalVariableAttribute = "net.sourceforge.phpeclipse.compiler.debug.localVariable"; //$NON-NLS-1$ public static final String OPTION_LineNumberAttribute = "net.sourceforge.phpeclipse.compiler.debug.lineNumber"; //$NON-NLS-1$ public static final String OPTION_SourceFileAttribute = "net.sourceforge.phpeclipse.compiler.debug.sourceFile"; //$NON-NLS-1$ // public static final String OPTION_PreserveUnusedLocal = "net.sourceforge.phpeclipse.compiler.codegen.unusedLocal"; //$NON-NLS-1$ + public static final String OPTION_DocCommentSupport= "net.sourceforge.phpeclipse.compiler.doc.comment.support"; //$NON-NLS-1$ public static final String OPTION_ReportMethodWithConstructorName = "net.sourceforge.phpeclipse.compiler.problem.methodWithConstructorName"; //$NON-NLS-1$ public static final String OPTION_ReportOverridingPackageDefaultMethod = "net.sourceforge.phpeclipse.compiler.problem.overridingPackageDefaultMethod"; //$NON-NLS-1$ public static final String OPTION_ReportDeprecation = "net.sourceforge.phpeclipse.compiler.problem.deprecation"; //$NON-NLS-1$ @@ -145,7 +154,14 @@ public class CompilerOptions implements ProblemReasons, ProblemSeverities, ICons public static final long UnqualifiedFieldAccess = 0x4000000000L; public static final long MissingJavadocTags = 0x8000000000L; public static final long MissingJavadocComments = 0x10000000000L; - + + + public static final long PHPVarDeprecatedWarning = 0x20000000000L; + public static final long PHPBadStyleKeywordWarning = 0x40000000000L; + public static final long PHPBadStyleUppercaseIdentifierWarning = 0x80000000000L; + public static final long PHPIncludeNotExistWarning = 0x100000000000L; + public static final long UninitializedLocalVariableWarning = 0x200000000000L; + public static final long CodeCannotBeReachedWarning = 0x400000000000L; // Default severity level for handlers public long errorThreshold = 0; @@ -160,7 +176,14 @@ public class CompilerOptions implements ProblemReasons, ProblemSeverities, ICons | IncompatibleNonInheritedInterfaceMethod | NoImplicitStringConversion | FinallyBlockNotCompleting - | AssertUsedAsAnIdentifier; + | AssertUsedAsAnIdentifier + | PHPVarDeprecatedWarning + | PHPBadStyleKeywordWarning + | PHPBadStyleUppercaseIdentifierWarning + | PHPIncludeNotExistWarning + | UninitializedLocalVariableWarning + | CodeCannotBeReachedWarning; + ; // Debug attributes public static final int Source = 1; // SourceFileAttribute @@ -226,6 +249,8 @@ public class CompilerOptions implements ProblemReasons, ProblemSeverities, ICons // check missing javadoc comments public int reportMissingJavadocCommentsVisibility = AccPublic; public boolean reportMissingJavadocCommentsOverriding = true; +// javadoc comment support + public boolean docCommentSupport = false; /** * Initializing the compiler options with defaults @@ -246,10 +271,18 @@ public class CompilerOptions implements ProblemReasons, ProblemSeverities, ICons public Map getMap() { Map optionsMap = new HashMap(30); + optionsMap.put(OPTION_PHPVarDeprecatedWarning, getSeverityString(PHPIncludeNotExistWarning)); + optionsMap.put(OPTION_PHPVarDeprecatedWarning, getSeverityString(PHPVarDeprecatedWarning)); + optionsMap.put(OPTION_PHPBadStyleKeywordWarning, getSeverityString(PHPBadStyleKeywordWarning)); + optionsMap.put(OPTION_PHPBadStyleUppercaseIdentifierWarning, getSeverityString(PHPBadStyleUppercaseIdentifierWarning)); + optionsMap.put(OPTION_UninitializedLocalVariableWarning, getSeverityString(UninitializedLocalVariableWarning)); + optionsMap.put(OPTION_CodeCannotBeReachedWarning, getSeverityString(CodeCannotBeReachedWarning)); + optionsMap.put(OPTION_LocalVariableAttribute, (this.produceDebugAttributes & Vars) != 0 ? GENERATE : DO_NOT_GENERATE); optionsMap.put(OPTION_LineNumberAttribute, (this.produceDebugAttributes & Lines) != 0 ? GENERATE : DO_NOT_GENERATE); optionsMap.put(OPTION_SourceFileAttribute, (this.produceDebugAttributes & Source) != 0 ? GENERATE : DO_NOT_GENERATE); // optionsMap.put(OPTION_PreserveUnusedLocal, this.preserveAllLocalVariables ? PRESERVE : OPTIMIZE_OUT); + optionsMap.put(OPTION_DocCommentSupport, this.docCommentSupport ? ENABLED : DISABLED); optionsMap.put(OPTION_ReportMethodWithConstructorName, getSeverityString(MethodWithConstructorName)); optionsMap.put(OPTION_ReportOverridingPackageDefaultMethod, getSeverityString(OverriddenPackageDefaultMethod)); optionsMap.put(OPTION_ReportDeprecation, getSeverityString(UsingDeprecatedAPI)); @@ -466,6 +499,13 @@ public class CompilerOptions implements ProblemReasons, ProblemSeverities, ICons } } } + if ((optionValue = optionsMap.get(OPTION_PHPVarDeprecatedWarning)) != null) updateSeverity(PHPVarDeprecatedWarning, optionValue); + if ((optionValue = optionsMap.get(OPTION_PHPBadStyleKeywordWarning)) != null) updateSeverity(PHPBadStyleKeywordWarning, optionValue); + if ((optionValue = optionsMap.get(OPTION_PHPBadStyleUppercaseIdentifierWarning)) != null) updateSeverity(PHPBadStyleUppercaseIdentifierWarning, optionValue); + if ((optionValue = optionsMap.get(OPTION_PHPIncludeNotExistWarning)) != null) updateSeverity(PHPIncludeNotExistWarning, optionValue); + if ((optionValue = optionsMap.get(OPTION_UninitializedLocalVariableWarning)) != null) updateSeverity(UninitializedLocalVariableWarning, optionValue); + if ((optionValue = optionsMap.get(OPTION_CodeCannotBeReachedWarning)) != null) updateSeverity(CodeCannotBeReachedWarning, optionValue); + if ((optionValue = optionsMap.get(OPTION_ReportMethodWithConstructorName)) != null) updateSeverity(MethodWithConstructorName, optionValue); if ((optionValue = optionsMap.get(OPTION_ReportOverridingPackageDefaultMethod)) != null) updateSeverity(OverriddenPackageDefaultMethod, optionValue); if ((optionValue = optionsMap.get(OPTION_ReportDeprecation)) != null) updateSeverity(UsingDeprecatedAPI, optionValue); @@ -493,6 +533,14 @@ public class CompilerOptions implements ProblemReasons, ProblemSeverities, ICons if ((optionValue = optionsMap.get(OPTION_ReportNoEffectAssignment)) != null) updateSeverity(NoEffectAssignment, optionValue); // Javadoc options +// Javadoc options + if ((optionValue = optionsMap.get(OPTION_DocCommentSupport)) != null) { + if (ENABLED.equals(optionValue)) { + this.docCommentSupport = true; + } else if (DISABLED.equals(optionValue)) { + this.docCommentSupport = false; + } + } if ((optionValue = optionsMap.get(OPTION_ReportInvalidJavadoc)) != null) { updateSeverity(InvalidJavadoc, optionValue); } @@ -565,6 +613,13 @@ public class CompilerOptions implements ProblemReasons, ProblemSeverities, ICons public String toString() { StringBuffer buf = new StringBuffer("CompilerOptions:"); //$NON-NLS-1$ + buf.append("\n\t- var is deprecated keyword: ").append(getSeverityString(PHPVarDeprecatedWarning)); //$NON-NLS-1$ + buf.append("\n\t- don't use keywords as identifiers: ").append(getSeverityString(PHPBadStyleKeywordWarning)); //$NON-NLS-1$ + buf.append("\n\t- non-variable idenifiers should contain only uppercase characters: ").append(getSeverityString(PHPBadStyleUppercaseIdentifierWarning)); //$NON-NLS-1$ + buf.append("\n\t- include filename doesn't exist in project: ").append(getSeverityString(PHPIncludeNotExistWarning)); //$NON-NLS-1$ + buf.append("\n\t- local variable not initialized: ").append(getSeverityString(UninitializedLocalVariableWarning)); //$NON-NLS-1$ + buf.append("\n\t- unreachable code: ").append(getSeverityString(CodeCannotBeReachedWarning)); //$NON-NLS-1$ + buf.append("\n\t- local variables debug attributes: ").append((this.produceDebugAttributes & Vars) != 0 ? "ON" : " OFF"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ buf.append("\n\t- line number debug attributes: ").append((this.produceDebugAttributes & Lines) != 0 ? "ON" : " OFF"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ buf.append("\n\t- source debug attributes: ").append((this.produceDebugAttributes & Source) != 0 ? "ON" : " OFF"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$