Community
Participate
Working Groups
It seems that Eclipse caches the contents of source files that are used during debug sessions. I have an environment set up as follows: Project A - Simple Project usings an external ANT builder Project B - Java Project containing JUnit tests I create a test case in B and then use the Debug perspective to find out why a test may be failing. I then switch to the Resource Perspective where I edit/compile/build my project. This creates some JAR files and a source.zip file so that Eclipse can attach source for JAR files I created (BTW, why does Eclipse insist on a JAR or ZIP file for attaching source? Why can't a filesystem or workspace path be used as well?). Once I go back to Debug Perspective to verify my changes, I get an old copy of the source files I have just edited that don't align with the debugged JAR files. I have to close all perspectives and restart Eclipse to get back to a state where I can debug. Note that just closing the perspective or all perspectives does not help. Upon reopen, they still have knowledge of the outdated source files. This is a painful problem because stopping/restarting Eclipse is not enjoyable. Also, closing all the perspectives and having to recustomize them on restart is painful. I guess I could avoid this by saving my customizations to a new custom perspective, but I am lazy :-) Thanks for listening, Rob
Source attachments are maintained by the "java model" (JDT CORE). It sounds like your compile/build/debug process includes the creation of a new jar, with a new source attachment. How is this jar used/referenced at runtime? A reproduceable test case would help explain this problem.
Project J (the Java project) depends on jar files and sources from Project S (the Simple Project). Project S is maintained by an Ant build configuration that generates a jar file (wbem.jar) and a source file (wbemsrc.jar). The latter jar file is created purely to satisfy Eclipse's desire for a jar or zip file for source attachment. Project J contains JUnit test cases for Project S. I often debug problems within the Debug perspective when Project J turns up a test case failure. The problem occurs when I fix a problem in Project S and re-run the build. This causes the wbem.jar and wbemsrc.jar files to be updated. When I go back to the Debug Perspective, it somehow retains a pointer to the previous source files and the debug sessions are mismatched with the source. The only solution is to close all perspectives and restart Eclipse. Eclipse will then re-read the environment and start with fresh pointers to the wbem.jar and wbemsrc.jar files. If you wanted to create a test for this problem, try importing the wbemservices SDK as a simple project in Eclipse. Use it's already provided ant_build.bat file to build the project. Create a separate project in the Java perspective that uses the wbem.jar and parser.jar file from the wbemservices build. Debug a test case against some API in the wbemservices jar file. Make any change you like to the wbemservices sources and rebuild them. When you debug again, you will find the mismatched sources problem and I see no way to convince Eclipse to discard the pointer to the old file and read it fresh from the wbemsrc.jar. Hope this helps. Thanks for listening, Rob
Moving to JCORE. Sounds like the problem is that when the jar is updated, the source attachment is not updated.
DeltaProcessor was not handling changes in source attachment. Fixed. Rob, note that you have to refresh the simple project S as you modify the wbemsrc.jar file using an external tool and Eclipse is not capable of discovering the change without a refresh.
I think I have tried refreshing and don't remember that helping. I will try this again today to be sure though. Thanks for the idea. ROb
Refresh all projects. Re-entered Debug. Old sources still!
Rob, unless you're running a nightly build, I don't think you have the fix yet. It was released on 09/12 and should be included in today's integration build (09/17).
Marked as fixed. Please reopen if symptoms persist beyond today's integration build.
Verified.