langtools/test/tools/lib/toolbox/ModuleBuilder.java
changeset 44684 6ce4d52084e8
parent 42407 f3702cff2933
child 44807 47e09e3f1829
equal deleted inserted replaced
44683:610dc2b48954 44684:6ce4d52084e8
     1 /*
     1 /*
     2  * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2015, 2017, 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.
     7  * published by the Free Software Foundation.
   245     public Path write(Path srcDir) throws IOException {
   245     public Path write(Path srcDir) throws IOException {
   246         Files.createDirectories(srcDir);
   246         Files.createDirectories(srcDir);
   247         List<String> sources = new ArrayList<>();
   247         List<String> sources = new ArrayList<>();
   248         StringBuilder sb = new StringBuilder();
   248         StringBuilder sb = new StringBuilder();
   249         if (!comment.isEmpty()) {
   249         if (!comment.isEmpty()) {
   250             sb.append("/**\n").append(comment.replace("\n", " *")).append(" */\n");
   250             sb.append("/**\n * ")
       
   251                     .append(comment.replace("\n", "\n * "))
       
   252                     .append("\n */\n");
   251         }
   253         }
   252         sb.append("module ").append(name).append(" {\n");
   254         sb.append("module ").append(name).append(" {\n");
   253         requires.forEach(r -> sb.append("    " + r + "\n"));
   255         requires.forEach(r -> sb.append("    " + r + "\n"));
   254         exports.forEach(e -> sb.append("    " + e + "\n"));
   256         exports.forEach(e -> sb.append("    " + e + "\n"));
   255         uses.forEach(u -> sb.append("    " + u + "\n"));
   257         uses.forEach(u -> sb.append("    " + u + "\n"));