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

18
LINES

< > BotCompany Repo | #2000490 // debugOn

New Tinybrain snippet

1  
  static void debugOn(String name) {
2  
    try {
3  
      Class c = getClass("main$" + name);
4  
      if (c == null) c = getClass(name);
5  
      Field field;
6  
      while (true)
7  
        try {
8  
          field = c.getDeclaredField("debug");
9  
          break;
10  
        } catch  (NoSuchFieldException e) {
11  
          c = c.getSuperclass();
12  
        }
13  
      field.setBoolean(null, true);
14  
    } catch (Exception e) {
15  
      e.printStackTrace();
16  
      System.err.println("Cannot debug class " + name);
17  
    }
18  
  }

download  show line numbers   

Snippet is not live.

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

No comments. add comment

Snippet ID: #2000490
Snippet name: debugOn
Eternal ID of this version: #2000490/1
Text MD5: 3f9394022700c30e58c99fa3511d6304
Author: stefan
Category:
Type: New Tinybrain snippet
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-08-02 20:16:44
Source code size: 506 bytes / 18 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 560 / 490
Referenced in: [show references]