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

!7

sclass A {
  class Inner {
    void check {
      print("Father: " + A.this);
      assertNotNull(A.this);
      print("OK");
    }
  }
}

sclass B extends A {
  class Inner extends A.Inner {
  }
  
  *() { new Inner; }
}

p-exp {
  print(asList(thisDollarOneFields(B.Inner.class)));
  B.Inner o = new B().new Inner();
  printObjectLayout(o);
  o.check();
  S s = print(structure(o));
  B.Inner o_broken = cast unstructure(s);
  //fixOuterRefs(o_broken);
  print(structure(o_broken));
  o_broken.check();
}

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: 387 / 1256
Version history: 14 change(s)
Referenced in: