private static String generateUniqueVariableName(final @NonNls String className,
                                                   final Object2IntMap<String> class2variableIndex,
                                                   final PsiClass aClass) {
    final String shortName;
    if (className.startsWith("javax.swing.J")) {
      shortName = className.substring("javax.swing.J".length());
    }
    else {
      final int idx = className.lastIndexOf('.');
      if (idx != -1) {
        shortName = className.substring(idx + 1);
      }
      else {
        shortName = className;
      }
    }

    if (!class2variableIndex.containsKey(className)) {
      class2variableIndex.put(className, 0);
    }
    String result;
    do {
      class2variableIndex.mergeInt(className, 1, Math::addExact);
      int newIndex = class2variableIndex.getInt(className);

      result = Character.toLowerCase(shortName.charAt(0)) + shortName.substring(1) + newIndex;
    } while(aClass.findFieldByName(result, true) != null);
    return result;
  }
private static String generateUniqueVariableName(final @NonNls String className,
                                                   final Object2IntMap<String> class2variableIndex,
                                                   final PsiClass aClass)