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

37
LINES

< > BotCompany Repo | #1031242 // test_structure_with_thisDollar0 - ecj and javac differ in their use of this$0 or this$1

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (6073L/37K).

1  
scope test_structure_with_thisDollar0.
2  
3  
sclass Y {
4  
  sclass X {
5  
    O this$0;
6  
    S abc = "abc";
7  
  
8  
    *(Y *this$0) {}
9  
  }
10  
  
11  
  sclass X2 {
12  
    O this$1;
13  
    S abc = "abc";
14  
  
15  
    *(Y *this$1) {}
16  
  }
17  
}
18  
19  
svoid test_structure_with_thisDollar0() {
20  
  S s = structure(new Y.X(new Y));
21  
  assertEqualsVerbose("Y$X(this$0=Y, abc=\"abc\")", s);
22  
  Y.X x = cast unstructure(s);
23  
  assertTrueVerbose(x.this$0 instanceof Y);
24  
  assertEqualsVerbose("abc", x.abc);
25  
  
26  
  // test translation from this$1 to this$0
27  
  x = (Y.X) unstructure("Y$X(this$1=Y, abc=\"abc\")");
28  
  assertTrueVerbose(x.this$0 instanceof Y);
29  
  assertEqualsVerbose("abc", x.abc);
30  
  
31  
  // test translation from this$ß to this$1
32  
  Y.X2 x2 = cast unstructure("Y$X2(this$0=Y, abc=\"abc\")");
33  
  assertTrueVerbose(x2.this$1 instanceof Y);
34  
  assertEqualsVerbose("abc", x2.abc);
35  
}
36  
37  
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: #1031242
Snippet name: test_structure_with_thisDollar0 - ecj and javac differ in their use of this$0 or this$1
Eternal ID of this version: #1031242/12
Text MD5: 25c7084c00644005d12e4c6ebd940542
Transpilation MD5: 1c825c8031cbbe41a05125c0d5387de3
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-05-24 21:40:50
Source code size: 872 bytes / 37 lines
Pitched / IR pitched: No / No
Views / Downloads: 179 / 297
Version history: 11 change(s)
Referenced in: [show references]