RFR - 8132734: java.util.jar.* changes to support multi-release jar files

Steve Drach steve.drach at oracle.com
Fri Jan 29 19:58:19 UTC 2016


>>> One other thing that I've been wondering about is the stream() and entries() methods. Has there been any discussion about these doing filter?
>> 
>> Not that I’m aware of.
>> 
>>> Maybe it is too expensive and best left to the user of the API? Part of the context for asking is modular JARs of course.
>> 
>> Perhaps you can elaborate.
> 
> Alan’s point is that traversing using entries()/stream() always returns the versioned entries (if any) rather than all entries, thus in a sense filters.
> 
> My assumption was the traversal should by default be consistent with a calls to getEntry, thus:
> 
> jarFile.stream().forEach(e -> {
>    JarEntry je = jarFile.getJarEntry(e.getName());
>    assert e.equals(je);
> });
> 
> There might need to be another stream method that returns all entries.

JarFile.entries() and JarFile.stream() return all the entries; they are not filtered.  Your example would work if the JarFile is constructed without a Release argument or with the Release.BASE argument.  The assertion would fail if it’s constructed with any other Release argument.  Adding a filter and a map to the stream pipeline would make your example succeed with all values of Release.


More information about the core-libs-dev mailing list