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).

!7

set flag _MethodCache_debug.

sclass Bla {
  S ok() { ret 'jaOK; }
  int yo(int x) { ret x+5; }
  S yo(S x) { ret 'ja + x; }
  S testMe(int x) { ret 'int; }
}

sclass DaStatic {
  sS sOK() { ret 'sJaOK; }
  static int yo(int x) { ret x+5; }
  sS yo(S x) { ret 'ja + x; }
}

p-exp {
  twice {
    assertEqualsVerbose('jaOK, call_cached(new Bla, 'ok));
    assertException(r { call_cached(new Bla, 'sOK) });
    assertEqualsVerbose(15, call_cached(new Bla, 'yo, 10));
    assertEqualsVerbose('jaX, call_cached(new Bla, 'yo, 'X));
    assertException(r { call_cached(new Bla, 'yoyo) });
    assertException(r { call_cached(new Bla, 'yo, 5.0) });
    assertException(r { call_cached(Bla, 'ok) }); // non-static method
    assertException(r { call_cached(new Bla, 'testMe, 'test) });
    
    assertException(r { call_cached(DaStatic, 'ok) });
    assertEqualsVerbose('sJaOK, call_cached(DaStatic, 'sOK));
    assertEqualsVerbose(15, call_cached(DaStatic, 'yo, 10));
    assertEqualsVerbose('jaX, call_cached(DaStatic, 'yo, 'X));
    assertException(r { call_cached(DaStatic, 'yoyo) });
    assertException(r { call_cached(DaStatic, 'yo, 5.0) });
  }
}

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: 364 / 1045
Referenced in: