boolean (OperationChain currentChain, List<OperationChain> result, int pathMaximalLength, ChainCompletionContext context) { MethodCall signature = currentChain.getHeadMethodCall(); if (signature == null) return false; RefChainOperation head = currentChain.getHead(); if (signature.isStatic() || context.hasQualifier(context.resolvePsiClass(head.getQualifierDef()))) { addChainIfNotPresent(currentChain, result); return true; } else if (currentChain.length() >= pathMaximalLength) { addChainIfNotPresent(currentChain.getHead() == signature ? currentChain : currentChain.removeHeadCast(context), result); return true; } return false; }