use of org.sonar.java.model.AbstractTypedTree in project sonar-java by SonarSource.
the class Resolve method findMethodReference.
Resolution findMethodReference(Env env, List<JavaType> samMethodArgs, MethodReferenceTree methodRefTree) {
Tree expression = methodRefTree.expression();
JavaType expressionType = (JavaType) ((AbstractTypedTree) expression).symbolType();
String methodName = getMethodReferenceMethodName(methodRefTree.method().name());
Resolution resolution = findMethod(env, expressionType, methodName, samMethodArgs);
// JLS ยง15.13.1
if (secondSearchRequired(expression, expressionType, resolution.symbol, samMethodArgs)) {
resolution = findMethod(env, expressionType, methodName, samMethodArgs.stream().skip(1).collect(Collectors.toList()));
}
return resolution;
}
Aggregations