in legacy/java/piranha/src/main/java/com/uber/piranha/config/Config.java [154:178]
public ImmutableCollection<PiranhaMethodRecord> getMethodRecordsForName(
MethodInvocationTree mit, VisitorState state) {
String methodName = getMethodName(mit);
if (configMethodProperties.containsKey(methodName)) {
return configMethodProperties.get(methodName);
}
// Check if mit matches a method record for a method chain
ExpressionTree methodSelect = mit.getMethodSelect();
if (allowMethodChain() && methodSelect instanceof MemberSelectTree) {
ExpressionTree mstExpr = ((MemberSelectTree) methodSelect).getExpression();
if (mstExpr instanceof MethodInvocationTree) {
MethodInvocationTree chainedMIT = (MethodInvocationTree) mstExpr;
String chainedMethodName = getMethodName(chainedMIT) + "." + methodName;
// This ensures that we only match instance method invocations like
// abc.stale_flag().getValue() and not stale_flag().getValue()
if (chainedMIT.getMethodSelect() instanceof MemberSelectTree
&& Matchers.instanceMethod().anyClass().matches(chainedMIT, state)
&& configMethodProperties.containsKey(chainedMethodName))
return configMethodProperties.get(chainedMethodName);
}
}
return ImmutableSet.of();
}