Skip to content

Commit 27b7147

Browse files
committed
Remove unnecessary fields, improving code quality
1 parent a8c0108 commit 27b7147

File tree

1 file changed

+11
-22
lines changed

1 file changed

+11
-22
lines changed

soot-infoflow-android/src/soot/jimple/infoflow/android/entryPointCreators/AndroidEntryPointCreator.java

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -127,23 +127,10 @@ public class AndroidEntryPointCreator extends AbstractAndroidEntryPointCreator i
127127
// In other words, this set contains *all* possible components
128128
private Set<SootClass> allComponentClasses = new HashSet<>();
129129

130-
private String getResultIntentName;
131-
132-
private String setResultIntentName;
133-
134-
private String getIntentName;
135-
136-
private String setIntentName;
137-
138130
private static final String DEFAULT_COMPONENTDATAEXCHANGENAME = "ComponentDataExchangeInterface";
139131

140132
private SootClass componentDataExchangeInterface;
141133

142-
private SootMethod getResultIntentMethod;
143-
private SootMethod setResultIntentMethod;
144-
private SootMethod getIntentMethod;
145-
private SootMethod setIntentMethod;
146-
147134
private AbstractCollection<SootMethod> additionalMethods;
148135

149136
/**
@@ -167,11 +154,6 @@ public AndroidEntryPointCreator(IManifestHandler manifest, Collection<SootClass>
167154
allComponentClasses.addAll(h.getSubclassesOf(sc));
168155
}
169156
}
170-
getResultIntentName = findUniqueMethodName("getResultIntent", allComponentClasses);
171-
setResultIntentName = findUniqueMethodName("setResultIntent", allComponentClasses);
172-
// just choose a different name other than "getIntent"
173-
getIntentName = findUniqueMethodName("getDataIntent", allComponentClasses);
174-
setIntentName = findUniqueMethodName("setDataIntent", allComponentClasses);
175157

176158
ComponentExchangeInfo info = generateComponentDataExchangeInterface();
177159
initializeComponentDataTransferMethods(info);
@@ -185,18 +167,25 @@ private ComponentExchangeInfo generateComponentDataExchangeInterface() {
185167

186168
RefType intent = RefType.v("android.content.Intent");
187169
Scene sc = Scene.v();
188-
getResultIntentMethod = sc.makeSootMethod(getResultIntentName, Collections.emptyList(), intent,
170+
String getResultIntentName = findUniqueMethodName("getResultIntent", allComponentClasses);
171+
String setResultIntentName = findUniqueMethodName("setResultIntent", allComponentClasses);
172+
// just choose a different name other than "getIntent"
173+
String getIntentName = findUniqueMethodName("getDataIntent", allComponentClasses);
174+
String setIntentName = findUniqueMethodName("setDataIntent", allComponentClasses);
175+
176+
SootMethod getResultIntentMethod = sc.makeSootMethod(getResultIntentName, Collections.emptyList(), intent,
189177
Modifier.PUBLIC | Modifier.ABSTRACT);
190178
componentDataExchangeInterface.addMethod(getResultIntentMethod);
191-
getIntentMethod = sc.makeSootMethod(getIntentName, Collections.emptyList(), intent,
179+
SootMethod getIntentMethod = sc.makeSootMethod(getIntentName, Collections.emptyList(), intent,
192180
Modifier.PUBLIC | Modifier.ABSTRACT);
193181
componentDataExchangeInterface.addMethod(getIntentMethod);
194-
setIntentMethod = sc.makeSootMethod(setIntentName, Arrays.asList(intent), VoidType.v(),
182+
SootMethod setIntentMethod = sc.makeSootMethod(setIntentName, Arrays.asList(intent), VoidType.v(),
195183
Modifier.PUBLIC | Modifier.ABSTRACT);
196184
componentDataExchangeInterface.addMethod(setIntentMethod);
197-
setResultIntentMethod = sc.makeSootMethod(setResultIntentName, Arrays.asList(intent), VoidType.v(),
185+
SootMethod setResultIntentMethod = sc.makeSootMethod(setResultIntentName, Arrays.asList(intent), VoidType.v(),
198186
Modifier.PUBLIC | Modifier.ABSTRACT);
199187
componentDataExchangeInterface.addMethod(setResultIntentMethod);
188+
200189
ComponentExchangeInfo info = new ComponentExchangeInfo(componentDataExchangeInterface, getIntentMethod,
201190
setIntentMethod, getResultIntentMethod, setResultIntentMethod);
202191
componentToInfo.setComponentExchangeInfo(info);

0 commit comments

Comments
 (0)