8207690: Parsing API for classpath and similar path strings

mark.reinhold at oracle.com mark.reinhold at oracle.com
Tue Sep 11 16:49:52 UTC 2018


2018/9/11 4:50:49 -0700, chris.hegarty at oracle.com:
>> On 11 Sep 2018, at 10:24, Alan Bateman <Alan.Bateman at oracle.com> wrote:
>> On 10/09/2018 21:55, Roger Riggs wrote:
>>> Nope! there's quoting on Windows that gets short changed with that work around.
>>> 
>>> Other opinions?, Suggestions?
>> 
>> One suggestion is reduce this down to one method that returns a
>> stream rather than a collection. It could work lazily if you
>> want. Something like:
>> 
>>  Stream<String> splitSearchPath(String input)
> 
> I agree with Alan, this seems like the lowest-order primitive.

Agreed, but it begs a question that applies to all these alternatives:
Why does this API belong in java.nio.file.Paths?

In other words, search paths are a different abstraction from filesystem
paths.  Should they have their own class, even if it only winds up with
a couple of static utility methods?  java.nio.file.SearchPath?

    public class SearchPath {
        public static Stream<String> splitToStream(String searchPath);
        public static List<Path> splitToPaths(String searchPath);
        public static String join(Collection<String>);
    }

- Mark


More information about the core-libs-dev mailing list