PROPOSAL: Static Methods in Interfaces (original) (raw)
Schulz, Stefan schulz at e-Spirit.de
Thu Mar 5 00:16:09 PST 2009
- Previous message: PROPOSAL: Static Methods in Interfaces
- Next message: PROPOSAL: Static Methods in Interfaces
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
I'd like to see Java support 'static implements':
public class Foo implements Bar, static Baz { ... } where any methods defined by Baz have to be implemented by Foo as static methods.
Someone might remember me writing about this topic under the name "Meta-interfaces/Contracts" in early 2008. I don't think the suggested static methods do collide with a feature to have 'static implements', as these don't need to employ static (abstract) methods, but rather set the scope of the whole interface to define contracts a class has to fulfill (in form of implementing static methods corresponding to the interface). While I shortly thought about posting a proposal on Contracts, I think it is far out of scope for Coin.
Regarding static methods in interfaces, I feel a bit undecided, though. While it seems desireable to have common utility methods as close to the related interface as possible, interfaces might become polluted by those methods (as a nested class may do, too) and custom utilities still cannot be linked to the targeted interface. Maybe some possibility to establish a kind of link between utility classes and interfaces would be the better choice. In general, I'd rather prefer a solution like extension methods or similar solutions, accepting not to have it in Coin if considered to big a change.
Cheers, Stefan
- Previous message: PROPOSAL: Static Methods in Interfaces
- Next message: PROPOSAL: Static Methods in Interfaces
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]