List<TestDataFile> (PsiMethod method, Map<String, Computable<UValue>> argumentMap, HashSet<Pair<PsiMethod, Set<UExpression>>> proceed) { List<TestDataFile> result = new ArrayList<>(); return myTestDataPath == null ? result : ReadAction.compute(() -> { UMethod uMethod = (UMethod)UastContextKt.toUElement(method); if (uMethod == null) { return result; } String testMetaData = TestDataLineMarkerProvider.annotationValue(method, TestFrameworkConstants.TEST_METADATA_ANNOTATION_QUALIFIED_NAME); if (testMetaData != null) { result.add(new TestDataFile.LazyResolved(myTestDataPath + testMetaData)); return result; } uMethod.accept(new AbstractUastVisitor() { @Override public boolean visitCallExpression(@NotNull UCallExpression expression) { String callText = expression.getMethodName(); if (callText == null) return true; PsiMethod callee = expression.resolve(); if (callee != null && callee.hasModifierProperty(PsiModifier.ABSTRACT)) { final PsiClass calleeContainingClass = callee.getContainingClass(); if (calleeContainingClass != null && myContainingClass.isInheritor(calleeContainingClass, true)) { final PsiMethod implementation = myContainingClass.findMethodBySignature(callee, true); if (implementation != null) { callee = implementation; } } } Pair<PsiMethod, Set<UExpression>> methodWithArguments = new Pair<>(callee, new HashSet<>(expression.getValueArguments())); if (callee != null && proceed.add(methodWithArguments)) { boolean haveAnnotatedParameters = false; final PsiParameter[] psiParameters = callee.getParameterList().getParameters(); for (int i = 0, psiParametersLength = psiParameters.length; i < psiParametersLength; i++) { PsiParameter psiParameter = psiParameters[i]; final PsiModifierList modifierList = psiParameter.getModifierList(); if (modifierList != null && modifierList.hasAnnotation(TestFrameworkConstants.TEST_DATA_FILE_ANNOTATION_QUALIFIED_NAME)) { myFoundTestDataParameters = true; if (psiParameter.isVarArgs()) { processVarargCallArgument(expression, argumentMap, result); } else { processCallArgument(expression, argumentMap, result, i); } haveAnnotatedParameters = true; } } if (expression.getReceiver() == null && !haveAnnotatedParameters) { result.addAll(collectTestDataReferences(callee, buildArgumentMap(expression, callee), proceed)); } } return true; } private void processCallArgument(UCallExpression expression, Map<String, Computable<UValue>> argumentMap, Collection<TestDataFile> result, int index) { List<UExpression> arguments = expression.getValueArguments(); if (arguments.size() > index) { handleArgument(arguments.get(index), argumentMap, result); } } private void processVarargCallArgument(UCallExpression expression, Map<String, Computable<UValue>> argumentMap, Collection<TestDataFile> result) { List<UExpression> arguments = expression.getValueArguments(); for (UExpression argument : arguments) { handleArgument(argument, argumentMap, result); } } private void handleArgument(UExpression argument, Map<String, Computable<UValue>> argumentMap, Collection<TestDataFile> result) { UValue testDataFileValue = UEvaluationContextKt.uValueOf(argument, new TestDataEvaluatorExtension(argumentMap)); if (testDataFileValue instanceof UStringConstant) { result.add(new TestDataFile.LazyResolved(myTestDataPath + ((UStringConstant)testDataFileValue).getValue())); } } }); return result; }); }