Bug 10605

Summary: [refactoring] Convert instance methods to static if they don't refer to non-static members
Product: [Eclipse Project] JDT Reporter: David Corbin <dcorbin>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: ASSIGNED --- QA Contact:
Severity: enhancement    
Priority: P3 CC: albzey+eclipsebugs, daniel_megert, dirk_baeumer, gautier.desaintmartinlacaze, jared_burns, luke.hutch, markus.kell.r, reprogrammer, timo.kinnunen
Version: 2.0Keywords: helpwanted, investigate
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description David Corbin CLA 2002-03-01 14:03:22 EST
Convert all methods on a class to static methods if they don't refere to any
non-static fields/methods.
Comment 1 Erich Gamma CLA 2002-03-03 18:16:59 EST
agreed that this would be useful, but we can't commit to do it for 2.0
Comment 2 Dirk Baeumer CLA 2002-07-23 09:09:06 EDT
We should also convert the call to that method to something like 
class.method().

2.1 candidate
Comment 3 Dirk Baeumer CLA 2002-07-23 09:12:59 EDT
[refactoring]
Comment 4 Adam Kiezun CLA 2002-11-11 07:12:27 EST
*** Bug 24288 has been marked as a duplicate of this bug. ***
Comment 5 Dirk Baeumer CLA 2003-04-28 06:03:51 EDT
Chaning state from assigned later to resolved later. Assigned later got 
introduced by the last bug conversion and is not a supported Eclipse bug state.
Comment 6 Martin Aeschlimann CLA 2005-11-28 04:09:50 EST
*** Bug 118032 has been marked as a duplicate of this bug. ***
Comment 7 Martin Aeschlimann CLA 2005-11-28 07:05:18 EST
*** Bug 118032 has been marked as a duplicate of this bug. ***
Comment 8 Martin Aeschlimann CLA 2007-04-25 05:12:27 EDT
dup of bug 118032
Comment 9 Martin Aeschlimann CLA 2007-04-25 05:12:38 EDT

*** This bug has been marked as a duplicate of bug 118032 ***
Comment 10 Dani Megert CLA 2010-06-08 07:15:09 EDT
Not a dup of bug 118032.
Comment 11 Markus Keller CLA 2010-06-09 02:10:31 EDT
This would better be implemented as a Clean Up, since it does not refactor much (only analyzes and adds a modifier).

E.g. Code Style > Method declarations > Use modifier 'static' where possible.
Comment 12 Dani Megert CLA 2010-06-09 03:14:02 EDT
>This would better be implemented as a Clean Up
I was thinking of that too but came too the conclusion that it is more than a clean up since it really changes the class (not just applying different style) and also affects runtime behavior in case someone overrode the instance method.
Comment 13 Dani Megert CLA 2011-03-01 02:19:20 EST
*** Bug 338449 has been marked as a duplicate of this bug. ***
Comment 14 Thomas Singer CLA 2011-12-01 11:03:22 EST
IDEA can handle the case, too, where the method refers to non-static members: they are passed as parameters.
Comment 15 Markus Keller CLA 2011-12-01 11:14:32 EST
(In reply to comment #14)
> IDEA can handle the case, too, where the method refers to non-static members:
> they are passed as parameters.

That's bug 118032.
Comment 16 Noopur Gupta CLA 2015-12-18 10:11:34 EST
*** Bug 483995 has been marked as a duplicate of this bug. ***