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

Bug 329921

Summary: Organize Imports creates illegal import statement on javadoc {@link EmbeddedClass} tag
Product: [Eclipse Project] JDT Reporter: Sebastian Haufe <eclipse>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: minor    
Priority: P3 CC: eclipse, Olivier_Thomann
Version: 3.6   
Target Milestone: 3.6.1   
Hardware: PC   
OS: All   
Whiteboard:

Description Sebastian Haufe CLA 2010-11-10 11:33:35 EST
Build Identifier: 20100617-1415

Organize Imports creates an import statement for an embedded class/interface/enum linked by the javadoc {@link} tag.

1. The import leads to a compile error if the class exists in the default package.

2. The import is unused if the class exists in a package: The import foo.OrganizeImportBug.SomeClass is never used


OrganizeImportBug.java
----------------------------------------------------------------------------
import OrganizeImportBug.SomeClass; // generated by Eclipse Organize Imports

/** {@link SomeClass} */
public class OrganizeImportBug {
  public class SomeClass {}
}


Shell:
----------------------------------------------------------------------------
$ javac OrganizeImportBug.java 
OrganizeImportBug.java:1: package OrganizeImportBug does not exist
import OrganizeImportBug.SomeClass;
                        ^
1 error

Workaround: Use {@link OrganizeImportBug.SomeClass} instead.

Reproducible: Always
Comment 1 Olivier Thomann CLA 2010-11-10 11:54:18 EST
I could reproduce in 3.6.0, but not in 3.6.1.
This looks like a duplicate of bug 319860

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