Skip to content

Commit

Permalink
Fix mismatch between number of parameter names and number of actual p…
Browse files Browse the repository at this point in the history
…arameters in JMethod for inner class
  • Loading branch information
silverbullettt committed Nov 26, 2023
1 parent 97b569c commit cfaf609
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/main/java/pascal/taie/frontend/soot/Converter.java
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,21 @@ private static List<AnnotationHolder> convertParamAnnotations(
@Nullable
private static List<String> convertParamNames(
SootMethod sootMethod) {
// in Soot, each ParamNamesTag contains the names of all parameters in the SootMethod
// in Soot, each ParamNamesTag contains the names of all parameters
// in the SootMethod, except the case explained below.
var tag = (ParamNamesTag) sootMethod.getTag(ParamNamesTag.NAME);
return tag == null || tag.getNames().isEmpty() ? null : tag.getNames();
if (tag != null) {
List<String> names = tag.getNames();
if (names.size() == sootMethod.getParameterCount()) {
// when using Soot's source (.java) front end to process
// non-static inner class, the number of names in ParamNamesTag
// may be **less than** the number of actually parameters
// (lack of the implicit "this" variable for the outer instance).
// For such case, we ignore ParamNamesTag to avoid mismatch
// between numbers of parameter names and actual parameters.
return names;
}
}
return null;
}
}

0 comments on commit cfaf609

Please sign in to comment.