Skip to content

Commit bdda187

Browse files
committed
allow private constructors for lifecycle components by default (fixes #787)
1 parent 1ba4e69 commit bdda187

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

soot-infoflow/src/soot/jimple/infoflow/entryPointCreators/BaseEntryPointCreator.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,13 @@ public abstract class BaseEntryPointCreator implements IEntryPointCreator {
7878
private List<String> substituteClasses;
7979
private boolean allowSelfReferences = false;
8080
private boolean ignoreSystemClassParams = true;
81-
private boolean allowNonPublicConstructors = false;
81+
82+
/**
83+
* Specifies whether calls to private constructors shall be generated if no
84+
* public constructors are available. Apparently, Android accepts private
85+
* constructors for lifecycle components.
86+
*/
87+
private boolean allowNonPublicConstructors = true;
8288

8389
private final Set<SootMethod> failedMethods = new HashSet<>();
8490

@@ -588,10 +594,8 @@ protected Local generateClassConstructor(SootClass createdClass, Set<SootClass>
588594
if (createdClass.isInterface() || createdClass.isAbstract()) {
589595
return generateSubstitutedClassConstructor(createdClass, constructionStack, parentClasses);
590596
} else {
591-
// Find a constructor we can invoke. We do this first as we don't
592-
// want
593-
// to change anything in our method body if we cannot create a class
594-
// instance anyway.
597+
// Find a constructor we can invoke. We do this first as we don't want to change
598+
// anything in our method body if we cannot create a class instance anyway.
595599
List<SootMethod> constructors = new ArrayList<>();
596600
for (SootMethod currentMethod : createdClass.getMethods()) {
597601
if (!currentMethod.isConstructor())

0 commit comments

Comments
 (0)