Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CopyClassRefactoring broken by d2b8d987e3b73d05c79fd75cfe7b57c3cc3d4c6c #1236

Merged
merged 1 commit into from
Dec 20, 2023

Conversation

blairmcg
Copy link
Contributor

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.

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.
@blairmcg blairmcg merged commit f2b1b56 into master Dec 20, 2023
0 of 2 checks passed
@blairmcg blairmcg deleted the blairmcg/copyclassfix branch December 20, 2023 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant