| Summary: | Debugger opens *.class file instead of *.java file! | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | MH <mhilpert> |
| Component: | Debug | Assignee: | JDT-Debug-Inbox <jdt-debug-inbox> |
| Status: | RESOLVED WORKSFORME | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | curtis.windatt.public, Michael_Rennie |
| Version: | 3.7 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
|
Description
MH
Can you provide an example project or jar that demonstrates the problem? We fixed a problem a while back where we were incorrectly opening Java files when the class file should have been, see bug 297039. I can't send you our project, alas. I had some progress: I found the configuration "Debug Configurations > <project> > Source! I added the path to the project source there. Now, at least another ".java" Editor pops up. But it isn't editable. And it opens even though there is already this source open in another editor. I notice the icon of the new *.java Editor is a "J" that is not filled. While the usual Java Editor of the same source file is a filled "J". I haven't found help in the manual what the difference is. But I expected the Eclipse debugger to just use my already open source editor with the breakpoint. The breakpoint in the source is detected but the debugger opens this new non filled "J" editor and halts at the same line. (In reply to comment #2) > I can't send you our project, alas. You can attach any project / lib combo that demonstrates the problem. > I had some progress: I found the > configuration "Debug Configurations > <project> > Source! I added the path to > the project source there. Now, at least another ".java" Editor pops up. But it > isn't editable. And it opens even though there is already this source open in > another editor. I notice the icon of the new *.java Editor is a "J" that is not > filled. While the usual Java Editor of the same source file is a filled "J". I > haven't found help in the manual what the difference is. But I expected the > Eclipse debugger to just use my already open source editor with the breakpoint. > The breakpoint in the source is detected but the debugger opens this new non > filled "J" editor and halts at the same line. This sounds like it is opening the .java file from the archive, which is what you want is it not? If you have added the lib source to your source lookup path it will choose that - based on the ordering you specify in the launch configuration - before it will reuse the open editor. I have no *.java files in my JARs - only *.class files! So there is only one *.java Source file which is in the project path of the related JAR. So, no "lib source" to choose from. I have no idea what Eclipse is doing here. What is this editor with the not-filled "J"? > What is this editor with the not-filled "J"? The editor you see is the read-only Java editor, typically you see it when you open source from an archive. This problem is sounding very similar to what was found in bug 346116. Okay, I narrowed the problem: in the debug configuration's "Source" tab, I had the "File System Directory" entry too the source. After I removed this and added "Java Project" of the referenced source, the debugger halted in the original source editor as expected. Unfortunately, this is just a workaround, because I want to have file system directory paths! The reason: whenever I close a project, other projects that relate to this closed project can't find the referenced resources. So I changed all my references to other project's sources to file paths instead of Eclipse Java Porjects. Unfortunately, this results in this bug here ... In conclusion, I would say, the debugger doesn't use the correct source Editor, if the configuration "source" has a "File System Directory" instead of a "Java Project"! (In reply to comment #6) > In conclusion, I would say, the debugger doesn't use the correct source Editor, > if the configuration "source" has a "File System Directory" instead of a "Java > Project"! Thanks for reporting back with more details. Can you tell me anything about the shape of the directory you point to for your source? Is it read-only? does it contain jars? What is the absolute path of the file that is opened when you do have the directory on the source lookup path? It contains only the *.java source files and nothing else. Of course, it is writable - otherwise I won't be able to edit and save the source files. I don't understand you last question completely. It's a normal file path without any special characters or spaces ("D:\projects\...\java\src\...*.java").
(In reply to comment #8) > It contains only the *.java source files and nothing else. Of course, it is > writable - otherwise I won't be able to edit and save the source files. I don't > understand you last question completely. It's a normal file path without any > special characters or spaces ("D:\projects\...\java\src\...*.java"). I had started thinking that maybe this bug was related to bug 346116, but then I re-read: "So I changed all my references to other project's sources to file paths instead of Eclipse Java Porjects. Unfortunately, this results in this bug here ..." If I understand correctly, you removed the related Java project source lookup entries from the source lookup path of your launch configuration and replaced them with local file system source lookup path entries? If so, then this is working as designed. You are seeing the external source / read-only editor because you are telling the source director to find source from outside the workspace. You cannot open source from the workspace if the project the source is to be found in is closed. Oh man, why these restrictions? So, to be able to debug in the real source file, I need to reference the source via the workspace path. But Eclipse is much slower (especially at startup and shutdown) when all projects are open. And I also noticed when backing up my workspave folder, it is much larger with all projects open and therefore takes much more space and time to backup. So I close all projects that I don't need to gain memory and time. But then the source are not found. So I changed the source paths to absolute paths to workaround this. But then the debugger just shows this read only editor. :-( Can you understand my point? So the only "solution" is to leave all my projects open and live with the poor performance and excessive space of the workspace folder. This is really annoying! (In reply to comment #10) > So the only "solution" is to leave all my projects open and live with the poor > performance and excessive space of the workspace folder. This is really > annoying! Most of the features in the Eclipse IDE require you to be working with projects open in the IDE. Closing the projects takes away most of the reasons to be using an IDE in the first place. I don't see anything we can do here. (In reply to comment #10) > Can you understand my point? To be honest, I don't quite understand. I can see closing unrelated projects (I typically do the same) but I don't see why you would close related projects. > So the only "solution" is to leave all my projects open and live with the poor > performance and excessive space of the workspace folder. That is correct. I am going to mark this as worksforme, as the debugger / source lookup is working as designed, and the reported problem is more of a configuration issue. And what about the problem with the slow start/exit and the big workspace? I don't understand why the workspace is so much bigger wehn my projects are open? I always close all my projects before backing up my workspace to avoid having hundreds of megabytes unnecessary waste in there. |