please review draft JEP: Convenience Factory Methods for Collections
Tom Hawtin
tom.hawtin at oracle.com
Fri Jul 18 02:46:31 UTC 2014
On 17/07/2014 22:56, Stuart Marks wrote:
> On 7/17/14 12:46 AM, Tom Hawtin wrote:
>> I note that with the basic proposal, HashSet.of and indeed
>> NavigableSet.of still
>> work. They just do the wrong thing.
>
> I should have made more clear in the JEP that the proposed APIs are
> static methods on the List/Map/Set interfaces, not default methods. Thus
> they won't be inherited by any subinterfaces or implementors.
Ah, static methods of interfaces behave differently to class methods.
The language corner case I'm missing is in 8.4.8 (of Java SE 8 JLS) for
classes
"A class does not inherit static methods from its superinterfaces."
and 9.2 for interfaces (if I've parsed this correctly)
"The interface inherits, from the interfaces it extends, all members
of those interfaces, except for fields, classes, and interfaces that it
hides; abstract or default methods that it overrides (9.4.1); and static
methods."
Tom
More information about the core-libs-dev
mailing list