This site is maintained for archival purposes only. Eclipse projects have transitioned to GitHub and Eclipse GitLab. Use the Projects search tool to locate your project and access its latest code and issue tracker.
Bug 409824 - Wrong import warning for imported annotations from superclass when using annotation processors.
Summary: Wrong import warning for imported annotations from superclass when using anno...
Status: CLOSED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: APT (show other bugs)
Version: 4.2   Edit
Hardware: PC Windows 7
: P3 normal with 6 votes (vote)
Target Milestone: ---   Edit
Assignee: Generic inbox for the JDT-APT component CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-04 05:40 EDT by Christian humer CLA
Modified: 2019-03-22 17:45 EDT (History)
2 users (show)

See Also:


Attachments
Test eclipse project to reproduce the problem. (8.54 KB, application/octet-stream)
2013-06-04 05:40 EDT, Christian humer CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christian humer CLA 2013-06-04 05:40:49 EDT
Created attachment 231920 [details]
Test eclipse project to reproduce the problem.

If you define a class with an enclosed annotation like this:

package test;
public class Test1 {
    public static @interface Annotation1 {

        String value() default "";
    }
}


Extend from it and use the annotation on the type:

package test;
import test.Test1.Annotation1;

@Annotation1
public class Test2 extends Test1 {
    Test1 bla;
} 

Eclipse emits a warning that the import is unused. Organize Imports works.
Comment 1 Christian humer CLA 2013-06-04 05:48:03 EDT
Forgot to mention that any annotation processor needs to run.
Comment 2 Walter Harley CLA 2013-06-04 12:45:43 EDT
I'm not sure what you mean by "any annotation processor needs to run".  Can you clarify?
Comment 3 Christian humer CLA 2013-06-05 04:36:33 EDT
(In reply to comment #2)
> I'm not sure what you mean by "any annotation processor needs to run".  Can
> you clarify?

I first thought that my own annotation processor is the problem somehow. But that was not the case. Like in the attached java project I just had to run an annotation processor containing any logic (or doing nothing at all) to reproduce this problem. It works fine if no annotation processor runs on the java project.

As a lucky guess it seems that in a first compiler phase everything went fine. Then the annotation processor is called and the sources are re scanned for possible changes. That is maybe the phase where the illegal warning is created.
Comment 4 Christian humer CLA 2013-06-05 04:38:51 EDT
I was not able to reproduce this problem with javac (from OpenJDK8-ea).
Comment 5 Eclipse Genie CLA 2019-03-22 17:45:26 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.