eclipse-collections icon indicating copy to clipboard operation
eclipse-collections copied to clipboard

Remove default methods in Factories which throw UnsupportedOperationException

Open nikhilnanivadekar opened this issue 7 years ago • 3 comments

nikhilnanivadekar avatar Sep 12 '18 04:09 nikhilnanivadekar

Hi @nikhilnanivadekar ,

Could you explain this removal of the default meditates?

thank you.

Daniel-Dos avatar Nov 03 '18 04:11 Daniel-Dos

Some methods in factories like org.eclipse.collections.api.factory.list.MutableListFactory#ofInitialCapacity have a default implementation which throws. This was added to maintain backwards compatibility and allow contributors to add API features in a minor release. Since we are preparing for major release, I would like to clean up the default implementations by removing these implementations. So, org.eclipse.collections.api.factory.list.MutableListFactory#ofInitialCapacity will look like this:

Current:

    default <T> MutableList<T> ofInitialCapacity(int capacity)
    {
        throw new UnsupportedOperationException("Adding default implementation so as to not break compatibility");
    }

Fix: public <T> MutableList<T> ofInitialCapacity(int capacity)

nikhilnanivadekar avatar Nov 05 '18 13:11 nikhilnanivadekar

Hi,

only remove in classes "factory" ?

Daniel-Dos avatar Nov 09 '18 03:11 Daniel-Dos