File tree 12 files changed +110
-0
lines changed
12 files changed +110
-0
lines changed Original file line number Diff line number Diff line change
1
+ class A {
2
+ }
3
+
4
+ class B extends A {
5
+ }
6
+
7
+ public class Test {
8
+
9
+ public boolean foo (A x ) {
10
+ if (x instanceof A ) {
11
+ return true ;
12
+ } else {
13
+ return false ;
14
+ }
15
+ }
16
+ }
Original file line number Diff line number Diff line change
1
+ /*
2
+ old.jar needs to be created by first adding B.class and Test.class and then
3
+ updated to add A.class. This makes the class loader load the classes A and B
4
+ in reverse order.
5
+ */
6
+
7
+ class A {
8
+ }
9
+
10
+ class B extends A {
11
+ }
12
+
13
+ public class Test {
14
+
15
+ public boolean foo (A x ) {
16
+ if (x instanceof A ) {
17
+ return true ;
18
+ } else {
19
+ return false ;
20
+ }
21
+ }
22
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ new.jar
3
+ old.jar
4
+ // Enable multi-line checking
5
+ activate-multi-line-match
6
+ EXIT=0
7
+ SIGNAL=0
8
+ new functions:\nmodified functions:\ndeleted functions:
9
+ --
10
+ ^warning: ignoring
Original file line number Diff line number Diff line change
1
+ class A {
2
+ boolean bar () {
3
+ return true ;
4
+ }
5
+ }
6
+
7
+ class B extends A {
8
+ boolean bar () {
9
+ return false ;
10
+ }
11
+ }
12
+
13
+ public class Test {
14
+
15
+ public boolean foo (A x ) {
16
+ return x .bar ();
17
+ }
18
+ }
Original file line number Diff line number Diff line change
1
+ /*
2
+ old.jar needs to be created by first adding B.class and Test.class and then
3
+ updated to add A.class. This makes the class loader load the classes A and B
4
+ in reverse order.
5
+ */
6
+
7
+ class A {
8
+ boolean bar () {
9
+ return true ;
10
+ }
11
+ }
12
+
13
+ class B extends A {
14
+ boolean bar () {
15
+ return false ;
16
+ }
17
+ }
18
+
19
+ public class Test {
20
+
21
+ public boolean foo (A x ) {
22
+ return x .bar ();
23
+ }
24
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ new.jar
3
+ old.jar
4
+ // Enable multi-line checking
5
+ activate-multi-line-match
6
+ EXIT=0
7
+ SIGNAL=0
8
+ new functions:\nmodified functions:\ndeleted functions:
9
+ --
10
+ ^warning: ignoring
Original file line number Diff line number Diff line change @@ -87,6 +87,14 @@ std::size_t remove_instanceoft::lower_instanceof(
87
87
std::vector<irep_idt> children=
88
88
class_hierarchy.get_children_trans (target_name);
89
89
children.push_back (target_name);
90
+ // Sort alphabetically to make order of generated disjuncts
91
+ // independent of class loading order
92
+ std::sort (
93
+ children.begin (),
94
+ children.end (),
95
+ [](const irep_idt &a, const irep_idt &b) { // NOLINT
96
+ return a.compare (b) < 0 ;
97
+ });
90
98
91
99
// Insert an instruction before the new check that assigns the clsid we're
92
100
// checking for to a temporary, as GOTO program if-expressions should
Original file line number Diff line number Diff line change @@ -445,6 +445,8 @@ void remove_virtual_functionst::get_functions(
445
445
has_prefix (
446
446
id2string (b.symbol_expr .get_identifier ()), " java::java.lang.Object" ))
447
447
return true ;
448
+ else if (a.symbol_expr .get_identifier () == b.symbol_expr .get_identifier ())
449
+ return a.class_id < b.class_id ;
448
450
else
449
451
return a.symbol_expr .get_identifier () < b.symbol_expr .get_identifier ();
450
452
});
You can’t perform that action at this time.
0 commit comments