Community
Participate
Working Groups
It would be nice to have a refactoring to change an interface to an abstract class. That would include - making up field declarations and method signatures (that is, adding "public final static" resp. "public abstract" where not already present) - changing "implements" statements to "extends" - and of course checking the preconditions for these actions The reverse refactoring (purely abstract class to interface) would also be cool, of course.
Adam, what do you think about this for 2.x?
i have never performed such an operation on my code so i'm having doubts about 'usefulness' of that refactoring. :) i'd say: 'helpwanted'
You never started with an interface and later discovered that you could benefit from the Template Method pattern? Exciting... ;-)
now that i think about it, i guess i did - maybe once or twice in the last year. might be just me, though. everybody works differently. :-)
sorry if i made it sound like i did not like the idea. the idea is good - it's a valid refactoring and people perform it on their code manually. we just need to proritize feature requests.
No problem. :-) Regards, Ilja
"You never started with an interface and later discovered that you could benefit from the Template Method pattern? Exciting... ;-)" Since you talk about patterns <g> In this case I commonly use the Interface/Implementation Pair pattern: InterfaceFoo AbstractFoo with template methods for interfaces. The creation of an implementation pair is already supported by override methods. Having said this, turning an interface into an abstract class can still make sense but given the above I consider it less important.
I see your point... :-) OTOH I often feel that the interface gets superfluous by the existence of the abstract class, so that getting rid of it would simplify the design. Of course, I might sometimes later discover that meanwhile I need the interface, so that an "extract interface" refactoring would be handy... ;-) (I know there is an RFE for that, too.)
*** Bug 35921 has been marked as a duplicate of this bug. ***