Bug 132207

Summary: Cannot quick fix annotation member types
Product: [Eclipse Project] JDT Reporter: Xibin Zeng <xzeng>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: RESOLVED INVALID QA Contact:
Severity: major    
Priority: P3 CC: jgarms, xzeng
Version: 3.2Keywords: needinfo
Target Milestone: ---   
Hardware: All   
OS: Windows XP   
Whiteboard:
Bug Depends on: 133491    
Bug Blocks:    

Description Xibin Zeng CLA 2006-03-16 12:38:05 EST
If you use an annotation that contains a member whose type hasn't been imported, quick fix does not know how to fix it by adding an import statement. For example:

@MyAnnotation(field=NeedsImportEnum.HELLO)
public void hello() {
}

Eclipse is able to fix MyAnnotation by importing the type; it is unable to import the NeedsImportEnum type.
Comment 1 Jess Garms CLA 2006-03-16 12:41:52 EST
Not APT-specific, but rather a UI issue: quick-fix needs to be able to import the class NeedsImportEnum.
Comment 2 Martin Aeschlimann CLA 2006-03-21 14:22:12 EST
I tried to reproduce, but this works for me:
Quick fix on the error suggests to import NeedsImportEnum.
Maybe you have NeedsImportEnum in the default package?

Maybe you can add a reproducable example.

-----
package pack;
public class A {
	@MyAnnotation(field=NeedsImportEnum.HELLO)
	public void hello() {
	}
}
-----
package pack;
public @interface MyAnnotation {
	String field();
}
------
package pack.other;
public enum NeedsImportEnum {
	HELLO;
}

Comment 3 Xibin Zeng CLA 2006-03-22 11:33:03 EST
Thanks for trying to repro the problem. I realized that my case had a bit of twist... I modified your repro a little, see below:

-----
package pack;
public class A {
        @MyAnnotation(NeedsImportEnum.HELLO)
        public void hello() {
        }
}
-----
package pack;
public @interface MyAnnotation {
        NeedsImportEnum value();
        boolean value2() default false;
}
------
package pack;
public enum NeedsImportEnum {
        HELLO;
}
Comment 4 Xibin Zeng CLA 2006-03-22 12:03:46 EST
Adjustment for repro:

-----
package other;
public class A {
        @MyAnnotation(NeedsImportEnum.HELLO)
        public void hello() {
        }
}
Comment 5 Martin Aeschlimann CLA 2006-03-28 05:34:48 EST
Quick fix uses the code assist infrastructure to evaluate the type. I file bug 133491 as code assist is missing here.
Comment 6 Denis Roy CLA 2009-08-30 02:08:11 EDT
As of now 'LATER' and 'REMIND' resolutions are no longer supported.
Please reopen this bug if it is still valid for you.