Bug 477779 - Provide default methods for IContentProvider
Summary: Provide default methods for IContentProvider
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.6   Edit
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: 4.6 M6   Edit
Assignee: Lars Vogel CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy
Depends on: 477774
Blocks: 477782
  Show dependency tree
 
Reported: 2015-09-18 05:05 EDT by Lars Vogel CLA
Modified: 2021-04-19 04:36 EDT (History)
9 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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