void (@NotNull PsiRequiresStatement statementToDelete) { PsiElement parent = statementToDelete.getParent(); if (parent instanceof PsiJavaModule currentModule) { PsiJavaParserFacade parserFacade = JavaPsiFacade.getInstance(currentModule.getProject()).getParserFacade(); for (String dependencyName : myDependencies) { PsiStatement requiresStatement = parserFacade.createModuleStatementFromText(PsiKeyword.REQUIRES + ' ' + dependencyName, null); currentModule.addAfter(requiresStatement, statementToDelete); } } }