PsiExpression (@NotNull PsiElement context, @NotNull PsiType psiType, @NotNull String fileVarName) { String initializerText = "java.nio.file.Files.readAttributes(" + fileVarName + ".toPath()" + "," + psiType.getCanonicalText() + ".class" + ")"; return PsiElementFactory.getInstance(context.getProject()).createExpressionFromText(initializerText, context); }