Collection<PyElement> (@NotNull final PyClass from, @NotNull final Collection<PyAssignmentStatement> statements, final PyClass @NotNull ... to) { //TODO: Copy/paste with ClassFieldsManager. Move to parent? final List<PyElement> result = new ArrayList<>(); for (final PyClass destClass : to) { result.addAll(copyInstanceFields(statements, destClass)); } // Delete only declarations made in __init__ to prevent PY-12170 final PyFunction fromInitMethod = PyUtil.getInitMethod(from); if (fromInitMethod != null) { // If class has no init method that means all its fields declared in other methods, so nothing to remove deleteElements(Collections2.filter(statements, new InitsOnly(fromInitMethod))); //We can't leave class constructor with empty body } return result; }