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

Bug:Move interface method causes compilation errors. #1299

Closed
DongChunHao opened this issue Apr 2, 2024 · 1 comment · Fixed by #1411
Closed

Bug:Move interface method causes compilation errors. #1299

DongChunHao opened this issue Apr 2, 2024 · 1 comment · Fixed by #1411
Assignees
Labels
bug Something isn't working
Milestone

Comments

@DongChunHao
Copy link
Contributor

move interfaceMethod() to MyClass to classes causes compilation errors

interface MyInterface {
// move interfaceMethod() to MyClass;
void interfaceMethod();
}

class MyClass implements MyInterface {

@Override
public void interfaceMethod() {
	
}

}

Refactoring results:
image

@jjohnstn jjohnstn self-assigned this May 15, 2024
@jjohnstn jjohnstn added the bug Something isn't working label May 15, 2024
@jjohnstn jjohnstn added this to the 4.32 M3 milestone May 15, 2024
@jjohnstn
Copy link
Contributor

@DongChunHao This move is a textual move which means it is a cut/paste operation without checking hierarchy, implementers, etc... I have created a patch that will restrict moving an interface method to anything other than another interface (something a user may reasonably want to do). IMO, this is a reasonable check as moving such a method declaration anywhere else makes no sense. As mentioned, there is no additional checking done (e.g. verifying that there aren't any implementers out there that will be broken when the method is moved).

jjohnstn added a commit to jjohnstn/eclipse.jdt.ui-1 that referenced this issue May 16, 2024
- fix
  ReorgPolicyFactory.MoveSubCuElementsPolicy.validateDestination() to
  restrict moving an interface member to anything other than another
  interface
- add new test to MoveMemberTests
- fixes eclipse-jdt#1299
jjohnstn added a commit that referenced this issue May 16, 2024
- fix
  ReorgPolicyFactory.MoveSubCuElementsPolicy.validateDestination() to
  restrict moving an interface member to anything other than another
  interface
- add new test to MoveMemberTests
- fixes #1299
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants