String[] () { if (StringUtil.isEmpty(myInitialMethodName)) { final Set<String> initialMethodNames = new LinkedHashSet<>(); final JavaCodeStyleManagerImpl codeStyleManager = (JavaCodeStyleManagerImpl)JavaCodeStyleManager.getInstance(myProject); if (myExpression != null || !(myReturnType instanceof PsiPrimitiveType)) { final String[] names = codeStyleManager.suggestVariableName(VariableKind.FIELD, null, myExpression, myReturnType).names; for (String name : names) { initialMethodNames.add(codeStyleManager.variableNameToPropertyName(name, VariableKind.FIELD)); } } if (myOutputVariable != null) { final VariableKind outKind = codeStyleManager.getVariableKind(myOutputVariable); final SuggestedNameInfo nameInfo = codeStyleManager .suggestVariableName(VariableKind.FIELD, codeStyleManager.variableNameToPropertyName(myOutputVariable.getName(), outKind), null, myOutputVariable.getType()); for (String name : nameInfo.names) { initialMethodNames.add(codeStyleManager.variableNameToPropertyName(name, VariableKind.FIELD)); } } final String nameByComment = getNameByComment(); final PsiField field = JavaPsiFacade.getElementFactory(myProject).createField("fieldNameToReplace", myReturnType instanceof PsiEllipsisType ? ((PsiEllipsisType)myReturnType).toArrayType() : myReturnType); final List<String> getters = new ArrayList<>(ContainerUtil.map(initialMethodNames, propertyName -> { if (!PsiNameHelper.getInstance(myProject).isIdentifier(propertyName)) { LOG.info(propertyName + "; " + myExpression); return null; } field.setName(propertyName); return GenerateMembersUtil.suggestGetterName(field); })); ContainerUtil.addIfNotNull(getters, nameByComment); return ArrayUtilRt.toStringArray(getters); } return new String[] {myInitialMethodName}; }