Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 63752 Details for
Bug 118217
Compiler error/warning option 'Parameter is never read' produces a lot of false-positives
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Better patch3
118217.txt (text/plain), 27.93 KB, created by
Philipe Mulet
on 2007-04-13 10:21:18 EDT
(
hide
)
Description:
Better patch3
Filename:
MIME Type:
Creator:
Philipe Mulet
Created:
2007-04-13 10:21:18 EDT
Size:
27.93 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/LocalVariableTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/LocalVariableTest.java,v >retrieving revision 1.13 >diff -u -r1.13 LocalVariableTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/LocalVariableTest.java 6 Mar 2007 04:42:12 -0000 1.13 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/LocalVariableTest.java 13 Apr 2007 14:20:26 -0000 >@@ -357,6 +357,336 @@ > options, > null); > } >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=118217 >+public void test016() { >+ Map options = getCompilerOptions(); >+ options.put(CompilerOptions.OPTION_DocCommentSupport, CompilerOptions.ENABLED); >+ options.put(CompilerOptions.OPTION_ReportUnusedParameter, CompilerOptions.ERROR); >+ options.put(CompilerOptions.OPTION_ReportUnusedParameterIncludeDocCommentReference, CompilerOptions.ENABLED); >+ options.put(CompilerOptions.OPTION_ReportUnusedParameterWhenOverridingConcrete, CompilerOptions.DISABLED); >+ options.put(CompilerOptions.OPTION_ReportUnusedParameterWhenImplementingAbstract, CompilerOptions.DISABLED); >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X extends Parent implements Doable {\n" + >+ " /**\n" + >+ " * @param value\n" + >+ " */\n" + >+ " void foo(int value) { // X#foo(...)\n" + >+ " }\n" + >+ " void bar(int value) { // X#bar(...)\n" + >+ " }\n" + >+ "\n" + >+ " void top(int value) { /* X#top(...)*/}\n" + >+ " void parent(int value) { /* X#parent(...) */}\n" + >+ " public void doit(int value) { /* X#doit(...) */}\n" + >+ "}\n" + >+ "abstract class Top {\n" + >+ " /**\n" + >+ " * @param value\n" + >+ " */\n" + >+ " abstract void top(int value); // Top#top(...)\n" + >+ "}\n" + >+ "abstract class Parent extends Top {\n" + >+ " /**\n" + >+ " * @param value\n" + >+ " */\n" + >+ " void parent(int value) { /* Parent#parent(...) */}\n" + >+ "}\n" + >+ "interface Doable {\n" + >+ " /**\n" + >+ " * @param value\n" + >+ " */\n" + >+ " void doit (int value); // Doable#doit(...)\n" + >+ "}", // ================= >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 7)\n" + >+ " void bar(int value) { // X#bar(...)\n" + >+ " ^^^^^\n" + >+ "The parameter value is never read\n" + >+ "----------\n", >+ null /* classLib */, >+ true /* shouldFlushOutputDirectory */, >+ options); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=118217 - variation >+public void test017() { >+ Map options = getCompilerOptions(); >+ options.put(CompilerOptions.OPTION_DocCommentSupport, CompilerOptions.DISABLED); >+ options.put(CompilerOptions.OPTION_ReportUnusedParameter, CompilerOptions.ERROR); >+ options.put(CompilerOptions.OPTION_ReportUnusedParameterIncludeDocCommentReference, CompilerOptions.ENABLED); >+ options.put(CompilerOptions.OPTION_ReportUnusedParameterWhenOverridingConcrete, CompilerOptions.DISABLED); >+ options.put(CompilerOptions.OPTION_ReportUnusedParameterWhenImplementingAbstract, CompilerOptions.DISABLED); >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X extends Parent implements Doable {\n" + >+ " /**\n" + >+ " * @param value\n" + >+ " */\n" + >+ " void foo(int value) { // X#foo(...)\n" + >+ " }\n" + >+ " void bar(int value) { // X#bar(...)\n" + >+ " }\n" + >+ "\n" + >+ " void top(int value) { /* X#top(...)*/}\n" + >+ " void parent(int value) { /* X#parent(...) */}\n" + >+ " public void doit(int value) { /* X#doit(...) */}\n" + >+ "}\n" + >+ "abstract class Top {\n" + >+ " /**\n" + >+ " * @param value\n" + >+ " */\n" + >+ " abstract void top(int value); // Top#top(...)\n" + >+ "}\n" + >+ "abstract class Parent extends Top {\n" + >+ " /**\n" + >+ " * @param value\n" + >+ " */\n" + >+ " void parent(int value) { /* Parent#parent(...) */}\n" + >+ "}\n" + >+ "interface Doable {\n" + >+ " /**\n" + >+ " * @param value\n" + >+ " */\n" + >+ " void doit (int value); // Doable#doit(...)\n" + >+ "}", // ================= >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 5)\n" + >+ " void foo(int value) { // X#foo(...)\n" + >+ " ^^^^^\n" + >+ "The parameter value is never read\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 7)\n" + >+ " void bar(int value) { // X#bar(...)\n" + >+ " ^^^^^\n" + >+ "The parameter value is never read\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 24)\n" + >+ " void parent(int value) { /* Parent#parent(...) */}\n" + >+ " ^^^^^\n" + >+ "The parameter value is never read\n" + >+ "----------\n", >+ null /* classLib */, >+ true /* shouldFlushOutputDirectory */, >+ options); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=118217 - variation >+public void test018() { >+ Map options = getCompilerOptions(); >+ options.put(CompilerOptions.OPTION_DocCommentSupport, CompilerOptions.ENABLED); >+ options.put(CompilerOptions.OPTION_ReportUnusedParameter, CompilerOptions.ERROR); >+ options.put(CompilerOptions.OPTION_ReportUnusedParameterIncludeDocCommentReference, CompilerOptions.DISABLED); >+ options.put(CompilerOptions.OPTION_ReportUnusedParameterWhenOverridingConcrete, CompilerOptions.DISABLED); >+ options.put(CompilerOptions.OPTION_ReportUnusedParameterWhenImplementingAbstract, CompilerOptions.DISABLED); >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X extends Parent implements Doable {\n" + >+ " /**\n" + >+ " * @param value\n" + >+ " */\n" + >+ " void foo(int value) { // X#foo(...)\n" + >+ " }\n" + >+ " void bar(int value) { // X#bar(...)\n" + >+ " }\n" + >+ "\n" + >+ " void top(int value) { /* X#top(...)*/}\n" + >+ " void parent(int value) { /* X#parent(...) */}\n" + >+ " public void doit(int value) { /* X#doit(...) */}\n" + >+ "}\n" + >+ "abstract class Top {\n" + >+ " /**\n" + >+ " * @param value\n" + >+ " */\n" + >+ " abstract void top(int value); // Top#top(...)\n" + >+ "}\n" + >+ "abstract class Parent extends Top {\n" + >+ " /**\n" + >+ " * @param value\n" + >+ " */\n" + >+ " void parent(int value) { /* Parent#parent(...) */}\n" + >+ "}\n" + >+ "interface Doable {\n" + >+ " /**\n" + >+ " * @param value\n" + >+ " */\n" + >+ " void doit (int value); // Doable#doit(...)\n" + >+ "}", // ================= >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 5)\n" + >+ " void foo(int value) { // X#foo(...)\n" + >+ " ^^^^^\n" + >+ "The parameter value is never read\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 7)\n" + >+ " void bar(int value) { // X#bar(...)\n" + >+ " ^^^^^\n" + >+ "The parameter value is never read\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 24)\n" + >+ " void parent(int value) { /* Parent#parent(...) */}\n" + >+ " ^^^^^\n" + >+ "The parameter value is never read\n" + >+ "----------\n", >+ null /* classLib */, >+ true /* shouldFlushOutputDirectory */, >+ options); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=118217 - variation >+public void test019() { >+ Map options = getCompilerOptions(); >+ options.put(CompilerOptions.OPTION_DocCommentSupport, CompilerOptions.ENABLED); >+ options.put(CompilerOptions.OPTION_ReportUnusedParameter, CompilerOptions.ERROR); >+ options.put(CompilerOptions.OPTION_ReportUnusedParameterIncludeDocCommentReference, CompilerOptions.DISABLED); >+ options.put(CompilerOptions.OPTION_ReportUnusedParameterWhenOverridingConcrete, CompilerOptions.ENABLED); >+ options.put(CompilerOptions.OPTION_ReportUnusedParameterWhenImplementingAbstract, CompilerOptions.ENABLED); >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X extends Parent implements Doable {\n" + >+ " /**\n" + >+ " * @param value\n" + >+ " */\n" + >+ " void foo(int value) { // X#foo(...)\n" + >+ " }\n" + >+ " void bar(int value) { // X#bar(...)\n" + >+ " }\n" + >+ "\n" + >+ " void top(int value) { /* X#top(...)*/}\n" + >+ " void parent(int value) { /* X#parent(...) */}\n" + >+ " public void doit(int value) { /* X#doit(...) */}\n" + >+ "}\n" + >+ "abstract class Top {\n" + >+ " /**\n" + >+ " * @param value\n" + >+ " */\n" + >+ " abstract void top(int value); // Top#top(...)\n" + >+ "}\n" + >+ "abstract class Parent extends Top {\n" + >+ " /**\n" + >+ " * @param value\n" + >+ " */\n" + >+ " void parent(int value) { /* Parent#parent(...) */}\n" + >+ "}\n" + >+ "interface Doable {\n" + >+ " /**\n" + >+ " * @param value\n" + >+ " */\n" + >+ " void doit (int value); // Doable#doit(...)\n" + >+ "}", // ================= >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 5)\n" + >+ " void foo(int value) { // X#foo(...)\n" + >+ " ^^^^^\n" + >+ "The parameter value is never read\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 7)\n" + >+ " void bar(int value) { // X#bar(...)\n" + >+ " ^^^^^\n" + >+ "The parameter value is never read\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 10)\n" + >+ " void top(int value) { /* X#top(...)*/}\n" + >+ " ^^^^^\n" + >+ "The parameter value is never read\n" + >+ "----------\n" + >+ "4. ERROR in X.java (at line 11)\n" + >+ " void parent(int value) { /* X#parent(...) */}\n" + >+ " ^^^^^\n" + >+ "The parameter value is never read\n" + >+ "----------\n" + >+ "5. ERROR in X.java (at line 12)\n" + >+ " public void doit(int value) { /* X#doit(...) */}\n" + >+ " ^^^^^\n" + >+ "The parameter value is never read\n" + >+ "----------\n" + >+ "6. ERROR in X.java (at line 24)\n" + >+ " void parent(int value) { /* Parent#parent(...) */}\n" + >+ " ^^^^^\n" + >+ "The parameter value is never read\n" + >+ "----------\n", >+ null /* classLib */, >+ true /* shouldFlushOutputDirectory */, >+ options); >+} >+//https://bugs.eclipse.org/bugs/show_bug.cgi?id=118217 - variation >+public void test020() { >+ Map options = getCompilerOptions(); >+ options.put(CompilerOptions.OPTION_DocCommentSupport, CompilerOptions.ENABLED); >+ options.put(CompilerOptions.OPTION_ReportUnusedParameter, CompilerOptions.ERROR); >+ options.put(CompilerOptions.OPTION_ReportUnusedParameterIncludeDocCommentReference, CompilerOptions.DISABLED); >+ options.put(CompilerOptions.OPTION_ReportUnusedParameterWhenOverridingConcrete, CompilerOptions.ENABLED); >+ options.put(CompilerOptions.OPTION_ReportUnusedParameterWhenImplementingAbstract, CompilerOptions.ENABLED); >+ this.runNegativeTest( >+ new String[] { >+ "X.java", >+ "public class X extends Parent implements Doable {\n" + >+ " /** @param value */\n" + >+ " void foo(int value) { // X#foo(...)\n" + >+ " }\n" + >+ " void bar(int value) { // X#bar(...)\n" + >+ " }\n" + >+ "\n" + >+ " /** @param value */\n" + >+ " void top(int value) { /* X#top(...)*/}\n" + >+ " /** @param value */\n" + >+ " void parent(int value) { /* X#parent(...) */}\n" + >+ " /** @param value */\n" + >+ " public void doit(int value) { /* X#doit(...) */}\n" + >+ "}\n" + >+ "abstract class Top {\n" + >+ " /** @param value */\n" + >+ " abstract void top(int value); // Top#top(...)\n" + >+ "}\n" + >+ "abstract class Parent extends Top {\n" + >+ " /** @param value */\n" + >+ " void parent(int value) { /* Parent#parent(...) */}\n" + >+ "}\n" + >+ "interface Doable {\n" + >+ " /** @param value */\n" + >+ " void doit (int value); // Doable#doit(...)\n" + >+ "}", // ================= >+ }, >+ "----------\n" + >+ "1. ERROR in X.java (at line 3)\n" + >+ " void foo(int value) { // X#foo(...)\n" + >+ " ^^^^^\n" + >+ "The parameter value is never read\n" + >+ "----------\n" + >+ "2. ERROR in X.java (at line 5)\n" + >+ " void bar(int value) { // X#bar(...)\n" + >+ " ^^^^^\n" + >+ "The parameter value is never read\n" + >+ "----------\n" + >+ "3. ERROR in X.java (at line 9)\n" + >+ " void top(int value) { /* X#top(...)*/}\n" + >+ " ^^^^^\n" + >+ "The parameter value is never read\n" + >+ "----------\n" + >+ "4. ERROR in X.java (at line 11)\n" + >+ " void parent(int value) { /* X#parent(...) */}\n" + >+ " ^^^^^\n" + >+ "The parameter value is never read\n" + >+ "----------\n" + >+ "5. ERROR in X.java (at line 13)\n" + >+ " public void doit(int value) { /* X#doit(...) */}\n" + >+ " ^^^^^\n" + >+ "The parameter value is never read\n" + >+ "----------\n" + >+ "6. ERROR in X.java (at line 21)\n" + >+ " void parent(int value) { /* Parent#parent(...) */}\n" + >+ " ^^^^^\n" + >+ "The parameter value is never read\n" + >+ "----------\n", >+ null /* classLib */, >+ true /* shouldFlushOutputDirectory */, >+ options); >+} > public static Class testClass() { > return LocalVariableTest.class; > } >Index: src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java,v >retrieving revision 1.110 >diff -u -r1.110 BatchCompilerTest.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 5 Apr 2007 13:14:36 -0000 1.110 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java 13 Apr 2007 14:20:26 -0000 >@@ -1283,6 +1283,7 @@ > " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedLabel\" value=\"warning\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedLocal\" value=\"warning\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedParameter\" value=\"ignore\"/>\n" + >+ " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference\" value=\"enabled\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract\" value=\"disabled\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete\" value=\"disabled\"/>\n" + > " <option key=\"org.eclipse.jdt.core.compiler.problem.unusedPrivateMember\" value=\"warning\"/>\n" + >#P org.eclipse.jdt.core >Index: compiler/org/eclipse/jdt/internal/compiler/ast/JavadocSingleNameReference.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/JavadocSingleNameReference.java,v >retrieving revision 1.10 >diff -u -r1.10 JavadocSingleNameReference.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/JavadocSingleNameReference.java 13 Oct 2006 19:20:45 -0000 1.10 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/JavadocSingleNameReference.java 13 Apr 2007 14:20:28 -0000 >@@ -25,17 +25,20 @@ > } > > public void resolve(BlockScope scope) { >- resolve(scope, true); >+ resolve(scope, true, scope.compilerOptions().reportUnusedParameterIncludeDocCommentReference); > } > > /** > * Resolve without warnings > */ >- public void resolve(BlockScope scope, boolean warn) { >+ public void resolve(BlockScope scope, boolean warn, boolean considerParamRefAsUsage) { > > LocalVariableBinding variableBinding = scope.findVariable(this.token); > if (variableBinding != null && variableBinding.isValidBinding() && ((variableBinding.tagBits & TagBits.IsArgument) != 0)) { > this.binding = variableBinding; >+ if (considerParamRefAsUsage) { >+ variableBinding.useFlag = LocalVariableBinding.USED; >+ } > return; > } > if (warn) { >Index: compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java,v >retrieving revision 1.54 >diff -u -r1.54 Javadoc.java >--- compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java 16 Mar 2007 18:28:59 -0000 1.54 >+++ compiler/org/eclipse/jdt/internal/compiler/ast/Javadoc.java 13 Apr 2007 14:20:28 -0000 >@@ -309,7 +309,8 @@ > } > > // @param tags >- resolveParamTags(methScope, reportMissing); >+ boolean considerParamRefAsUsage = methScope.compilerOptions().reportUnusedParameterIncludeDocCommentReference; >+ resolveParamTags(methScope, reportMissing, considerParamRefAsUsage); > resolveTypeParameterTags(methScope, reportMissing); > > // @return tags >@@ -339,7 +340,7 @@ > // Resolve param tags with invalid syntax > int length = this.invalidParameters == null ? 0 : this.invalidParameters.length; > for (int i = 0; i < length; i++) { >- this.invalidParameters[i].resolve(methScope, false); >+ this.invalidParameters[i].resolve(methScope, false, false); > } > } > >@@ -445,26 +446,26 @@ > /* > * Resolve @param tags while method scope > */ >- private void resolveParamTags(MethodScope methScope, boolean reportMissing) { >- AbstractMethodDeclaration md = methScope.referenceMethod(); >+ private void resolveParamTags(MethodScope scope, boolean reportMissing, boolean considerParamRefAsUsage) { >+ AbstractMethodDeclaration methodDecl = scope.referenceMethod(); > int paramTagsSize = this.paramReferences == null ? 0 : this.paramReferences.length; > > // If no referenced method (field initializer for example) then report a problem for each param tag >- if (md == null) { >+ if (methodDecl == null) { > for (int i = 0; i < paramTagsSize; i++) { > JavadocSingleNameReference param = this.paramReferences[i]; >- methScope.problemReporter().javadocUnexpectedTag(param.tagSourceStart, param.tagSourceEnd); >+ scope.problemReporter().javadocUnexpectedTag(param.tagSourceStart, param.tagSourceEnd); > } > return; > } > > // If no param tags then report a problem for each method argument >- int argumentsSize = md.arguments == null ? 0 : md.arguments.length; >+ int argumentsSize = methodDecl.arguments == null ? 0 : methodDecl.arguments.length; > if (paramTagsSize == 0) { > if (reportMissing) { > for (int i = 0; i < argumentsSize; i++) { >- Argument arg = md.arguments[i]; >- methScope.problemReporter().javadocMissingParamTag(arg.name, arg.sourceStart, arg.sourceEnd, md.binding.modifiers); >+ Argument arg = methodDecl.arguments[i]; >+ scope.problemReporter().javadocMissingParamTag(arg.name, arg.sourceStart, arg.sourceEnd, methodDecl.binding.modifiers); > } > } > } else { >@@ -474,13 +475,13 @@ > // Scan all @param tags > for (int i = 0; i < paramTagsSize; i++) { > JavadocSingleNameReference param = this.paramReferences[i]; >- param.resolve(methScope); >+ param.resolve(scope, true, considerParamRefAsUsage); > if (param.binding != null && param.binding.isValidBinding()) { > // Verify duplicated tags > boolean found = false; > for (int j = 0; j < maxBindings && !found; j++) { > if (bindings[j] == param.binding) { >- methScope.problemReporter().javadocDuplicatedParamTag(param.token, param.sourceStart, param.sourceEnd, md.binding.modifiers); >+ scope.problemReporter().javadocDuplicatedParamTag(param.token, param.sourceStart, param.sourceEnd, methodDecl.binding.modifiers); > found = true; > } > } >@@ -493,7 +494,7 @@ > // Look for undocumented arguments > if (reportMissing) { > for (int i = 0; i < argumentsSize; i++) { >- Argument arg = md.arguments[i]; >+ Argument arg = methodDecl.arguments[i]; > boolean found = false; > for (int j = 0; j < maxBindings && !found; j++) { > LocalVariableBinding binding = bindings[j]; >@@ -502,7 +503,7 @@ > } > } > if (!found) { >- methScope.problemReporter().javadocMissingParamTag(arg.name, arg.sourceStart, arg.sourceEnd, md.binding.modifiers); >+ scope.problemReporter().javadocMissingParamTag(arg.name, arg.sourceStart, arg.sourceEnd, methodDecl.binding.modifiers); > } > } > } >Index: model/org/eclipse/jdt/core/JavaCore.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java,v >retrieving revision 1.571 >diff -u -r1.571 JavaCore.java >--- model/org/eclipse/jdt/core/JavaCore.java 26 Mar 2007 17:03:13 -0000 1.571 >+++ model/org/eclipse/jdt/core/JavaCore.java 13 Apr 2007 14:20:30 -0000 >@@ -66,6 +66,8 @@ > * IBM Corporation - added the following constants: > * COMPILER_PB_POTENTIAL_NULL_REFERENCE > * COMPILER_PB_REDUNDANT_NULL_CHECK >+ * IBM Corporation - added the following constants: >+ * COMPILER_PB_UNUSED_PARAMETER_INCLUDE_DOC_COMMENT_REFERENCE > *******************************************************************************/ > package org.eclipse.jdt.core; > >@@ -287,6 +289,12 @@ > /** > * Possible configurable option ID. > * @see #getDefaultOptions() >+ * @since 3.3 >+ */ >+ public static final String COMPILER_PB_UNUSED_PARAMETER_INCLUDE_DOC_COMMENT_REFERENCE = PLUGIN_ID + ".compiler.problem.unusedParameterIncludeDocCommentReference"; //$NON-NLS-1$ >+ /** >+ * Possible configurable option ID. >+ * @see #getDefaultOptions() > * @since 2.0 > */ > public static final String COMPILER_PB_UNUSED_IMPORT = PLUGIN_ID + ".compiler.problem.unusedImport"; //$NON-NLS-1$ >@@ -1998,6 +2006,16 @@ > * - possible values: { "enabled", "disabled" } > * - default: "disabled" > * >+ * COMPILER / Consider Reference in Doc Comment for Unused Parameter Check >+ * When enabled, the compiler will consider doc comment references to parameters (i.e. @param clauses) for the unused >+ * parameter check. Thus, documented parameters will be considered as mandated as per doc contract. >+ * The severity of the unused parameter problem is controlled with option "org.eclipse.jdt.core.compiler.problem.unusedParameter". >+ * Note: this option has no effect until the doc comment support is enabled according to the >+ * option "org.eclipse.jdt.core.compiler.doc.comment.support". >+ * - option id: "org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocReference" >+ * - possible values: { "enabled", "disabled" } >+ * - default: "enabled" >+ * > * COMPILER / Reporting Unused Import > * When enabled, the compiler will issue an error or a warning for unused import > * reference >Index: compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java,v >retrieving revision 1.181 >diff -u -r1.181 CompilerOptions.java >--- compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java 12 Apr 2007 18:46:20 -0000 1.181 >+++ compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java 13 Apr 2007 14:20:28 -0000 >@@ -44,6 +44,7 @@ > public static final String OPTION_ReportUnusedParameter = "org.eclipse.jdt.core.compiler.problem.unusedParameter"; //$NON-NLS-1$ > public static final String OPTION_ReportUnusedParameterWhenImplementingAbstract = "org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract"; //$NON-NLS-1$ > public static final String OPTION_ReportUnusedParameterWhenOverridingConcrete = "org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete"; //$NON-NLS-1$ >+ public static final String OPTION_ReportUnusedParameterIncludeDocCommentReference = "org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference"; //$NON-NLS-1$ > public static final String OPTION_ReportUnusedImport = "org.eclipse.jdt.core.compiler.problem.unusedImport"; //$NON-NLS-1$ > public static final String OPTION_ReportSyntheticAccessEmulation = "org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation"; //$NON-NLS-1$ > public static final String OPTION_ReportNoEffectAssignment = "org.eclipse.jdt.core.compiler.problem.noEffectAssignment"; //$NON-NLS-1$ >@@ -270,6 +271,7 @@ > // unused parameters report > public boolean reportUnusedParameterWhenImplementingAbstract = false; > public boolean reportUnusedParameterWhenOverridingConcrete = false; >+ public boolean reportUnusedParameterIncludeDocCommentReference = true; > > // unused declaration of thrown exception > public boolean reportUnusedDeclaredThrownExceptionWhenOverriding = false; >@@ -418,6 +420,7 @@ > optionsMap.put(OPTION_TaskCaseSensitive, this.isTaskCaseSensitive ? ENABLED : DISABLED); > optionsMap.put(OPTION_ReportUnusedParameterWhenImplementingAbstract, this.reportUnusedParameterWhenImplementingAbstract ? ENABLED : DISABLED); > optionsMap.put(OPTION_ReportUnusedParameterWhenOverridingConcrete, this.reportUnusedParameterWhenOverridingConcrete ? ENABLED : DISABLED); >+ optionsMap.put(OPTION_ReportUnusedParameterIncludeDocCommentReference, this.reportUnusedParameterIncludeDocCommentReference ? ENABLED : DISABLED); > optionsMap.put(OPTION_ReportSpecialParameterHidingField, this.reportSpecialParameterHidingField ? ENABLED : DISABLED); > optionsMap.put(OPTION_MaxProblemPerUnit, String.valueOf(this.maxProblemsPerUnit)); > optionsMap.put(OPTION_InlineJsr, this.inlineJsrBytecode ? ENABLED : DISABLED); >@@ -697,6 +700,13 @@ > this.reportUnusedParameterWhenOverridingConcrete = false; > } > } >+ if ((optionValue = optionsMap.get(OPTION_ReportUnusedParameterIncludeDocCommentReference)) != null) { >+ if (ENABLED.equals(optionValue)) { >+ this.reportUnusedParameterIncludeDocCommentReference = true; >+ } else if (DISABLED.equals(optionValue)) { >+ this.reportUnusedParameterIncludeDocCommentReference = false; >+ } >+ } > if ((optionValue = optionsMap.get(OPTION_ReportSpecialParameterHidingField)) != null) { > if (ENABLED.equals(optionValue)) { > this.reportSpecialParameterHidingField = true; >@@ -909,10 +919,10 @@ > if ((optionValue = optionsMap.get(OPTION_Process_Annotations)) != null) { > if (ENABLED.equals(optionValue)) { > this.processAnnotations = true; >- // annotation processing requires annotation to be stored >- this.storeAnnotations = true; >+ this.storeAnnotations = true; // annotation processing requires annotation to be stored > } else if (DISABLED.equals(optionValue)) { > this.processAnnotations = false; >+ this.storeAnnotations = false; > } > } > } >@@ -974,6 +984,7 @@ > buf.append("\n\t- report deprecation when overriding deprecated method : ").append(this.reportDeprecationWhenOverridingDeprecatedMethod ? ENABLED : DISABLED); //$NON-NLS-1$ > buf.append("\n\t- report unused parameter when implementing abstract method : ").append(this.reportUnusedParameterWhenImplementingAbstract ? ENABLED : DISABLED); //$NON-NLS-1$ > buf.append("\n\t- report unused parameter when overriding concrete method : ").append(this.reportUnusedParameterWhenOverridingConcrete ? ENABLED : DISABLED); //$NON-NLS-1$ >+ buf.append("\n\t- report unused parameter include doc comment reference : ").append(this.reportUnusedParameterIncludeDocCommentReference ? ENABLED : DISABLED); //$NON-NLS-1$ > buf.append("\n\t- report constructor/setter parameter hiding existing field : ").append(this.reportSpecialParameterHidingField ? ENABLED : DISABLED); //$NON-NLS-1$ > buf.append("\n\t- inline JSR bytecode : ").append(this.inlineJsrBytecode ? ENABLED : DISABLED); //$NON-NLS-1$ > buf.append("\n\t- unsafe type operation: ").append(getSeverityString(UncheckedTypeOperation)); //$NON-NLS-1$
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 118217
:
63604
|
63607
|
63623
| 63752