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

1  
scope test_unstructureMissingClassToBaseClass.
2  
3  
concept #Blu { Blu ref; }
4  
concept #Bla > Blu {}
5  
concept #Blo > Bla {} // twice derived
6  
7  
// make sure best base class is used
8  
svoid test_unstructureMissingClassToBaseClass() {
9  
  IF1<S, Class> classFinder = name -> {
10  
    if (eqOneOf(name, className(Bla), className(Blo))) null;
11  
    ret (Class) callF(_defaultClassFinder(), name);
12  
  };
13  
  
14  
  for (Class<? extends Bla> c : ll(Bla, Blo)) {
15  
    new structure_Data data;
16  
    data.storeBaseClasses = true;
17  
    Bla b = unlisted(c);
18  
    b.ref = b;
19  
    S struct = structure(b, data);
20  
    print(+struct);
21  
    O o = unstructure(struct, classFinder);
22  
    assertEqualsVerbose(Blu.class, _getClass(o));
23  
    assertSameVerbose(o, o/Blu.ref);
24  
  }
25  
}
26  
27  
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: 205 / 332
Version history: 17 change(s)
Referenced in: [show references]