Skip to content

Move Method refactoring causes name shadowing. #4300

Open

Description

@assdfsdafasfa

Select the "methodToBeMoved" in class SourceClass, and move to class TargetClass
Before refactoring

class TargetClass {
}
class SubClass extends TargetClass {
    static public void methodToBeMoved() {
    }
}

class SourceClass {
    TargetClass t;
    void methodToBeMoved() {
    }
}
class TargetClass {
    void methodToBeMoved() {
    }
}
class SubClass extends TargetClass {
    static public void methodToBeMoved() {
    }
}
class SourceClass {
    TargetClass t;
}

Error: This static method cannot hide the instance method from TargetClass

Activity

  1. fbricon commented on Jan 5, 2026

    @fbricon
    Collaborator

    What do you expect to happen here? It seems unreasonable to analyze the subtype hierarchy for an upcoming refactoring, before the build detecting the future error even occurred.

  2. assdfsdafasfa commented on Jan 8, 2026

    @assdfsdafasfa
    Author

    What do you expect to happen here? It seems unreasonable to analyze the subtype hierarchy for an upcoming refactoring, before the build detecting the future error even occurred.

    I would like to present warnings before performing the refactoring, allowing developers to decide for themselves whether to proceed. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions