Bug 14852 - Organize Import: missing import
Summary: Organize Import: missing import
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P1 normal (vote)
Target Milestone: 2.0 M6   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-04-29 11:38 EDT by Dirk Baeumer CLA
Modified: 2002-04-30 11:01 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Baeumer CLA 2002-04-29 11:38:46 EDT
Build 20020425.3

- load AboutDialog from JUnit. 
- organize imports

observe: missing import Dialog
Comment 1 Martin Aeschlimann CLA 2002-04-30 05:21:14 EDT
Resolving the simple name 'Dialog' resolves in a TypeBinding to 
name= "junit.awtui.AboutDialog"
Comment 2 Martin Aeschlimann CLA 2002-04-30 07:44:36 EDT
20020425.JDTCore.04.30

	public void foo() throws IOException {
	}

IOExpception is resolved as method reference


This code looks wrong: DefaultBindingResolver.resolveName

		ASTNode parent = name.getParent();
		if (parent instanceof MethodDeclaration) {
			return this.resolveMethod((MethodDeclaration)parent);
		}
		if (parent instanceof TypeDeclaration) {
			return this.resolveType((TypeDeclaration)parent);
		}
<< should also test if name.equals((MethodDeclaration) parent).getName())
Comment 3 Olivier Thomann CLA 2002-04-30 10:18:15 EDT
Fixed and released in HEAD. Now Organize imports returns:
import java.awt.Button;
import 
java.awt.Dialog;
import java.awt.Font;
import java.awt.Frame;
import 
java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import 
java.awt.Insets;
import java.awt.Label;
import java.awt.event.ActionEvent;
import 
java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import 
java.awt.event.WindowEvent;

for the class junit.awtui.AboutDialog. The IOException in 
a throws clause is now returned as a ITypeBinding.
Comment 4 Martin Aeschlimann CLA 2002-04-30 10:57:14 EDT
is this in 20020430?
Comment 5 Olivier Thomann CLA 2002-04-30 11:01:59 EDT
I guess so. I didn't see the drop done yet, so it should be included in the today's drop.