CopyClassRefactoring broken by d2b8d987e3b73d05c79fd75cfe7b57c3cc3d4c6c #1236
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Since d2b8d98 AddClassRefactoring creates a class as described by ClassDetails, and this can include variables. This broke CopyClassRefactoring because it tried to add the variables as well after creating the class with them already defined, and there was a test gap so this went unnoticed.
The refactoring is enhanced to copy the variables of superclasses that it references. This ensures that the copied methods will compile. Any inherited but unreferenced variables are not copied. There might be place for copying down inherited methods that are not overriden and not common, but not for now. This is a refactoring since the existing behaviour of the system is preserved, even if the cloned class is not complete.
The preconditions for AddClassRefactoring should also have been enriched to validate the variables.