JDK: Scratching Own Itch!
←Older revision | Revision as of 06:00, 30 September 2020 | ||
Line 19: | Line 19: | ||
It may seem most of this discussion is obsolete with [[JDK]]8 [[DefaultMethods]]. With [[JDK]]8 you can add new methods with ''default implementations'' into existing interfaces - which is then mostly compatible extension (however only mostly, read [[BinaryCompatibleDefaultMethods]] for more horror stories about [[DefaultMethods]] - there is no free lunch!). Reasonable [[API]] writers then provide the default bodies for newly added methods and mitigate most of the [[DOM]]2 vs. [[DOM]]3 problems by that. | It may seem most of this discussion is obsolete with [[JDK]]8 [[DefaultMethods]]. With [[JDK]]8 you can add new methods with ''default implementations'' into existing interfaces - which is then mostly compatible extension (however only mostly, read [[BinaryCompatibleDefaultMethods]] for more horror stories about [[DefaultMethods]] - there is no free lunch!). Reasonable [[API]] writers then provide the default bodies for newly added methods and mitigate most of the [[DOM]]2 vs. [[DOM]]3 problems by that. | ||
- | It is however interesting to analyze the reasons why ''extender methods'' were introduced. Of course, people we crying for them for ages, but the members of [[JDK]] team were refusing all such efforts. Why? To keep the purity of the language (correct as [[DefaultMethods]] decrease [[clarity]] of the [[ | + | It is however interesting to analyze the reasons why ''extender methods'' were introduced. Of course, people we crying for them for ages, but the members of [[JDK]] team were refusing all such efforts. Why? To keep the purity of the language (correct as [[DefaultMethods]] decrease [[clarity]] of the [[ProviderAPI]] interface). |
However when they finally felt all the pain - e.g. when the {{JDK|java/util|Collection}} and etc. interfaces were found insufficient, they immediately changed their mind. And of course, because they control the [[VM]], they could do (unlike us, regular outsider beings) miracles. It is way easier to resolve [[backward compatibility]] issues if you control the way linkage is done! | However when they finally felt all the pain - e.g. when the {{JDK|java/util|Collection}} and etc. interfaces were found insufficient, they immediately changed their mind. And of course, because they control the [[VM]], they could do (unlike us, regular outsider beings) miracles. It is way easier to resolve [[backward compatibility]] issues if you control the way linkage is done! |