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

38
LINES

< > BotCompany Repo | #1028000 // test_tok_defaultArguments

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (6267L/36K).

svoid test_tok_defaultArguments() {
  forEachLL(s -> print(applyTranspilationFunction tok_defaultArguments(s)),
    "public default void replaceValue(A oldValue, A newValue) {}",
    "static <A> ReturnType method(S arg1, S arg2 default blubb, S arg3) {}",
    "static S method(X a default new X(), S arg2) {}",
    "static S method(L<X> a default new L) {}",
    [[ifdef NoNanoHTTPD static virtual NanoHTTPD.Response serve404(S msg default "Not found") {]],
  );
  
  testTranspilationFunction tok_defaultArguments(
    "sS hjs(S script, O... _ default (O[]) null) {}",
      "sS hjs(S script) { return hjs(script, (O[]) null); }\n" +
      "sS hjs(S script, O... _) {}",
      
    "S a aka b(D e, F g default h) { ret i; }",
      "S a aka b(D e) { return a(e, h); }\n" +
      "S a aka b(D e, F g) { ret i; }",
      
    "S nuLike a aka b(D e, F g default h) { ret i; }",
      "S nuLike a aka b(D e) { return a(e, h); }\n" +
      "S nuLike a aka b(D e, F g) { ret i; }",
     
    // default methods 
    "default S bla(int i default 5) { ret str(i); }",
      "default S bla() { return bla(5); }\n" +
      "default S bla(int i) { ret str(i); }",
      
    // abstract methods
    "abstract S bla(int i default 5);",
      "S bla() { return bla(5); }\n" +
      "abstract S bla(int i);",
      
    // method in an interface
    "S bla(int i default 5);",
      "default S bla() { return bla(5); }\n" +
      "S bla(int i);",
  );
}

Author comment

Began life as a copy of #1027998

download  show line numbers  debug dex  old transpilations   

Travelled to 9 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1028000
Snippet name: test_tok_defaultArguments
Eternal ID of this version: #1028000/24
Text MD5: ad47f11a529a4f699ee69eef2abfe46d
Transpilation MD5: a107a29f927c7b0d4ad0f425d1663ed4
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-01-15 05:09:32
Source code size: 1477 bytes / 38 lines
Pitched / IR pitched: No / No
Views / Downloads: 196 / 390
Version history: 23 change(s)
Referenced in: [show references]