Bug 477779

Summary: Provide default methods for IContentProvider
Product: [Eclipse Project] Platform Reporter: Lars Vogel <Lars.Vogel>
Component: UIAssignee: Lars Vogel <Lars.Vogel>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: alex.blewitt, brian.vosburgh, bsd, daniel_megert, Lars.Vogel, markus.kell.r, simon.scholz, sxenos, tom.schindl
Version: 4.6Keywords: noteworthy
Target Milestone: 4.6 M6   
Hardware: PC   
OS: Linux   
See Also: https://git.eclipse.org/r/56214
https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=62372d7c5cb099ed3286d3fa138c186eb42cbf2d
Whiteboard:
Bug Depends on: 477774    
Bug Blocks: 477782    

Description Lars Vogel CLA 2015-09-18 05:05:50 EDT
Java 8 allows to provide default methods, we should provide empty default methods for inputChanged and dispose in IContentProvider.
Comment 1 Eclipse Genie CLA 2015-09-18 05:14:14 EDT
New Gerrit change created: https://git.eclipse.org/r/56214
Comment 3 Brian Vosburgh CLA 2016-02-26 12:16:51 EST
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.
Comment 4 Thomas Schindl CLA 2021-04-19 04:36:13 EDT
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