Scanning multi version jars?
gregw at webtide.com
Fri Sep 15 21:58:36 UTC 2017
I had a quick look at `jdk.internal.util.jar.VersionedStream` and have the
- The style of the API is fine - pass in a JarFile and get a
- It might be better to have a Stream<VersionedJarEntry> which includes
a method to query the actual version of each entry.
- I think the stream needs to handle inner classes and only include them
if their matching outerclass is available at the same version. So for
example a base Foo$Bar.class will only be included if the stream includes a
base Foo.class, and it will not be included if the Foo.class is version 9
or above. Likewise a version 9 Foo$Bar.class will only be included in the
stream if the stream also includes a version 9 Foo.class, and will not be
included if the stream has a version 10 or above Foo.class
If you think this last point is possible, then I'll move the discussion
back the EE expert groups to try to get an agreement on the exact stream
code that will be used in the mid term until it is available in the JRE
lib, at which time the specs should be amended to say they will defer the
decision of which classes to scan the JRE lib so they will be future proof
for any changes in java 10, 11 etc.
On 15 September 2017 at 17:27, Alan Bateman <Alan.Bateman at oracle.com> wrote:
> On 15/09/2017 03:09, Greg Wilkins wrote:
>> thanks for correcting me on the API of JarFile - I can see it kind of
>> works, but in a very bizarre way (it gives different content for entries
>> obtained via the enumerator vs the getJarEntry API, even though both
>> entries report the same name). But I'll discuss that elsewhere.
> This is something that was discussed on core-libs-dev on a number of
> occasions. The summary is that JarFile needs a new API for this,
> versionedStream() was suggested, but it was kicked down the road for later
> in order deal with the fallout from adding MR JARs.
> Since you have access to the code then look at
> jdk.internal.util.jar.VersionedStream for an example code of what I think
> you are looking for.
Greg Wilkins <gregw at webtide.com> CTO http://webtide.com
More information about the core-libs-dev