Community
Participate
Working Groups
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.
Not APT-specific, but rather a UI issue: quick-fix needs to be able to import the class NeedsImportEnum.
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; }
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; }
Adjustment for repro: ----- package other; public class A { @MyAnnotation(NeedsImportEnum.HELLO) public void hello() { } }
Quick fix uses the code assist infrastructure to evaluate the type. I file bug 133491 as code assist is missing here.
As of now 'LATER' and 'REMIND' resolutions are no longer supported. Please reopen this bug if it is still valid for you.