Skip to content

Commit 71a6c0b

Browse files
authored
Add further tests to check for required casts from Object to Boxed primitives (#208)
The issue might also exist for other structures
1 parent 7f8d712 commit 71a6c0b

File tree

2 files changed

+82
-0
lines changed

2 files changed

+82
-0
lines changed

testData/results/pkg/TestCastObjectToPrimitive.dec

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,75 @@ public class TestCastObjectToPrimitive {
1313
short shorXor = (short)((Short)object1 ^ 58);
1414
long longXor = 8L ^ (Long)object1;
1515
boolean integerGe = (Integer)object1 <= 48;
16+
17+
public void method() {
18+
if (object1) {// 20
19+
System.out.println("Test");// 21
20+
}
21+
22+
while(!object1) {// 23
23+
System.out.println("Test2");// 24
24+
}
25+
26+
while(object1) {// 26
27+
System.out.println("Test3");// 27
28+
}
29+
}// 29
30+
}
31+
32+
class 'pkg/TestCastObjectToPrimitive' {
33+
method 'method ()V' {
34+
0 17
35+
1 17
36+
2 17
37+
6 17
38+
7 17
39+
8 17
40+
9 17
41+
c 18
42+
d 18
43+
e 18
44+
f 18
45+
10 18
46+
11 18
47+
14 21
48+
15 21
49+
16 21
50+
1a 21
51+
1b 21
52+
1c 21
53+
1d 21
54+
20 22
55+
21 22
56+
22 22
57+
23 22
58+
24 22
59+
25 22
60+
26 22
61+
27 22
62+
2b 25
63+
2c 25
64+
2d 25
65+
31 25
66+
32 25
67+
33 25
68+
37 26
69+
38 26
70+
39 26
71+
3a 26
72+
3b 26
73+
3c 26
74+
3d 26
75+
3e 26
76+
42 28
77+
}
1678
}
1779

80+
Lines mapping:
81+
20 <-> 18
82+
21 <-> 19
83+
23 <-> 22
84+
24 <-> 23
85+
26 <-> 26
86+
27 <-> 27
87+
29 <-> 29

testData/src/java8/pkg/TestCastObjectToPrimitive.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,16 @@ public class TestCastObjectToPrimitive {
1515
short shorXor = (short) ((Short) object1 ^ 58);
1616
long longXor = 8 ^ (Long) object1;
1717
boolean integerGe = (Integer) object1 <= 48;
18+
19+
public void method() {
20+
if ((Boolean) object1) {
21+
System.out.println("Test");
22+
}
23+
while (((Boolean) object1) == false) {
24+
System.out.println("Test2");
25+
}
26+
while ((Boolean) object1) {
27+
System.out.println("Test3");
28+
}
29+
}
1830
}

0 commit comments

Comments
 (0)