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

20
LINES

< > BotCompany Repo | #1025152 // Try restructuring "crazy" inner classes (WORKS)

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

Download Jar. Libraryless. Click here for Pure Java version (11125L/73K).

1  
!7
2  
3  
sclass A {
4  
  class InnerA {}
5  
}
6  
7  
sclass B extends A {
8  
  class InnerB extends InnerA { B outer() { ret B.this; } }
9  
  
10  
  *() { new InnerB; }
11  
}
12  
13  
p-exp {
14  
  O o = new B().new InnerB();
15  
  printObjectLayout(o);
16  
  print(struct(o));
17  
  B.InnerB b = cast restructure(o);
18  
  assertNotNull(b.outer());
19  
  print("OK");
20  
}

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: #1025152
Snippet name: Try restructuring "crazy" inner classes (WORKS)
Eternal ID of this version: #1025152/8
Text MD5: dce1a1aae70435dc940289d1e9594dcc
Transpilation MD5: fd3716df69a1088c730273954dd24521
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 22:49:47
Source code size: 326 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 173 / 590
Version history: 7 change(s)
Referenced in: [show references]