@@ -635,7 +635,7 @@ private void addAsClassDefItem(SootClass c) {
635
635
fields = new ArrayList <Field >();
636
636
for (SootField f : c .getFields ()) {
637
637
// We do not want to write out phantom fields
638
- if (f . isPhantom ( )) {
638
+ if (isIgnored ( f )) {
639
639
continue ;
640
640
}
641
641
@@ -1077,15 +1077,15 @@ private List<Annotation> buildMemberClassesAttribute(SootClass parentClass, Inne
1077
1077
return anns ;
1078
1078
}
1079
1079
1080
- private Collection <Method > toMethods (SootClass clazz ) {
1080
+ protected Collection <Method > toMethods (SootClass clazz ) {
1081
1081
if (clazz .getMethods ().isEmpty ()) {
1082
1082
return null ;
1083
1083
}
1084
1084
1085
1085
String classType = SootToDexUtils .getDexTypeDescriptor (clazz .getType ());
1086
1086
List <Method > methods = new ArrayList <Method >();
1087
1087
for (SootMethod sm : clazz .getMethods ()) {
1088
- if (sm . isPhantom ( )) {
1088
+ if (isIgnored ( sm )) {
1089
1089
// Do not print method bodies for inherited methods
1090
1090
continue ;
1091
1091
}
@@ -1119,7 +1119,29 @@ private Collection<Method> toMethods(SootClass clazz) {
1119
1119
return methods ;
1120
1120
}
1121
1121
1122
- private MethodImplementation toMethodImplementation (SootMethod m ) {
1122
+ /**
1123
+ * Checks whether the given method shall be ignored, i.e., not written out to dex
1124
+ *
1125
+ * @param sm
1126
+ * The method to check
1127
+ * @return True to ignore the method while writing the dex file, false to write it out as normal
1128
+ */
1129
+ protected boolean isIgnored (SootMethod sm ) {
1130
+ return sm .isPhantom ();
1131
+ }
1132
+
1133
+ /**
1134
+ * Checks whether the given field shall be ignored, i.e., not written out to dex
1135
+ *
1136
+ * @param sf
1137
+ * The field to check
1138
+ * @return True to ignore the field while writing the dex file, false to write it out as normal
1139
+ */
1140
+ protected boolean isIgnored (SootField sf ) {
1141
+ return sf .isPhantom ();
1142
+ }
1143
+
1144
+ protected MethodImplementation toMethodImplementation (SootMethod m ) {
1123
1145
if (m .isAbstract () || m .isNative ()) {
1124
1146
return null ;
1125
1147
}
@@ -1257,7 +1279,7 @@ private MethodImplementation toMethodImplementation(SootMethod m) {
1257
1279
builder .addEndLocal (registersLeft );
1258
1280
}
1259
1281
1260
- toTries (activeBody .getTraps (), stmtV , builder , labelAssinger );
1282
+ toTries (activeBody .getTraps (), builder , labelAssinger );
1261
1283
1262
1284
// Make sure that all labels have been placed by now
1263
1285
for (Label lbl : labelAssinger .getAllLabels ()) {
@@ -1497,7 +1519,7 @@ private void addRegisterAssignmentDebugInfo(LocalRegisterAssignmentInformation r
1497
1519
seenRegisters .put (local , register );
1498
1520
}
1499
1521
1500
- private void toInstructions (Collection <Unit > units , StmtVisitor stmtV , Set <Unit > trapReferences ) {
1522
+ protected void toInstructions (Collection <Unit > units , StmtVisitor stmtV , Set <Unit > trapReferences ) {
1501
1523
// Collect all constant arguments to monitor instructions and
1502
1524
// pre-alloocate their registers
1503
1525
Set <ClassConstant > monitorConsts = new HashSet <ClassConstant >();
@@ -1523,8 +1545,7 @@ private void toInstructions(Collection<Unit> units, StmtVisitor stmtV, Set<Unit>
1523
1545
stmtV .finalizeInstructions (trapReferences );
1524
1546
}
1525
1547
1526
- private void toTries (Collection <Trap > traps , StmtVisitor stmtV , MethodImplementationBuilder builder ,
1527
- LabelAssigner labelAssigner ) {
1548
+ protected void toTries (Collection <Trap > traps , MethodImplementationBuilder builder , LabelAssigner labelAssigner ) {
1528
1549
// Original code: assume that the mapping startCodeAddress -> TryItem is
1529
1550
// enough for
1530
1551
// a "code range", ignore different end Units / try lengths
0 commit comments