File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -88,17 +88,22 @@ private SootField resolve(StringBuffer trace) {
88
88
while (true ) {
89
89
if (trace != null ) trace .append (
90
90
"Looking in " +cl +" which has fields " +cl .getFields ()+"\n " );
91
+
92
+ // Check whether we have the field in the current class
91
93
if ( cl .declaresField (name , type ) ) {
92
94
return checkStatic (cl .getField (name , type ));
93
95
}
94
-
95
- if (Scene .v ().allowsPhantomRefs () && (cl .isPhantom () || Options .v ().ignore_resolution_errors ()))
96
- {
96
+
97
+ // If we have a phantom class, we directly construct a phantom field
98
+ // in it and don't care about superclasses.
99
+ if (Scene .v ().allowsPhantomRefs () && cl .isPhantom ()) {
97
100
SootField f = new SootField (name , type , isStatic ()?Modifier .STATIC :0 );
98
101
f .setPhantom (true );
99
102
cl .addField (f );
100
103
return f ;
101
- } else {
104
+ }
105
+ else {
106
+ // Since this class is not phantom, we look at its interfaces
102
107
LinkedList <SootClass > queue = new LinkedList <SootClass >();
103
108
queue .addAll ( cl .getInterfaces () );
104
109
while ( !queue .isEmpty () ) {
@@ -110,6 +115,9 @@ private SootField resolve(StringBuffer trace) {
110
115
}
111
116
queue .addAll ( iface .getInterfaces () );
112
117
}
118
+
119
+ // If we have not found a suitable field in the current class,
120
+ // try the superclass
113
121
if ( cl .hasSuperclass () ) cl = cl .getSuperclass ();
114
122
else break ;
115
123
}
You can’t perform that action at this time.
0 commit comments