Bug 414015 - Launch configuration with different JRE leads to wrong source path for debugger and stack trace links
Summary: Launch configuration with different JRE leads to wrong source path for debugg...
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.8.2   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Debug-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2013-07-30 10:45 EDT by Detlef Keil CLA
Modified: 2024-01-02 06:12 EST (History)
3 users (show)

See Also:


Attachments
Test project to reproduce the bug (3.71 KB, application/zip)
2013-07-30 10:50 EDT, Detlef Keil CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Detlef Keil CLA 2013-07-30 10:45:10 EDT
If a launch configuration is defined for JRE x in a Java project for JRE y, then the wrong JRE source code is shown in the following situations:
1. While stepping in the debugger, the sources of JRE y are shown. (Expected are
   classes of JRE x) 
2. When running the application, the stack trace links within the console view
   link to the sources of JRE y (instead of x).

I've attached a sample project as ZIP to easily reproduce this bug.
- There are 3 Launch-Configurations
- Just start them, they will produce a stack trace.
- Click on the first element of that trace: The Classes of JavaSE-1.6 are shown.
  Even when started with one of the two Java 7 launch configurations.
- Debugging leads to the same erroneous behavior.

I'm using a slightly updated version of the Eclipse Juno release train. (Could not reproduce this bug with Indigo.)

-- Configuration Details --
Product: Eclipse 1.5.2.20130110-1126 (org.eclipse.epp.package.java.product)
Installed Features:
 org.eclipse.jdt 3.8.2.v20130116-090414-8-8nFu3FNOfwKLRuqgXKIy9z0I83
Comment 1 Detlef Keil CLA 2013-07-30 10:50:39 EDT
Created attachment 233945 [details]
Test project to reproduce the bug
Comment 2 Jay Arthanareeswaran CLA 2013-07-30 23:29:04 EDT
Moving to debug for investigation.
Comment 3 Sarika Sinha CLA 2016-05-09 07:27:01 EDT
Not on priority.
Comment 4 Eclipse Genie CLA 2020-01-08 13:22:26 EST
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.
Comment 5 Sarika Sinha CLA 2020-01-10 00:54:06 EST
Can reproduce with latest as well. I hope to find some time to look into this.
Comment 6 Eclipse Genie CLA 2021-12-31 05:19:03 EST
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.
Comment 7 Detlef Keil CLA 2022-01-10 16:54:20 EST
The bug still exists. Today, I was able to reproduce it with the eclipse 2021-12 and 4.23M1 (both started with AdoptOpenJDK 11.0.7+10). These were the exact versions:
- 2021-12 (4.22.0) Build id: 20211202-1639
  Downloaded from https://www.eclipse.org/downloads/packages/release/2021-12/r/eclipse-ide-java-developers
- 2022-03 (4.23) Build id: I20220105-1800
  Downloaded from https://download.eclipse.org/eclipse/downloads/drops4/S-4.23M1-202201051800/download.php?dropFile=eclipse-SDK-4.23M1-win32-x86_64.zip

However, I noticed that fixing this bug has a lot more facets than I could imagine when I filed this bug 8.5 years ago. I try to summarize them from my point of view. (I am calling again the "x" the JRE version of the launch configuration and "y" the JRE version of the Java project.)

A) Running an application with a different JRE
1. The console view: Nowadays it displays nicely the run configuration's name
   and the JRE y. So it should be able to link a stack trace element to the
   right source file.
2. The package explorer view (project explorer view etc.): These views can
   synchronize with the editor. So when for example class ClassLoader of JRE x
   is visible in the editor, the corresponding node in the tree should be
   selected. However, the classes of JRE x are not at all in the tree. Only the
   classes of JRE y are. If you have a launch file in the project (like in my
   sample project), you could display JRE x as sub-node of this launch file.
   But what, if you just stored the launch configuration in the local workspace?
   Of course, this point is not such a big flaw, when just running the
   application. However, it is a big point, when it comes to debugging.

B) Debugging an application with a different JRE
This makes things even harder, because you have additional functionality to cover. That means, besides the points (1) and (2) as mentioned in A), you will have the following:
3. Editor view: You should be able to toggle breakpoints in this view. Now this
   is sometimes the case, sometimes not.
4. Break points view: It is possible that a user sets a breakpoint in class A
   in JRE y and in the class A in JRE x. Now the user cannot distinguish them.
   The user should at least be able to open the corresponding class A when
   double clicking on the breakpoint. But at the moment this is only possible
   for class A in JRE y (= the project's JRE).

CONCLUSION:
This is not just a bug, but also a missing feature that is pretended to be working. Or, let's put it like this: The feature of defining a different JRE for a launch configuration is at least rather premature. It reminds me of one of my beginner's mistakes, where I thought, that it is quite easy to achieve a whole new feature with a few lines of code, without thinking about all the implications, the dos and the don'ts. I had to pay the price for it then, and had my lesson learned...

On the other hand, no one really seemed to care about this bug or missing/premature feature in the last years. Therefore, I suggest the removal of the possibility to define a different JRE for a launch configuration. Or at least: If such a launch configuration exists, it should not be possible to start it for debugging. In the latter case, it more or less suffices to fix point (1). At least as long as the feature is not widely used.

BTW: I conjecture, there are similar problems when modifying the other elements of the class path in a launch configuration.
Comment 8 Eclipse Genie CLA 2024-01-02 06:12:38 EST
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.