When using Eclipse's "Extract Interface" refactoring, it will declare the methods public abstract
by default. Why? public
modifier on an interface is completely redundant and abstract
also seems meaningless on an interface declaration.
These keywords are indeed redundant. I personally wouldn't use them in this context, but I can see why someone might prefer to include them.
The JLS explicitly discourages this practice:
It is permitted, but discouraged as a matter of style, to redundantly specify the
public
and/orabstract
modifier for a method declared in an interface.
In my version of Eclipse (Juno SR1), there are two options in the Extract Interface dialog:
public
;abstract
.If you untick them, Eclipse should no longer include the two keywords when you extract an interface.
There is a pending Eclipse bug report to clean up the redundant modifies.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With