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 221127 Details for
Bug 375366
ECJ ignores unusedParameterIncludeDocCommentReference unless enableJavadoc option is set
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
proposed patch
clipboard.txt (text/plain), 9.18 KB, created by
Stephan Herrmann
on 2012-09-16 09:18:06 EDT
(
hide
)
Description:
proposed patch
Filename:
MIME Type:
Creator:
Stephan Herrmann
Created:
2012-09-16 09:18:06 EDT
Size:
9.18 KB
patch
obsolete
>diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java >index 5df2de4..91b69db 100644 >--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java >+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java >@@ -19,6 +19,7 @@ > * bug 370639 - [compiler][resource] restore the default for resource leak warnings > * bug 365859 - [compiler][null] distinguish warnings based on flow analysis vs. null annotations > * bug 374605 - Unreasonable warning for enum-based switch statements >+ * bug 375366 - ECJ ignores unusedParameterIncludeDocCommentReference unless enableJavadoc option is set > *******************************************************************************/ > package org.eclipse.jdt.core.tests.compiler.regression; > >@@ -81,7 +82,7 @@ > "}\n"; > > static { >-// TESTS_NAMES = new String[] { "testBug375409e" }; >+// TESTS_NAMES = new String[] { "testBug375366" }; > // TESTS_NUMBERS = new int[] { 306 }; > // TESTS_RANGE = new int[] { 298, -1 }; > } >@@ -13467,4 +13468,127 @@ > "", > true); > } >+// Bug 375366 - ECJ ignores unusedParameterIncludeDocCommentReference unless enableJavadoc option is set >+// when -properties is used process javadoc by default >+public void testBug375366a() throws IOException { >+ createOutputTestDirectory("regression/.settings"); >+ Util.createFile(OUTPUT_DIR+"/.settings/org.eclipse.jdt.core.prefs", >+ "eclipse.preferences.version=1\n" + >+ "org.eclipse.jdt.core.compiler.problem.unusedParameter=warning\n"); >+ this.runConformTest( >+ new String[] { >+ "bugs/warning/ShowBug.java", >+ "package bugs.warning;\n" + >+ "\n" + >+ "public class ShowBug {\n" + >+ " /**\n" + >+ " * \n" + >+ " * @param unusedParam\n" + >+ " */\n" + >+ " public void foo(Object unusedParam) {\n" + >+ " \n" + >+ " }\n" + >+ "}\n" >+ }, >+ "\"" + OUTPUT_DIR + File.separator + "bugs" + File.separator + "warning" + File.separator + "ShowBug.java\"" >+ + " -1.5" >+ + " -properties " + OUTPUT_DIR + File.separator +".settings" + File.separator + "org.eclipse.jdt.core.prefs " >+ + " -d \"" + OUTPUT_DIR + "\"", >+ "", >+ "", >+ false /*don't flush output dir*/); >+} >+ >+// Bug 375366 - ECJ ignores unusedParameterIncludeDocCommentReference unless enableJavadoc option is set >+// property file explicitly disables javadoc processing >+public void testBug375366b() throws IOException { >+ createOutputTestDirectory("regression/.settings"); >+ Util.createFile(OUTPUT_DIR+"/.settings/org.eclipse.jdt.core.prefs", >+ "eclipse.preferences.version=1\n" + >+ "org.eclipse.jdt.core.compiler.problem.unusedParameter=warning\n" + >+ "org.eclipse.jdt.core.compiler.doc.comment.support=disabled\n"); >+ this.runTest( >+ true, // compile OK, expecting only warning >+ new String[] { >+ "bugs/warning/ShowBug.java", >+ "package bugs.warning;\n" + >+ "\n" + >+ "public class ShowBug {\n" + >+ " /**\n" + >+ " * \n" + >+ " * @param unusedParam\n" + >+ " */\n" + >+ " public void foo(Object unusedParam) {\n" + >+ " \n" + >+ " }\n" + >+ "}\n" >+ }, >+ "\"" + OUTPUT_DIR + File.separator + "bugs" + File.separator + "warning" + File.separator + "ShowBug.java\"" >+ + " -1.5" >+ + " -properties " + OUTPUT_DIR + File.separator +".settings" + File.separator + "org.eclipse.jdt.core.prefs " >+ + " -d \"" + OUTPUT_DIR + "\"", >+ "", >+ "----------\n" + >+ "1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/bugs/warning/ShowBug.java (at line 8)\n" + >+ " public void foo(Object unusedParam) {\n" + >+ " ^^^^^^^^^^^\n" + >+ "The value of the parameter unusedParam is not used\n" + >+ "----------\n" + >+ "1 problem (1 warning)", >+ false /*don't flush output dir*/, >+ null /* progress */); >+} >+ >+// Bug 375366 - ECJ ignores unusedParameterIncludeDocCommentReference unless enableJavadoc option is set >+// property file enables null annotation support >+public void testBug375366c() throws IOException { >+ createOutputTestDirectory("regression/.settings"); >+ Util.createFile(OUTPUT_DIR+"/.settings/org.eclipse.jdt.core.prefs", >+ "eclipse.preferences.version=1\n" + >+ "org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled\n"); >+ this.runNegativeTest( >+ new String[] { >+ "p/X.java", >+ "package p;\n" + >+ "import org.eclipse.jdt.annotation.*;\n" + >+ "public class X {\n" + >+ " @NonNull Object foo(@Nullable Object o, @NonNull Object o2) {\n" + >+ " return this;\n" + >+ " }\n" + >+ "}\n" + >+ "class Y extends X {\n" + >+ " @Nullable Object foo(Object o, Object o2) { return null; }\n" + >+ "}\n", >+ "org/eclipse/jdt/annotation/NonNull.java", >+ NONNULL_ANNOTATION_CONTENT, >+ "org/eclipse/jdt/annotation/Nullable.java", >+ NULLABLE_ANNOTATION_CONTENT, >+ "org/eclipse/jdt/annotation/NonNullByDefault.java", >+ NONNULL_BY_DEFAULT_ANNOTATION_CONTENT >+ }, >+ "\"" + OUTPUT_DIR + File.separator + "p" + File.separator + "X.java\"" >+ + " -sourcepath \"" + OUTPUT_DIR + "\"" >+ + " -1.5" >+ + " -properties " + OUTPUT_DIR + File.separator +".settings" + File.separator + "org.eclipse.jdt.core.prefs " >+ + " -d \"" + OUTPUT_DIR + "\"", >+ "", >+ "----------\n" + >+ "1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/p/X.java (at line 9)\n" + >+ " @Nullable Object foo(Object o, Object o2) { return null; }\n" + >+ " ^^^^^^^^^^^^^^^^\n" + >+ "The return type is incompatible with the @NonNull return from X.foo(Object, Object)\n" + >+ "----------\n" + >+ "2. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/p/X.java (at line 9)\n" + >+ " @Nullable Object foo(Object o, Object o2) { return null; }\n" + >+ " ^^^^^^\n" + >+ "Missing nullable annotation: inherited method from X declares this parameter as @Nullable\n" + >+ "----------\n" + >+ "3. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/p/X.java (at line 9)\n" + >+ " @Nullable Object foo(Object o, Object o2) { return null; }\n" + >+ " ^^^^^^\n" + >+ "Missing non-null annotation: inherited method from X declares this parameter as @NonNull\n" + >+ "----------\n" + >+ "3 problems (3 errors)", >+ false/*don't flush*/); >+} > } >diff --git a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java >index 46bba1b..308dc97 100644 >--- a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java >+++ b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/Main.java >@@ -16,6 +16,7 @@ > * bug 359721 - [options] add command line option for new warning token "resource" > * bug 365208 - [compiler][batch] command line options for annotation based null analysis > * bug 374605 - Unreasonable warning for enum-based switch statements >+ * bug 375366 - ECJ ignores unusedParameterIncludeDocCommentReference unless enableJavadoc option is set > *******************************************************************************/ > package org.eclipse.jdt.internal.compiler.batch; > >@@ -2858,10 +2859,23 @@ > for (Iterator iterator = properties.entrySet().iterator(); iterator.hasNext(); ) { > Map.Entry entry = (Map.Entry) iterator.next(); > final String key = (String) entry.getKey(); >- if (key.startsWith("org.eclipse.jdt.core.compiler.problem")) { //$NON-NLS-1$ >+ if (key.startsWith("org.eclipse.jdt.core.compiler.")) { //$NON-NLS-1$ > this.options.put(key, entry.getValue()); > } > } >+ // when using a properties file mimic relevant defaults from JavaCorePreferenceInitializer: >+ if (!properties.containsKey(CompilerOptions.OPTION_LocalVariableAttribute)) { >+ this.options.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.GENERATE); >+ } >+ if (!properties.containsKey(CompilerOptions.OPTION_PreserveUnusedLocal)) { >+ this.options.put(CompilerOptions.OPTION_PreserveUnusedLocal, CompilerOptions.PRESERVE); >+ } >+ if (!properties.containsKey(CompilerOptions.OPTION_DocCommentSupport)) { >+ this.options.put(CompilerOptions.OPTION_DocCommentSupport, CompilerOptions.ENABLED); >+ } >+ if (!properties.containsKey(CompilerOptions.OPTION_ReportForbiddenReference)) { >+ this.options.put(CompilerOptions.OPTION_ReportForbiddenReference, CompilerOptions.ERROR); >+ } > } > protected void enableAll(int severity) { > String newValue = null; >diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaCorePreferenceInitializer.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaCorePreferenceInitializer.java >index 91c6dde..fb926c3 100644 >--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaCorePreferenceInitializer.java >+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaCorePreferenceInitializer.java >@@ -29,6 +29,7 @@ > */ > public void initializeDefaultPreferences() { > // If modified, also modify the method JavaModelManager#getDefaultOptionsNoInitialization() >+ // and also consider updating org.eclipse.jdt.internal.compiler.batch.Main#initializeWarnings(String) > // Get options names set > HashSet optionNames = JavaModelManager.getJavaModelManager().optionNames; >
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 375366
:
213202
| 221127