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

Bug 385059

Summary: [organize imports] fails if needed import is nested in a class in another project
Product: [Eclipse Project] JDT Reporter: Holger Wolf <hwolf>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: manju656, markus.kell.r, nikolaymetchev
Version: 3.8   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
example none

Description Holger Wolf CLA 2012-07-13 10:06:16 EDT
'Organize Imports' can not add the import if a class B or an enum B is nested in another class A and this A class is located in another project.

The attached project 'de.mekos.organizeimport.test' has a class 'de.mekos.organizeimport.test.Test' which shows the problem when trying to import 'de.mekos.organizeimport.test.sub.InvoiceOutgoing.InvoiceTypeClass'.

-- Configuration Details --
Product: Eclipse 1.5.0.20120131-1544 (org.eclipse.epp.package.rcp.product)
Installed Features:
 org.eclipse.jdt 3.8.0.v20120525-1249-8-8nFqlFNOfwKDRGz-pXLdGxEM83
Comment 1 Holger Wolf CLA 2012-07-13 10:07:48 EDT
Created attachment 218705 [details]
example
Comment 2 Martin Mathew CLA 2013-06-26 01:24:02 EDT
Reproducible using Eclipse build: I20130618-0800. 'Organize Imports' is not handling the scenario given in the attached example.

Interestingly the 'Quick Fix' is adding the imports correctly. We need to investigate in detail what is going wrong in 'Organize Imports'.
Comment 3 Nikolay Metchev CLA 2013-08-24 04:35:24 EDT
In the attached example the imports get ignored because of AccessRules on the classpath. It seems organize imports respects plugin API boundries whereas the quickfix doesn't.
Comment 4 Markus Keller CLA 2015-08-26 14:13:20 EDT

*** This bug has been marked as a duplicate of bug 473921 ***