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

30
LINES

< > BotCompany Repo | #1025161 // Crazy non-static inner classes subclassing experiment v2

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

Download Jar. Libraryless. Click here for Pure Java version (9550L/67K).

1  
!7
2  
3  
sclass A {
4  
  class Inner {
5  
    void check {
6  
      print("Father: " + A.this);
7  
      assertNotNull(A.this);
8  
      print("OK");
9  
    }
10  
  }
11  
}
12  
13  
sclass B extends A {
14  
  class Inner extends A.Inner {
15  
  }
16  
  
17  
  *() { new Inner; }
18  
}
19  
20  
p-exp {
21  
  print(asList(thisDollarOneFields(B.Inner.class)));
22  
  B.Inner o = new B().new Inner();
23  
  printObjectLayout(o);
24  
  o.check();
25  
  S s = print(structure(o));
26  
  B.Inner o_broken = cast unstructure(s);
27  
  //fixOuterRefs(o_broken);
28  
  print(structure(o_broken));
29  
  o_broken.check();
30  
}

Author comment

Began life as a copy of #1025130

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1025161
Snippet name: Crazy non-static inner classes subclassing experiment v2
Eternal ID of this version: #1025161/15
Text MD5: bda209b8f63e505242957034c99bfd3b
Transpilation MD5: b1b4662c49054d5ea11653cdefc32522
Author: stefan
Category: javax
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-09-09 23:49:44
Source code size: 539 bytes / 30 lines
Pitched / IR pitched: No / No
Views / Downloads: 198 / 778
Version history: 14 change(s)
Referenced in: [show references]