langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/options/Options.java
changeset 35808 fe1936c9412e
parent 34991 ff8be37d1164
child 39599 3c7da4996d8c
equal deleted inserted replaced
35807:2eb1d877da0f 35808:fe1936c9412e
     1 /*
     1 /*
     2  * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    32 import java.util.HashMap;
    32 import java.util.HashMap;
    33 import java.util.List;
    33 import java.util.List;
    34 import java.util.Map;
    34 import java.util.Map;
    35 import java.util.Set;
    35 import java.util.Set;
    36 import java.util.HashSet;
    36 import java.util.HashSet;
       
    37 import java.util.StringJoiner;
    37 
    38 
    38 import com.sun.tools.sjavac.Transformer;
    39 import com.sun.tools.sjavac.Transformer;
    39 import com.sun.tools.sjavac.Util;
    40 import com.sun.tools.sjavac.Util;
    40 
    41 
    41 /**
    42 /**
   223                     addArg(opt, sl.getPath());
   224                     addArg(opt, sl.getPath());
   224                 }
   225                 }
   225             }
   226             }
   226 
   227 
   227             String getResult() {
   228             String getResult() {
   228                 String result = "";
   229                 return String.join(" ", args);
   229                 for (String s : args)
       
   230                     result += s + " ";
       
   231                 return result.trim();
       
   232             }
   230             }
   233 
   231 
   234             public void addAll(Collection<String> toAdd) {
   232             public void addAll(Collection<String> toAdd) {
   235                 args.addAll(toAdd);
   233                 args.addAll(toAdd);
   236             }
   234             }
   335     }
   333     }
   336 
   334 
   337     // Helper method to join a list of source locations separated by
   335     // Helper method to join a list of source locations separated by
   338     // File.pathSeparator
   336     // File.pathSeparator
   339     private static String concatenateSourceLocations(List<SourceLocation> locs) {
   337     private static String concatenateSourceLocations(List<SourceLocation> locs) {
   340         String s = "";
   338         StringJoiner joiner = new StringJoiner(java.io.File.pathSeparator);
   341         for (SourceLocation loc : locs)
   339         for (SourceLocation loc : locs) {
   342             s += (s.isEmpty() ? "" : java.io.File.pathSeparator) + loc.getPath();
   340             joiner.add(loc.getPath().toString());
   343         return s;
   341         }
       
   342         return joiner.toString();
   344     }
   343     }
   345 
   344 
   346     // OptionHelper that records the traversed options in this Options instance.
   345     // OptionHelper that records the traversed options in this Options instance.
   347     private class ArgDecoderOptionHelper extends OptionHelper {
   346     private class ArgDecoderOptionHelper extends OptionHelper {
   348 
   347