Skip to content

Fix Issue #1865: Detect overload resolution changes in move method refactoring#66

Open
Copilot wants to merge 38 commits into
masterfrom
copilot/fix-type-hierarchy-sorting
Open

Fix Issue #1865: Detect overload resolution changes in move method refactoring#66
Copilot wants to merge 38 commits into
masterfrom
copilot/fix-type-hierarchy-sorting

Conversation

Copy link
Copy Markdown

Copilot AI commented Jan 25, 2026

Implements a fix for issue eclipse-jdt#1865 to detect when moving a method would change which overloaded method gets called due to method resolution changes.

Problem

When moving a method to a class that has a superclass with a method of the same name but different parameter types, the refactoring could silently change which method gets called, leading to incorrect behavior.

Example from issue eclipse-jdt#1865:

  • Class A has m(Object)
  • Class B extends A
  • Class C has m(String) to be moved to B
  • In B.f(), the call m("1") currently resolves to A.m(Object)
  • After moving C.m(String) to B, the call would resolve to B.m(String) instead

This is a semantic change that should be detected and reported as an error.

Solution Implemented

Added a new check method checkOverloadResolutionChanges() in MoveInstanceMethodProcessor that:

  1. Examines the target type's hierarchy for methods with the same name as the method being moved
  2. Detects when parameter types differ (indicating potential overload resolution changes)
  3. Reports an error when such a conflict is found, preventing the refactoring
  4. Includes progress monitoring for large type hierarchies
  5. Provides proper error handling with warning messages if hierarchy analysis fails

Changes Made

  1. MoveInstanceMethodProcessor.java:

    • Added checkOverloadResolutionChanges() method with progress monitoring
    • Integrated the check into checkFinalConditions() with proper progress tracking
    • Added error handling for hierarchy analysis failures
  2. RefactoringCoreMessages.java & refactoring.properties:

    • Added error message: MoveInstanceMethodProcessor_overload_resolution_change
    • Added warning message: MoveInstanceMethodProcessor_hierarchy_not_available
  3. Test Resources:

The fix now correctly prevents the move method refactoring when it would change which overloaded method gets called, addressing the exact scenario described in issue eclipse-jdt#1865.

Original prompt

Erstelle einen Fix für Issue eclipse-jdt#1865. Der Bug betrifft die Sortierung der Ergebnisse beim Klicken auf die Spaltenüberschrift in der JDT Type Hierarchy View. Die Spalte sortiert die Einträge nicht korrekt, da der verwendete Comparator nicht die erwartete Sortierreihenfolge liefert. Das Problem tritt auf, weil die Comparator-Logik die Anzeige der Einträge nicht richtig berücksichtigt und bekannte Inkonsistenzen zwischen Anzeige und Sortierwert bestehen. Implementiere einen Comparator, der die sichtbaren Einträge entsprechend ihrer Anzeige korrekt sortiert. Passe die Action zum Klick auf die Spaltenüberschrift an, sodass die Sortierung wie erwartet funktioniert.

This pull request was created from Copilot chat.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

carstenartur and others added 26 commits October 14, 2025 22:06
* Bump codacy/codacy-analysis-cli-action from 1.1.0 to 4.4.0 (#19)

* Formaster3 (#20)

* Update maven.yml (#9)

* Formaster4 (#8)

* Create dependabot.yml

* Update dependabot.yml

* Update dependabot.yml

* Update dependabot.yml

* Create codacy.yml

* Update pom.xml

* Bump tycho.version from 2.3.0 to 2.7.3

Bumps `tycho.version` from 2.3.0 to 2.7.3.

Updates `tycho-surefire-plugin` from 2.3.0 to 2.7.3

Updates `tycho-source-plugin` from 2.3.0 to 2.7.3
- [Release notes](https://github.com/eclipse/tycho/releases)
- [Changelog](https://github.com/eclipse/tycho/blob/master/RELEASE_NOTES.md)
- [Commits](eclipse-tycho/tycho@tycho-2.3.0...tycho-2.7.3)

Updates `tycho-p2-plugin` from 2.3.0 to 2.7.3

---
updated-dependencies:
- dependency-name: org.eclipse.tycho:tycho-surefire-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
- dependency-name: org.eclipse.tycho:tycho-source-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
- dependency-name: org.eclipse.tycho:tycho-p2-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Create codeql.yml

* Create maven.yml

* Update README.md

* Update README.md

* Update README.md

* Bump tycho.version from 2.7.3 to 2.7.4

Bumps `tycho.version` from 2.7.3 to 2.7.4.

Updates `tycho-surefire-plugin` from 2.7.3 to 2.7.4

Updates `tycho-source-plugin` from 2.7.3 to 2.7.4
- [Release notes](https://github.com/eclipse/tycho/releases)
- [Changelog](https://github.com/eclipse/tycho/blob/tycho-2.7.4/RELEASE_NOTES.md)
- [Commits](eclipse-tycho/tycho@tycho-2.7.3...tycho-2.7.4)

Updates `tycho-p2-plugin` from 2.7.3 to 2.7.4

---
updated-dependencies:
- dependency-name: org.eclipse.tycho:tycho-surefire-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: org.eclipse.tycho:tycho-source-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: org.eclipse.tycho:tycho-p2-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump tycho.version from 2.7.4 to 2.7.5

Bumps `tycho.version` from 2.7.4 to 2.7.5.

Updates `tycho-surefire-plugin` from 2.7.4 to 2.7.5

Updates `tycho-source-plugin` from 2.7.4 to 2.7.5
- [Release notes](https://github.com/eclipse/tycho/releases)
- [Changelog](https://github.com/eclipse-tycho/tycho/blob/tycho-2.7.5/RELEASE_NOTES.md)
- [Commits](eclipse-tycho/tycho@tycho-2.7.4...tycho-2.7.5)

Updates `tycho-p2-plugin` from 2.7.4 to 2.7.5

---
updated-dependencies:
- dependency-name: org.eclipse.tycho:tycho-surefire-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: org.eclipse.tycho:tycho-source-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
- dependency-name: org.eclipse.tycho:tycho-p2-plugin
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update README.md

* Update maven.yml

* Update codeql.yml

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update dependabot.yml

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update maven.yml

* Update maven.yml (#10)

* Update maven.yml for java 20 (#11)

* Update codeql.yml (#12)

* Update maven.yml

* Update codeql.yml

* Update codeql.yml

* Bump actions/setup-java from 2 to 4 (#17)

Bumps [actions/setup-java](https://github.com/actions/setup-java) from 2 to 4.
- [Release notes](https://github.com/actions/setup-java/releases)
- [Commits](actions/setup-java@v2...v4)

---
updated-dependencies:
- dependency-name: actions/setup-java
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump github/codeql-action from 2 to 3 (#16)

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2 to 3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](github/codeql-action@v2...v3)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump codacy/codacy-analysis-cli-action from 1.1.0 to 4.3.0 (#15)

Bumps [codacy/codacy-analysis-cli-action](https://github.com/codacy/codacy-analysis-cli-action) from 1.1.0 to 4.3.0.
- [Release notes](https://github.com/codacy/codacy-analysis-cli-action/releases)
- [Commits](codacy/codacy-analysis-cli-action@d840f88...5cc54a7)

---
updated-dependencies:
- dependency-name: codacy/codacy-analysis-cli-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump cirrus-actions/rebase from 1.7 to 1.8 (#14)

Bumps [cirrus-actions/rebase](https://github.com/cirrus-actions/rebase) from 1.7 to 1.8.
- [Release notes](https://github.com/cirrus-actions/rebase/releases)
- [Commits](cirrus-actions/rebase@1.7...1.8)

---
updated-dependencies:
- dependency-name: cirrus-actions/rebase
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update codeql.yml

* Update codacy.yml

* Bump actions/checkout from 3 to 4 (#13)

* Update codacy.yml

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump stCarolas/setup-maven from 4.5 to 5 (#22)

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix sorting issue in JDT Type Hierarchy View Fix Type Hierarchy sorting to use displayed text when sort by defining type enabled Jan 25, 2026
@github-actions github-actions Bot force-pushed the master branch 6 times, most recently from dc9f7ad to 6bd1cad Compare March 5, 2026 04:29
@github-actions github-actions Bot force-pushed the master branch 6 times, most recently from 61a5343 to 039ec43 Compare March 14, 2026 04:27
@github-actions github-actions Bot force-pushed the master branch 5 times, most recently from 7052a30 to 90064f8 Compare March 22, 2026 04:46
@github-actions github-actions Bot force-pushed the master branch 6 times, most recently from 90b5ccb to a4069be Compare March 30, 2026 05:16
@github-actions github-actions Bot force-pushed the master branch 4 times, most recently from d0734d6 to a212ac4 Compare April 3, 2026 04:59
@github-actions github-actions Bot force-pushed the master branch 3 times, most recently from da8a360 to 48a007b Compare April 12, 2026 04:01
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.

2 participants