< prev index next >

test/hotspot/jtreg/gc/stress/gcbasher/TestGCBasher.java

Print this page
*** 1,7 ***
  /*
!  * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.
--- 1,7 ---
  /*
!  * Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.

*** 29,22 ***
  import java.nio.file.FileSystems;
  import java.nio.file.FileSystem;
  import java.nio.file.Files;
  import java.nio.file.Path;
  import java.util.HashMap;
  import java.util.stream.Stream;
  
  public class TestGCBasher {
      private static void parseClassFiles() throws IOException {
          HashMap<String, ClassInfo> deps = new HashMap<>();
  
          FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
          try (Stream<Path> s = Files.walk(fs.getPath("/"))) {
!             for (Path p : (Iterable<Path>)s::iterator) {
                  if (p.toString().endsWith(".class") &&
!                     !p.getFileName().toString().equals("module-info.class")) {
!                     byte[] data = Files.readAllBytes(p);
                      Decompiler d = new Decompiler(data);
                      ClassInfo ci = d.getClassInfo();
                      deps.put(ci.getName(), ci);
                  }
              }
--- 29,26 ---
  import java.nio.file.FileSystems;
  import java.nio.file.FileSystem;
  import java.nio.file.Files;
  import java.nio.file.Path;
  import java.util.HashMap;
+ import java.util.stream.IntStream;
  import java.util.stream.Stream;
  
  public class TestGCBasher {
      private static void parseClassFiles() throws IOException {
          HashMap<String, ClassInfo> deps = new HashMap<>();
  
          FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
          try (Stream<Path> s = Files.walk(fs.getPath("/"))) {
!             for (Path p : (Iterable<Path>) s::iterator) {
                  if (p.toString().endsWith(".class") &&
!                         !p.getFileName().toString().equals("module-info.class")) {
!                     byte[] rData = Files.readAllBytes(p);
+                     Byte[] data = IntStream.range(0, rData.length)
+                             .mapToObj(i -> rData[i])
+                             .toArray(Byte[]::new);
                      Decompiler d = new Decompiler(data);
                      ClassInfo ci = d.getClassInfo();
                      deps.put(ci.getName(), ci);
                  }
              }
< prev index next >