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

27
LINES

< > BotCompany Repo | #1030942 // test_unstructureMissingClassToBaseClass (OK)

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

Libraryless. Click here for Pure Java version (16004L/103K).

scope test_unstructureMissingClassToBaseClass.

concept #Blu { Blu ref; }
concept #Bla > Blu {}
concept #Blo > Bla {} // twice derived

// make sure best base class is used
svoid test_unstructureMissingClassToBaseClass() {
  IF1<S, Class> classFinder = name -> {
    if (eqOneOf(name, className(Bla), className(Blo))) null;
    ret (Class) callF(_defaultClassFinder(), name);
  };
  
  for (Class<? extends Bla> c : ll(Bla, Blo)) {
    new structure_Data data;
    data.storeBaseClasses = true;
    Bla b = unlisted(c);
    b.ref = b;
    S struct = structure(b, data);
    print(+struct);
    O o = unstructure(struct, classFinder);
    assertEqualsVerbose(Blu.class, _getClass(o));
    assertSameVerbose(o, o/Blu.ref);
  }
}

end scope

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1030942
Snippet name: test_unstructureMissingClassToBaseClass (OK)
Eternal ID of this version: #1030942/18
Text MD5: e448be8e1471bd140fa8d4831402e55e
Transpilation MD5: 2d9755216d7f777556bb195ebb3fb7e0
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-06-09 04:44:01
Source code size: 763 bytes / 27 lines
Pitched / IR pitched: No / No
Views / Downloads: 203 / 329
Version history: 17 change(s)
Referenced in: [show references]