Bug 77398 - [1.5] Organize imports does not honor enum types [code manipulation]
Summary: [1.5] Organize imports does not honor enum types [code manipulation]
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: 3.1 M4   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 78011 78716 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-11-01 13:02 EST by Tobias Widmer CLA
Modified: 2004-12-15 11:29 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tobias Widmer CLA 2004-11-01 13:02:43 EST
200410260800: When running organize imports on a cu with references to enum 
types, existing imports to enum types are incorrectly removed
Comment 1 Dirk Baeumer CLA 2004-11-01 13:28:47 EST
Enums aren't part of the all types cache yet. Assume that they aren't reported
as a result of the all types search.

Moving to JDT/Core.
Comment 2 Olivier Thomann CLA 2004-11-06 09:42:08 EST
*** Bug 78011 has been marked as a duplicate of this bug. ***
Comment 3 Frederic Fusier CLA 2004-11-12 15:42:10 EST
Enums are reported by all types cache since JDT/Core v_516 (ie 2004/10/26)...
Let's say 3.1 M3 to make simpler...
Using last integration build, when you hit Ctrl-Shift-T, you are able to see
enumerations in proposed list.
However, organize imports still remove all references to enum types...
Back to JDT/UI
Comment 4 Martin Aeschlimann CLA 2004-11-15 07:11:59 EST
Could reproduce:
--- MyEnum.java:
package pack;
public enum MyEnum { A, B, C  ]
--- A.java
package other;
import pack.MyEnum;
public class A {
  MyEnum enum;
}
-> organize imports on A removes the import

The problem is that the binding of the enum reports

isTopLevel() == false and isMember() == false
should be 
isTopLevel() == true
back to jdt.core
Comment 5 Olivier Thomann CLA 2004-11-15 11:38:41 EST
Fixed and released in HEAD.
Regression test added. See test57 of ASTConverterTest15
Comment 6 Martin Aeschlimann CLA 2004-11-16 11:35:03 EST
*** Bug 78716 has been marked as a duplicate of this bug. ***
Comment 7 Jerome Lanneluc CLA 2004-12-14 09:50:12 EST
Could not find any test case for this bug ? ASTConverter15Test#test0057 is not
about this bug. Olivier what is the test case ?
Comment 8 Joe Bowbeer CLA 2004-12-14 10:00:22 EST
ImportOrganizeTest.test_bug78716 is test case?

Also see sample code in Bug 78011
Comment 9 Frederic Fusier CLA 2004-12-15 11:27:16 EST
Joe, this is not the JDT/Core test case, ImportOrganizerTests is a JDT/UI test
class. Of course, as bug 78716 is a duplicate, this test verifies that bug 77398
is fixed, but we wanted to verify also that JDT/Core have a specific test to
verify it...

In fact, test case test057 in ASTConverter15Test was modified to add
verification that enum binding isTopLevel() returns true...

By the way, verified for 3.1 M4 using build I200412142000 + ASTView 1.0.2
+
breakpoint at ASTViewerLabelProvider.getText(Object obj)
  condition: ((ASTNode)obj).getNodeType() == ASTNode.IMPORT_DECLARATION
+
code snippet in Debugger Display view:
org.eclipse.jdt.core.dom.ImportDeclaration decl =
(org.eclipse.jdt.core.dom.ImportDeclaration) obj;
((org.eclipse.jdt.core.dom.ITypeBinding)decl.resolveBinding()).isTopLevel();
Comment 10 Frederic Fusier CLA 2004-12-15 11:29:49 EST
*** Bug 78716 has been marked as a duplicate of this bug. ***