void (final PsiMethod subConstructor, final Set<PsiParameter> parametersToPassToSuper) { final PsiCodeBlock body = subConstructor.getBody(); if (body != null) { PsiMethodCallExpression superCall = null; final PsiStatement[] statements = body.getStatements(); if (statements.length > 0 && statements[0] instanceof PsiExpressionStatement) { final PsiExpression expression = ((PsiExpressionStatement)statements[0]).getExpression(); if (expression instanceof PsiMethodCallExpression methodCall && "super".equals(methodCall.getMethodExpression().getText())) { superCall = methodCall; } } final PsiElementFactory factory = JavaPsiFacade.getElementFactory(subConstructor.getProject()); try { if (superCall == null) { PsiExpressionStatement statement = (PsiExpressionStatement)factory.createStatementFromText("super();", null); statement = (PsiExpressionStatement)body.addAfter(statement, null); superCall = (PsiMethodCallExpression)statement.getExpression(); } final PsiExpressionList argList = superCall.getArgumentList(); for (final PsiParameter parameter : parametersToPassToSuper) { argList.add(factory.createExpressionFromText(parameter.getName(), null)); } } catch (IncorrectOperationException e) { LOG.error(e); } } }