| Summary: | [search][refactoring] Moving a class to another package does not update imports in classes in the same package but located in other projects | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Ralf Ellner <ellner> | ||||
| Component: | Core | Assignee: | JDT-Core-Inbox <jdt-core-inbox> | ||||
| Status: | CLOSED WONTFIX | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | CC: | noopur_gupta | ||||
| Version: | 4.6 | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Windows 10 | ||||||
| Whiteboard: | stalebug | ||||||
| Attachments: |
|
||||||
This used to work in Eclipse 3.8.1. The issue is that "ImplClass" is not returned in the references result for "APIClass" anymore by SearchEngine#search in RefactoringSearchEngine#internalSearch. It can also be seen by invoking Ctrl+Shift+G on "APIClass". This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |
Created attachment 262744 [details] Sample projects I'm using Eclipse 4.4 with JDT 3.10.1 but the bug is also present in Neon (4.6) with JDT 3.12.0. I created two sample projects to reproduce the problem. Project "API" contains two classes both located in package "com.foo": an empty class "APIClass" and an empty class "APIExtension" that extends "APIClass". Project "Impl" contains a single class "ImplClass" located in the same package "com.foo" that uses "APIClass": package com.foo; public class ImplClass { public APIClass aField; } Project "Impl" includes "API" on its buildpath. In the example I have declared a field of type APIClass but the problem also exists if you use APIClass, e.g., as type parameter, and method parameter type. All classes are in the same package. Thus, no import com.foo.APIClass is required in "ImplClass" and "APIExtension". If you move APIClass to another package, e.g., com.bar, the class "APIExtension" (in the same project) is correctly updated with an additional import com.bar.APIClass. However, "ImplClass" (in another project) is not updated and does no longer compile unless you add the import manually.