< prev index next >

test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/ClassPathJimageEntry.java

Print this page
rev 47464 : 8186618: [TESTBUG] Test applications/ctw/Modules.java doesn't have timeout and hang on windows
Reviewed-by: duke


   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 package sun.hotspot.tools.ctw;
  25 
  26 import jdk.internal.jimage.ImageReader;
  27 import jdk.internal.jimage.ImageLocation;

  28 
  29 import java.io.IOException;
  30 import java.nio.file.Files;
  31 import java.nio.file.Path;
  32 import java.util.Arrays;
  33 import java.util.concurrent.Executor;
  34 import java.util.stream.Stream;
  35 
  36 /**
  37  * Handler for jimage-files containing classes to compile.
  38  */
  39 public class ClassPathJimageEntry extends PathHandler.PathEntry {
  40 
  41     @Override
  42     protected Stream<String> classes() {
  43         return Arrays.stream(reader.getEntryNames())
  44                      .filter(name -> name.endsWith(".class"))
  45                      .filter(name -> !name.endsWith("module-info.class"))
  46                      .map(ClassPathJimageEntry::toFileName)
  47                      .map(Utils::fileNameToClassName);
  48     }
  49 
  50     private static String toFileName(String name) {
  51         final char nameSeparator = '/';
  52         assert name.charAt(0) == nameSeparator : name;
  53         return name.substring(name.indexOf(nameSeparator, 1) + 1);




   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 package sun.hotspot.tools.ctw;
  25 

  26 import jdk.internal.jimage.ImageLocation;
  27 import jdk.internal.jimage.ImageReader;
  28 
  29 import java.io.IOException;
  30 import java.nio.file.Files;
  31 import java.nio.file.Path;
  32 import java.util.Arrays;

  33 import java.util.stream.Stream;
  34 
  35 /**
  36  * Handler for jimage-files containing classes to compile.
  37  */
  38 public class ClassPathJimageEntry extends PathHandler.PathEntry {
  39 
  40     @Override
  41     protected Stream<String> classes() {
  42         return Arrays.stream(reader.getEntryNames())
  43                      .filter(name -> name.endsWith(".class"))
  44                      .filter(name -> !name.endsWith("module-info.class"))
  45                      .map(ClassPathJimageEntry::toFileName)
  46                      .map(Utils::fileNameToClassName);
  47     }
  48 
  49     private static String toFileName(String name) {
  50         final char nameSeparator = '/';
  51         assert name.charAt(0) == nameSeparator : name;
  52         return name.substring(name.indexOf(nameSeparator, 1) + 1);


< prev index next >