Bug 323830 - eclipse doesn't update metadata/index after JAR change
Summary: eclipse doesn't update metadata/index after JAR change
Status: VERIFIED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.6   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 3.7 M7   Edit
Assignee: Jay Arthanareeswaran CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-27 10:18 EDT by nbonatsakis CLA
Modified: 2011-04-26 09:30 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description nbonatsakis CLA 2010-08-27 10:18:46 EDT
Build Identifier: 20100617-1415

I am in a scenario where I have a project that depends on a JAR within an Ivy cache. This JAR file can change often. I have a reproducible case where changes to the JAR result in successful builds in the dependent project, but the editor does not reflect any changes. 

For example:

Project A is in an Eclipse workspace 
projectb.jar is on disk and is specified as a dependency in Project A's Build Path in Eclipse. 
Project A in Eclipse has a class call UseMyClass. 
projectb.jar contains a class MyClass.

In Eclipse, I open UseMyClass.java and add a reference to a method in MyClass that doesn't exsist yet (MyClass.foo();
I add foo() to MyClass to projectb and recreate projectb.jar in place of the old projectb.jar. 
I go back to Project A in eclipse and observe the following:

- inspecting projectb.jar in the navigator shows the new method.
- refreshing Project A builds successfully, and the tab for UseMyClass shows no errors, BUT, there is still an inline error where I use MyClass.foo().
- MyClass. does not produce foo() as an autocomplete option.

So it seems that though the navigator and build see the changes to the JAR, whatever metadata eclipse uses to show inline compile problems and autocomplete is not being updated. The only way to force the update is by Closing and Reopening the project in the workspace, or by closing/opening eclipse altogether.

I see this in both eclipse 3.5 and 3.6 on OS X 10.6. Is this behavior expected, is there a way to resolve it? 

Reproducible: Always

Steps to Reproduce:
See details.
Comment 1 Frederic Fusier CLA 2010-08-27 12:44:49 EDT
I observe a similar behavior using last 3.7 I-build or 3.6.0 build but only if I do not save the change done in MyClass. When I save the file after having added the MyClass.foo() unresolved reference, then *all* errors vanish when I refresh the project and see in the Package Explorer the method foo added in the jar...

Could you confirm that the behavior is correct when the editor on MyClass.java is not dirty (i.e. MyClass.java saved)?
Comment 2 Frederic Fusier CLA 2010-08-27 13:04:43 EDT
Even when the editor is dirty, the compiler errors go away after having waited a little while (using 3.7)...
Comment 3 nbonatsakis CLA 2010-08-27 14:49:46 EDT
Just to be clear, in my scenario project.jar contains only a complied .class file for MyClass (MyClass.class) and is built completely outside of Eclipse. In other words, Project A is the only project in my Eclipse workspace, the only reference to projectb.jar is as a Build Path library dependency. Therefore, Eclipse has no idea of MyClass.java, and changes to it being saved or unsaved are completely irrelevant, it is assumed that it is compiled and added to projectb.jar.
Comment 4 Frederic Fusier CLA 2010-08-28 09:43:16 EDT
(In reply to comment #3)
> Just to be clear, in my scenario project.jar contains only a complied .class
> file for MyClass (MyClass.class) and is built completely outside of Eclipse. In
> other words, Project A is the only project in my Eclipse workspace, the only
> reference to projectb.jar is as a Build Path library dependency. Therefore,
> Eclipse has no idea of MyClass.java, and changes to it being saved or unsaved
> are completely irrelevant, it is assumed that it is compiled and added to
> projectb.jar.

I agree that comment 1 was definitely misleading :-(

It should have read UseMyClass.java instead of MyClass.java!
Definitely sorry about this mistake and the confusion... :-S
Comment 5 Jay Arthanareeswaran CLA 2011-04-11 03:09:38 EDT
I tried this with build ID I20110310-1119 and can't reproduce. I don't know if this has been fixed as part of another bug. Closing the bug - I would suggest you try with a newer build and if you still find this issue, please reopen. Thanks.
Comment 6 Olivier Thomann CLA 2011-04-26 09:30:01 EDT
Verified.
If this happens again, please provide a test case that reproduces the issue.