Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 579273

Summary: Organize Imports buggy in case of Nested Records
Product: [Eclipse Project] JDT Reporter: Dirk Weissmann <dirweis>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: CLOSED MOVED QA Contact:
Severity: major    
Priority: P3 CC: peter.metternich, rolf.theunissen, wim.jongman
Version: 4.13   
Target Milestone: ---   
Hardware: PC   
OS: Windows 10   
Whiteboard:
Attachments:
Description Flags
The unnecessary import from the Save Action 'Organize imports'
none
Simple test project none

Description Dirk Weissmann CLA 2022-03-16 03:24:52 EDT
Created attachment 288222 [details]
The unnecessary import from the Save Action 'Organize imports'

In respect to daily work the severity is rather "critical" but I think "major" will do it in a first try.

In case of nested records the 'Organize imports' Save Action creates import lines for the nested records in the parent record that get marked as Warnings since those import statements are useless.
Comment 1 Wim Jongman CLA 2022-03-16 07:12:49 EDT
Dirk, Eclipse 4.23 is out today. Please try with this release first and let us know if the problem still exists there.
Comment 2 Peter Metternich CLA 2022-12-07 09:55:12 EST
Created attachment 288873 [details]
Simple test project

Wim, retested with the current release 2022-09 and the RC for 2022-12 as well (Version: 2022-12 (4.26.0) - Build id: 20221201-1913).

The issue is still there. To reproduce:

1. Import attached project EclipseBug-579273
2. See the warning "unused import" on Rec.java:3
3. Manually delete line 3 & save
4. Execute Source -> Organize Imports and find the unused import again
Comment 3 Wim Jongman CLA 2022-12-07 09:59:16 EST
The issue tracker has moved. Please file a new issue here:

https://github.com/eclipse-jdt/eclipse.jdt.core
Comment 4 Peter Metternich CLA 2022-12-07 10:19:46 EST
GitHub issue: https://github.com/eclipse-jdt/eclipse.jdt.core/issues/232