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

36
LINES

< > BotCompany Repo | #1018504 // Test call_cached

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

Download Jar. Libraryless. Click here for Pure Java version (5849L/41K).

1  
!7
2  
3  
set flag _MethodCache_debug.
4  
5  
sclass Bla {
6  
  S ok() { ret 'jaOK; }
7  
  int yo(int x) { ret x+5; }
8  
  S yo(S x) { ret 'ja + x; }
9  
  S testMe(int x) { ret 'int; }
10  
}
11  
12  
sclass DaStatic {
13  
  sS sOK() { ret 'sJaOK; }
14  
  static int yo(int x) { ret x+5; }
15  
  sS yo(S x) { ret 'ja + x; }
16  
}
17  
18  
p-exp {
19  
  twice {
20  
    assertEqualsVerbose('jaOK, call_cached(new Bla, 'ok));
21  
    assertException(r { call_cached(new Bla, 'sOK) });
22  
    assertEqualsVerbose(15, call_cached(new Bla, 'yo, 10));
23  
    assertEqualsVerbose('jaX, call_cached(new Bla, 'yo, 'X));
24  
    assertException(r { call_cached(new Bla, 'yoyo) });
25  
    assertException(r { call_cached(new Bla, 'yo, 5.0) });
26  
    assertException(r { call_cached(Bla, 'ok) }); // non-static method
27  
    assertException(r { call_cached(new Bla, 'testMe, 'test) });
28  
    
29  
    assertException(r { call_cached(DaStatic, 'ok) });
30  
    assertEqualsVerbose('sJaOK, call_cached(DaStatic, 'sOK));
31  
    assertEqualsVerbose(15, call_cached(DaStatic, 'yo, 10));
32  
    assertEqualsVerbose('jaX, call_cached(DaStatic, 'yo, 'X));
33  
    assertException(r { call_cached(DaStatic, 'yoyo) });
34  
    assertException(r { call_cached(DaStatic, 'yo, 5.0) });
35  
  }
36  
}

Author comment

Began life as a copy of #1018498

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1018504
Snippet name: Test call_cached
Eternal ID of this version: #1018504/1
Text MD5: 60c1ae91bf38e2555dc62b8a9689401e
Transpilation MD5: 7a4834edb590358ad96accdec486174f
Author: stefan
Category: javax
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-10-02 12:30:48
Source code size: 1186 bytes / 36 lines
Pitched / IR pitched: No / No
Views / Downloads: 256 / 775
Referenced in: [show references]