public static CodeStats getClassStats(Class<?> cls) {
    try (InputStream stream =
            cls.getResourceAsStream(ReflectionUtils.getClassNameWithoutPackage(cls) + ".class");
        BufferedInputStream bis = new BufferedInputStream(Objects.requireNonNull(stream))) {
      byte[] bytecodes = new byte[stream.available()];
      bis.read(bytecodes);
      return getClassStats(bytecodes);
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
  }
@Test
  public void testGetClassStats() {
    CompileUnit unit =
        new CompileUnit(
            "demo.pkg1",
            "A",
            (""
                + "package demo.pkg1;\n"
                + "public class A {\n"
                + "  public static String hello() { return \"HELLO\"; }\n"
                + "}"));
    // Since janino is not called frequently, we test only 50 times.
    byte[] bytecodes =
        JaninoUtils.toBytecode(Thread.currentThread().getContextClassLoader(), unit)
            .values()
            .iterator()
            .next();
    JaninoUtils.CodeStats classStats = JaninoUtils.getClassStats(bytecodes);
    System.out.println(classStats);
    Assert.assertTrue(classStats.methodsSize.containsKey("hello"));
  }