boolean (PsiNewExpression newExpression, PsiType causeType) { if (newExpression == null || causeType == null) { return false; } final PsiMethod constructor = newExpression.resolveConstructor(); if (constructor == null) { return false; } final PsiClass aClass = constructor.getContainingClass(); if (aClass == null) { return false; } final PsiExpressionList argumentList = newExpression.getArgumentList(); if (argumentList == null) { return false; } final PsiExpression[] arguments = argumentList.getExpressions(); outer: for (PsiMethod constructor1 : aClass.getConstructors()) { final PsiParameterList parameterList = constructor1.getParameterList(); if (parameterList.getParametersCount() == arguments.length + 1) { final PsiParameter[] parameters = parameterList.getParameters(); for (int i = 0; i < arguments.length; i++) { final PsiExpression argument = arguments[i]; final PsiParameter parameter = parameters[i]; final PsiType type = argument.getType(); if (type == null || !parameter.getType().isAssignableFrom(type)) { continue outer; } } final PsiParameter lastParameter = parameters[parameters.length - 1]; if (!lastParameter.getType().isAssignableFrom(causeType) || !PsiUtil.isAccessible(constructor1, newExpression, null)) { continue; } return true; } } return false; }