| Summary: | ECJ ignores unusedParameterIncludeDocCommentReference unless enableJavadoc option is set | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Victor Lewis <victor> | ||||||
| Component: | Core | Assignee: | Stephan Herrmann <stephan.herrmann> | ||||||
| Status: | VERIFIED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | jal, jarthana, Olivier_Thomann, satyam.kandula, srikanth_sankaran, stephan.herrmann | ||||||
| Version: | 3.7.1 | Flags: | srikanth_sankaran:
review+
|
||||||
| Target Milestone: | 4.3 M3 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows 7 | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
Created attachment 213202 [details]
Archived Eclipse Project Demonstrating Bug
Actually this option works only if javadoc processing is turned on. Passing -enableJavadoc in the command line does fix the issue. Satyam's suggestion works for me. I will downgrade the priority and change the description of this bug and leave it to the Eclipse community to decide whether this is working as designed or not. Seems to me that if ask for exceptions to Error/Warning settings that require javadoc processing then you should turn that on form me. I would be tempted to say that if the option is set using a properties file, -enableJavadoc should be enabled by default if options are used to process javadoc contents. So when we process the properties file, we could enable the javadoc processing if any of the javadoc options are enabled. (In reply to comment #4) > I would be tempted to say that if the option is set using a properties file, > -enableJavadoc should be enabled by default if options are used to process > javadoc contents. > So when we process the properties file, we could enable the javadoc processing > if any of the javadoc options are enabled. I agree. Ayush, Can you take care of this? *** Bug 382012 has been marked as a duplicate of this bug. *** IMHO, the bug is that org.eclipse.compiler.doc.comment.support is not interpreted when passing "-properties <file>" on the command line. Isn't that why -enableJavadoc is needed, too? In a related bug it was discussed to simple let more compiler preferences pass, like all "org.eclipse.jdt.compiler.*" preferences (instead of only "org.eclipse.jdt.compiler.problem.*"). Doing so would have the nice side effect that also null annotations can be enabled using -properites :) (which currently is not possible). I've pushed a proposed solution to https://git.eclipse.org/r/#/c/7421/ In addition to widening the filter in org.eclipse.jdt.internal.compiler.batch.Main.initializeWarnings(String) I also changed how absent properties are handled: - IF a property file is used, AND - IF any of these properties is missing: - org.eclipse.jdt.core.compiler.debug.localVariable - org.eclipse.jdt.core.compiler.codegen.unusedLocal - org.eclipse.jdt.core.compiler.doc.comment.support THEN the same default as in JavaCorePreferenceInitializer is used. This ensures even better alignment of IDE and batch use with -properties. Notably, null annotations work as expected. Created attachment 221127 [details]
proposed patch
My current patch rebased on master.
Srikanth, could you please give your +1 for the direction of my patch (see comment 9)? The change is really simple, just I want to know if you agree with the approach - to read more options from the preference file, and - to align defaults for missing options with IDE use (see comment 8). Thanks. Patch looks fine to me. Please release next week for M3. Code changes have been released for 4.3 M3 via commit 5a4a2929d0aaba1a7f6b87488d0054e129a55977. Corresponding doc changes are in http://git.eclipse.org/c/platform/eclipse.platform.common.git/commit/?id=b5799e4c1b1404214da06f31ebd5a50d086a56a0 Verified for 4.3 M3 with build I20121029-2000 *** Bug 404722 has been marked as a duplicate of this bug. *** |
Build Identifier: 20110916-0149 When you set unusedParameterIncludeDocCommentReference in the UI (Project Properties -> Java Compiler -> Errors/Warnings, set "Value of Parameter is not used" to Warning and set the check-boxes on "Ignore in overriding and implementing methods" and "Ignore parameters documented with '@param' tag" the value of unusedParameterIncludeDocCommentReference is set to enabled in .settings/org.eclipse.jdt.core.prefs but the UI interprets the setting as set in the dialog the way you would expect (i.e. unused parameters documented with @param are not flagged as warning). However if you compile with ecj it interprets the setting in the file oppositely and flags the warning even though it is not reported in the UI. Reproducible: Always Steps to Reproduce: 1. Load attached example Eclipse Project. 2. Note setting of Project Properties -> Java Compiler -> Errors/Warnings setting for "Value of Parameter is not used," "Ignore in overriding and implementing methods," and "Ignore parameters documented with '@param' tag." 3. Note that the settings for these values in .settings\org.eclipse.jdt.core.prefs are as below and that has a value that is opposite from what would be expected from the UI settings. org.eclipse.jdt.core.compiler.problem.unusedParameter=warning org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled 4. Note that there are no warnings flagged on ShowBug class. 5. From the command line change directory to the workspace for this project and execute the following from the command line (you will have to supply your own ecj jar) c:\dev\warningsBug\WarningBug>java -jar c:\tmp\ecj-3.7.jar -version Eclipse Compiler for Java(TM) 0.B61, 3.7.0, Copyright IBM Corp 2000, 2010. All rights reserved. c:\dev\warningsBug\WarningBug>java -jar c:\tmp\ecj-3.7.jar -d c:\tmp -properties .settings\org.eclipse.jdt.core.prefs src ---------- 1. WARNING in c:\dev\warningsBug\WarningBug\src\bugs\warning\ShowBug.java (at line 8) public void foo(Object unusedParam) { ^^^^^^^^^^^ The value of the parameter unusedParam is not used ---------- 1 problem (1 warning) c:\dev\warningsBug\WarningBug> 6. Note that the warning is generated from ecj even though it is not in the UI.