Bug 132207 - Cannot quick fix annotation member types
Summary: Cannot quick fix annotation member types
Status: RESOLVED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.2   Edit
Hardware: All Windows XP
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on: 133491
Blocks:
  Show dependency tree
 
Reported: 2006-03-16 12:38 EST by Xibin Zeng CLA
Modified: 2009-08-30 02:08 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 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.