Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

23
LINES

< > BotCompany Repo | #1005033 // Find all inner classes of main in running program

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (1156L/8K/27K).

!752

static class Holladiho {
  class Cheerio {}
}

p {
  ClassLoader loader = myClassLoader();
  L<File> files = cast getOpt(loader, "files");
  if (files == null)
    fail("No classes info (please run #1001639!)");
  new L<S> classes;
  for (File dir : files) {
    if (dir.isDirectory()) {
      for (File f : listFiles(dir)) {
        S s = f.getName();
        if (s.endsWith(".class") && s.startsWith("main$"))
          classes.add(dropPrefix("main$", dropSuffix(".class", s)));
      }
    }
  }
  printStructure(classes);
}

Author comment

Began life as a copy of #1005032

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1005033
Snippet name: Find all inner classes of main in running program
Eternal ID of this version: #1005033/1
Text MD5: 7fd6e1b5f4540a2e2c69d1c123056eb5
Transpilation MD5: 0b3541e7eab26f1c54fed77dbfafbc83
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-09-29 01:25:58
Source code size: 555 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 491 / 521
Referenced in: #1006696 - myClasses - get names of all classes declared in running program (even those not loaded yet)