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

Libraryless. Click here for Pure Java version (9482L/67K).

!7

sclass A {
  class InnerA {}
}

sclass B extends A {
  class InnerB extends InnerA { B outer() { ret B.this; } }
  
  *() { new InnerB; }
}

p-exp {
  O o = new B().new InnerB();
  printObjectLayout(o);
  print(struct(o));
  B.InnerB b = cast restructure(o);
  assertNotNull(b.outer());
  print("OK");
}

Author comment

Began life as a copy of #1025130

download  show line numbers  debug dex   

Travelled to 2 computer(s): mqqgnosmbjvj, tvejysmllsmz

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: c61962bd0d088272102e6e1805883558
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: 23 / 79
Version history: 7 change(s)
Referenced in: [show references]