Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 542102

Summary: Type-hierarchy confusion when running multiple trunk/branch Java applications
Product: [Eclipse Project] JDT Reporter: Aron Olsen <aron.olsen>
Component: DebugAssignee: JDT-Debug-Inbox <jdt-debug-inbox>
Status: CLOSED INVALID QA Contact:
Severity: normal    
Priority: P3 CC: aron.olsen, loskutov, sarika.sinha
Version: 4.7.3   
Target Milestone: ---   
Hardware: PC   
OS: Windows 10   
Whiteboard:
Attachments:
Description Flags
Run configurations for launch file none

Description Aron Olsen CLA 2018-12-04 12:16:47 EST
I have two separate SVN-based Java Maven projects, one for my trunk and one for a particular branch. I run each from within Eclipse, using an file-based ("external") Eclipse maven-launch-file.
I am debugging both instances.
When opening the type-hierarchy of some class in the running trunk-instance, and then double click a class in the shown hierarchy, a Java-class file in the branch-project gets opened. I was expecting Eclipse to open a file in the trunk-project.
It seems as if Eclipse is getting "confused" about from which class-loader the type-hierarchy is to be determined.
Comment 1 Aron Olsen CLA 2018-12-04 12:35:39 EST
A work-around is to close the other project, but that will make continuous comparisons of classes and type-hiearachies very cumbersome.
Comment 2 Aron Olsen CLA 2018-12-04 12:46:21 EST
Created attachment 276815 [details]
Run configurations for launch file

I have indeed maintained "base-directory" for each separate launch-file, to reflect the actual Eclipse-project in question, being the branch or the trunk.
Comment 3 Sarika Sinha CLA 2018-12-04 22:36:28 EST
Do you have the option selected under Debug->Preferences
Do not install breakpoints from unrelated projects

@Andrey,
The option should take care of this I guess?
Comment 4 Andrey Loskutov CLA 2018-12-05 03:30:36 EST
(In reply to Sarika Sinha from comment #3)
> Do you have the option selected under Debug->Preferences
> Do not install breakpoints from unrelated projects
> 
> @Andrey,
> The option should take care of this I guess?

No, not *if* I understood this bug report, it is about *Type Hierarchy* search scope, the option you mentioned is about *breakpoints* scope (bug 5188).

(In reply to Aron Olsen from comment #0)
> When opening the type-hierarchy of some class in the running trunk-instance,

How do you do this, step by step? Do *what* and *where* to open?
Comment 5 Aron Olsen CLA 2018-12-05 12:11:34 EST
In the "Package explorer" view a drill to a base-class java file in the trunk-project. I rigth-click it and chooses "Open type hiearchy" from the pop-up menu. In the then opened type-hiearchy view, I double-click a sub-class in the hierachy.
In the java-editor view the corresponding java-file in the branch-project gets opened. It should have been the corresponding file in the trunk-project.

If I close the branch-project and repeat the whole thing, I get the correct file in the trunk-project opened.
Comment 6 Aron Olsen CLA 2018-12-05 12:19:23 EST
In reply to Sarinha: Yes. that option is V-checked
Comment 7 Aron Olsen CLA 2018-12-05 12:39:27 EST
I apologize for this reporting - I am no more able to reproduce the problem.

I believe the reason for the problem stems from the fact, that I forgot to correct the "source" projects in each launch-file. They were both referencing the branch-project.

I can see it is a delicate situation that cannot be dealt with easily in perspective of Eclipse, but now I know! 

Regards,
Aron