Bug 214450 - annotation is broken
Summary: annotation is broken
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 critical (vote)
Target Milestone: 3.4 M5   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-07 00:40 EST by Sehyo Chang CLA
Modified: 2008-02-05 05:11 EST (History)
2 users (show)

See Also:


Attachments
project that can reproduce the problem (7.02 KB, application/binary)
2008-01-07 00:40 EST, Sehyo Chang CLA
no flags Details
updated example without copyright comment (6.63 KB, application/zip)
2008-01-07 18:16 EST, Sehyo Chang CLA
no flags Details
Proposed fix and regression test (2.68 KB, patch)
2008-01-08 10:27 EST, Jerome Lanneluc CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sehyo Chang CLA 2008-01-07 00:40:22 EST
Created attachment 86283 [details]
project that can reproduce the problem

Build ID: I20071213-1700

Steps To Reproduce:
1. create a plug-in project that exports annotation
2. try to import annotation in another plug-in project.

It imports successfully but JDT complains that it can't find
it in classpath.

Note that this works fine on Eclipse 3.3


More information:
Comment 1 Walter Harley CLA 2008-01-07 12:30:03 EST
Reassigning to JDT Core since there is no annotation processing in the picture.

That said: I am not able to reproduce this with M20071214-0800 (which is 3.4M4).  I tried creating a new workspace and Import -> Existing projects into workspace -> Archive file, and imported both projects.  I see no errors or warnings, and the annotation appears to be resolved correctly.

I would note that the depending project does not have the upstream project as a plugin dependency; it only has an import-package dependency.  So at runtime, the class is not going to be available unless the upstream plugin has been brought into the classloader for some other reason.
Comment 2 Sehyo Chang CLA 2008-01-07 16:16:16 EST
I was able to reproduce problem with different computer.

Also on my eclipse, version is I20071213-1700.  I don't understand
why your version is different from mine.

Here's my download URL

http://download.eclipse.org/eclipse/downloads/drops/S-3.4M4-200712131700/index.php

Note that when you open project, it doesn't show immediately the problem.
If you click class "PropertyTest".   The editor shows the problem.
It does not show up in the problem view.

I am also running Sun JDK 1.6 update 3.
Comment 3 Walter Harley CLA 2008-01-07 17:16:50 EST
Sorry, my mistake, I had a bad link.  I can in fact reproduce this with the projects supplied, in 3.4M4 but not in 3.3.2.  However, I have so far been unable to reproduce it with newly created projects.  I am investigating to see if I can figure out what the difference is.

Comment 4 Walter Harley CLA 2008-01-07 17:40:32 EST
If I delete the comments that precede the 'package' declaration in the annotation definition, then the import problems disappear.

However, I can't find anything wrong with those comments.  I have even tried deleting them entirely and then inserting a new comment (just "/**/" by itself on a single line preceding the package declaration) and the problems reappear.

The problems are visible only as red squiggles in the editor, not in the Problems pane.

I remain unable to reproduce this in projects that I create from scratch.
Comment 5 Walter Harley CLA 2008-01-07 17:56:38 EST
I am able to reproduce this in new projects.  It happens for plug-in projects and also for plain Java projects.

For the import problem to appear, three things need to be true:

1. There must be a comment before the package declaration in the annotation definition.

2. The annotation must have an attribute.

3. The annotation must be in a separate project from the code that is trying to import it.

The annotation and its contents do appear correctly when expanded in Package Explorer, and they auto-complete and auto-import correctly in the client code.  Using a star import does not change the behavior.

JDT guys, I think that's as far as I can take this one.
Comment 6 Sehyo Chang CLA 2008-01-07 18:16:07 EST
Created attachment 86361 [details]
updated example without copyright comment
Comment 7 Jerome Lanneluc CLA 2008-01-08 10:06:13 EST
Note that:
1. the error shows in the Java editor only (not in the problem view)
2. the test case from comment 6 doesn't show the problem, only the test case from comment 0 shows the problem
Comment 8 Jerome Lanneluc CLA 2008-01-08 10:27:19 EST
Created attachment 86398 [details]
Proposed fix and regression test
Comment 9 Jerome Lanneluc CLA 2008-01-09 06:17:53 EST
Fix and test released for 3.4M5
Comment 10 Eric Jodet CLA 2008-02-05 05:11:52 EST
Verified for 3.4M5 using build I20080204-0010