< prev index next >

make/jdk/src/classes/build/tools/classlist/HelloClasslist.java

Print this page
rev 55994 : 8229773: Resolve permissions for code source URLs lazily
Reviewed-by: alanb, mullan, rriggs, dfuchs


  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 /**
  27  * This application is meant to be run to create a classlist file representing
  28  * common use.
  29  *
  30  * The classlist is produced by adding -XX:DumpLoadedClassList=classlist
  31  */
  32 package build.tools.classlist;
  33 
  34 import java.net.InetAddress;

  35 import java.time.LocalDateTime;
  36 import java.time.ZoneId;
  37 import java.time.format.DateTimeFormatter;
  38 import java.util.stream.Stream;
  39 import java.util.logging.*;
  40 import java.util.Arrays;
  41 import java.util.Date;
  42 import java.util.List;
  43 import java.util.Locale;
  44 import java.text.DateFormat;
  45 
  46 import static java.util.stream.Collectors.*;
  47 
  48 /**
  49  * This class is used to generate a classlist during build. Intent
  50  * is to touch a reasonable amount of JDK classes that are commonly
  51  * loaded and used early.
  52  */
  53 public class HelloClasslist {
  54 
  55     private static final Logger LOGGER = Logger.getLogger("Hello");
  56 
  57     public static void main(String ... args) {


  58 
  59         List<String> strings = Arrays.asList("Hello", "World!", "From: ",
  60               InetAddress.getLoopbackAddress().toString());
  61 
  62         String helloWorld = strings.parallelStream()
  63               .map(s -> s.toLowerCase(Locale.ROOT))
  64               .collect(joining(","));
  65 
  66         Stream.of(helloWorld.split(","))
  67               .forEach(System.out::println);
  68 
  69         // Common concatenation patterns
  70         String SS     = String.valueOf(args.length) + String.valueOf(args.length);
  71         String CS     = "string" + String.valueOf(args.length);
  72         String SC     = String.valueOf(args.length) + "string";
  73         String SCS    = String.valueOf(args.length) + "string" + String.valueOf(args.length);
  74         String CSS    = "string" + String.valueOf(args.length) + String.valueOf(args.length);
  75         String CSC    = "string" + String.valueOf(args.length) + "string";
  76         String SSC    = String.valueOf(args.length) + String.valueOf(args.length) + "string";
  77         String CSCS   = "string" + String.valueOf(args.length) + "string" + String.valueOf(args.length);




  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 /**
  27  * This application is meant to be run to create a classlist file representing
  28  * common use.
  29  *
  30  * The classlist is produced by adding -XX:DumpLoadedClassList=classlist
  31  */
  32 package build.tools.classlist;
  33 
  34 import java.net.InetAddress;
  35 import java.nio.file.FileSystems;
  36 import java.time.LocalDateTime;
  37 import java.time.ZoneId;
  38 import java.time.format.DateTimeFormatter;
  39 import java.util.stream.Stream;
  40 import java.util.logging.*;
  41 import java.util.Arrays;
  42 import java.util.Date;
  43 import java.util.List;
  44 import java.util.Locale;
  45 import java.text.DateFormat;
  46 
  47 import static java.util.stream.Collectors.*;
  48 
  49 /**
  50  * This class is used to generate a classlist during build. Intent
  51  * is to touch a reasonable amount of JDK classes that are commonly
  52  * loaded and used early.
  53  */
  54 public class HelloClasslist {
  55 
  56     private static final Logger LOGGER = Logger.getLogger("Hello");
  57 
  58     public static void main(String ... args) {
  59 
  60         FileSystems.getDefault();
  61 
  62         List<String> strings = Arrays.asList("Hello", "World!", "From: ",
  63               InetAddress.getLoopbackAddress().toString());
  64 
  65         String helloWorld = strings.parallelStream()
  66               .map(s -> s.toLowerCase(Locale.ROOT))
  67               .collect(joining(","));
  68 
  69         Stream.of(helloWorld.split(","))
  70               .forEach(System.out::println);
  71 
  72         // Common concatenation patterns
  73         String SS     = String.valueOf(args.length) + String.valueOf(args.length);
  74         String CS     = "string" + String.valueOf(args.length);
  75         String SC     = String.valueOf(args.length) + "string";
  76         String SCS    = String.valueOf(args.length) + "string" + String.valueOf(args.length);
  77         String CSS    = "string" + String.valueOf(args.length) + String.valueOf(args.length);
  78         String CSC    = "string" + String.valueOf(args.length) + "string";
  79         String SSC    = String.valueOf(args.length) + String.valueOf(args.length) + "string";
  80         String CSCS   = "string" + String.valueOf(args.length) + "string" + String.valueOf(args.length);


< prev index next >