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

32
LINES

< > BotCompany Repo | #1026391 // Test swappable (OK)

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

Download Jar. Transpiled version (15332L) is out of date.

!7

//import javax.validation.constraints.NotNull;

sclass Bla {
  swappable S hello() { ret "yo"; }
  swappable void bla() {}
  swappable void blu(S s) { print(s); }
  persistently swappable void blo(S s) { print(s); }
  //swappable void notNullTest(@NotNull S s) { print(s); }
}

static swappable S staticTest() { null; }
swappable static S staticTest2() { null; }
swappable static S staticTest3(Long a, int b) { null; }
swappable static bool staticTest4() { false; }
swappable static LS staticTest5() { null; }

p-exp {
  new Bla bla;
  
  // normal call
  assertEqualsVerbose("yo", bla.hello());
  
  // override method at runtime (!)
  bla.hello = () -> "Here is random stuff: " + randomID();
  
  // overridden call
  assertStartsWith_rev("Here is random stuff:", print(bla.hello()));
  
  print("OK");
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1026391
Snippet name: Test swappable (OK)
Eternal ID of this version: #1026391/21
Text MD5: a6acb9110b7e1a464a5aa5edba897870
Author: stefan
Category: javax
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-08-20 17:40:22
Source code size: 841 bytes / 32 lines
Pitched / IR pitched: No / No
Views / Downloads: 254 / 766
Version history: 20 change(s)
Referenced in: [show references]