Bug 25204 - Eclipse compiler option: Unused parameters (i.e. never read)
Summary: Eclipse compiler option: Unused parameters (i.e. never read)
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0.2   Edit
Hardware: Other other
: P3 normal (vote)
Target Milestone: 2.1 RC1   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 28139 28319 31243 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-10-22 12:48 EDT by Chris Grindstaff CLA
Modified: 2003-02-24 05:51 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Grindstaff CLA 2002-10-22 12:48:50 EDT
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.
Comment 1 Philipe Mulet CLA 2002-11-13 03:47:21 EST
Nice to have. Post 2.1
Comment 2 Philipe Mulet CLA 2003-02-11 06:41:54 EST
Resurrecting for investigation, as per request for RC1.
Comment 3 Philipe Mulet CLA 2003-02-11 06:44:49 EST
*** Bug 28319 has been marked as a duplicate of this bug. ***
Comment 4 Philipe Mulet CLA 2003-02-11 06:45:20 EST
*** Bug 31243 has been marked as a duplicate of this bug. ***
Comment 5 Philipe Mulet CLA 2003-02-12 06:58:53 EST
*** Bug 28139 has been marked as a duplicate of this bug. ***
Comment 6 Philipe Mulet CLA 2003-02-14 06:58:49 EST
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
Comment 7 David Audel CLA 2003-02-24 05:51:56 EST
Verified.