Community
Participate
Working Groups
Java 8 allows to provide default methods, we should provide empty default methods for inputChanged and dispose in IContentProvider.
New Gerrit change created: https://git.eclipse.org/r/56214
Gerrit change https://git.eclipse.org/r/56214 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=62372d7c5cb099ed3286d3fa138c186eb42cbf2d
Just in case you did not know: Defining a default implementation for an interface is not completely harmless. :-) This change caused a compile error in Dali (bug 488427). This is because Dali has an interface (StructuredStateProvider) that indirectly extends IContentProvider and IBaseLabelProvider; and IBaseLabelProvider also defines a dispose() method. The compile error reads like this: The default method dispose() inherited from IContentProvider conflicts with another method inherited from IBaseLabelProvider The "fix" was to define a default implementation of dispose() in StructuredStateProvider.
Well I just ran into this as well and I have to say the abuse of "default" methods is completely inappropriate. They have been invented so provide new features and not to implement convenient APIs. A problem i see in our code base now is that people are implementing an interface are not forced to implement the dispose-method because this default-implementation hides it from them. I know this ship has sailed a long time ago but I think adding default-methods just to provide convenience methods needs to be discussed