GrMethod (@NotNull CallSignature<?> signature, @NotNull String name, @NotNull GrAssignmentExpression statement, @NotNull PsiClass closure) { final GrLightMethodBuilder builder = new GrLightMethodBuilder(statement.getManager(), name); int i = 0; for (CallParameter parameter : signature.getParameters()) { final String parameterName = ObjectUtils.notNull(parameter.getParameterName(), "p" + i); final PsiType type = ObjectUtils.notNull(parameter.getType(), () -> TypesUtil.getJavaLangObject(statement)); builder.addParameter(parameterName, type, parameter.isOptional()); i++; } builder.setNavigationElement(statement.getLValue()); builder.setReturnType(signature.getReturnType()); builder.setContainingClass(closure); return builder; }