Community
Participate
Working Groups
One of the problems that I've run into when using "Unused parameters" is it's very easy to have many cases of unused parameters if you implement an interface. It's not unusual to have methods defined on the interface that contain arguments that you don't need, not to mention the adapter style of implementing that contains no implementation. Seems like there may need to be special cases to handle these. Something along the lines of if the method's body is empty then exclude that method from the unused parameters warning. ======== From mailing list PM> Now it makes perfect sense. Maybe the argument warning should only PM> occur if PM> the method has a body... do you agree ? That would certainly handle some of the cases, hard to say what percentage exactly. There would still be the "problem" of the method having a body and not referring to any of the augments because the method is an overridden or interface-method. I found these cases happened a lot when subclassing things like SourceViewerConfiguration. A case that would handle methods like these would be to exclude those methods that are overriding/implementing another method. However that seems like it could result in too many missed cases.
Nice to have. Post 2.1
Resurrecting for investigation, as per request for RC1.
*** Bug 28319 has been marked as a duplicate of this bug. ***
*** Bug 31243 has been marked as a duplicate of this bug. ***
*** Bug 28139 has been marked as a duplicate of this bug. ***
Unused parameter diagnosis will now ignore parameters in an abstract method, a main method, an implementation of an abstract method or a method overriding a concrete one. Additional settings got added for enabling the diagnosis of the latter two scenarii. * COMPILER / Reporting Unused Parameter if Implementing Abstract Method * When enabled, the compiler will signal unused parameters in abstract method implementations. * The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.unusedParameter". * - option id: "org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementi ngAbstract" * - possible values: { "enabled", "disabled" } * - default: "disabled" * * COMPILER / Reporting Unused Parameter if Overriding Concrete Method * When enabled, the compiler will signal unused parameters in methods overriding concrete ones. * The severity of the problem is controlled with option "org.eclipse.jdt.core.compiler.problem.unusedParameter". * - option id: "org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverriding Concrete" * - possible values: { "enabled", "disabled" } * - default: "disabled" Fixed
Verified.