Bug 151811 - [evaluation] "variable cannot be resolved" for variables in nested class
Summary: [evaluation] "variable cannot be resolved" for variables in nested class
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Debug-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
: 80039 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-07-26 05:28 EDT by Aurius CLA
Modified: 2023-11-03 09:09 EDT (History)
7 users (show)

See Also:


Attachments
visual explanation (194.72 KB, image/jpeg)
2006-07-26 05:29 EDT, Aurius CLA
no flags Details
patch (3.82 KB, patch)
2007-05-07 16:47 EDT, Darin Wright CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Aurius CLA 2006-07-26 05:28:35 EDT
If setting up breakpint in nested class method which is implemented in parent class method. Then trying to view in "Exspressions view" a variable declared in parent class method, the variable cannot be resolved. Variable is in the scope of children class method were the breakpoint is set of so it should be resolved.

Screen shot attached explaining all visually.

--------------------------------------------------------------------------------
eclipse.buildId=M20060629-1905
eclipse.commands=-os
win32
-ws
win32
-arch
x86
-launcher
C:\Program Files\eclipse\eclipse.exe
-name
Eclipse
-showsplash
600
-exitdata
f1c_64
-vm
C:\j2sdk1.4.2_10\bin\javaw.exe
eclipse.ee.install.verify=false
eclipse.product=org.eclipse.sdk.ide
eclipse.startTime=1153893927744
eclipse.vm=C:\j2sdk1.4.2_10\bin\javaw.exe
eclipse.vmargs=-Xms40m
-Xmx256m
-jar
Comment 1 Aurius CLA 2006-07-26 05:29:31 EDT
Created attachment 46805 [details]
visual explanation
Comment 2 Darin Wright CLA 2007-05-07 16:35:12 EDT
Not planned for 3.3
Comment 3 Darin Wright CLA 2007-05-07 16:47:45 EDT
Created attachment 66213 [details]
patch

Work in progress that adds finals as local variables to the evaluation. Not sure how portable it is across compilers.
Comment 4 Darin Wright CLA 2007-05-17 14:21:31 EDT
*** Bug 80039 has been marked as a duplicate of this bug. ***
Comment 5 Deepak Azad CLA 2010-02-19 06:37:56 EST
Would love to see this fixed. Any plans of this getting fixed?
Comment 6 Darin Wright CLA 2010-02-19 12:34:51 EST
(In reply to comment #5)
> Would love to see this fixed. Any plans of this getting fixed?

No plans currently.
Comment 7 Eclipse Genie CLA 2019-02-03 02:06:43 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 8 Mauro Molinari CLA 2019-02-04 03:41:29 EST
I don't know if this is the intended behaviour. This is what I see with 2018-12 if I try with these simple classes:

package test;

public class Test {

	public static void main(String[] args) {
		new MyClass().doSomething();
	}
}

----

package test;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JTable;

public class MyClass {

	void doSomething() {
		final JTable table = new JTable();
		JButton button = new JButton();
		button.addActionListener(new ActionListener() {
			
			@Override
			public void actionPerformed(ActionEvent e) {
				System.out.println("test");
				table.clearSelection();
			}
		});
		
		
		button.doClick();
	}
}

---

If I put a breakpoint on "System.out..." with this code, I do see "val$table" under "this" reference in Variables view AND "table" is correctly resolved by the Expressions view.

If however I remove the call to "table.clearSelection()" from the anonymous inner class (which is more like the example provided by Aurius), then val$table is missing from the variables view and the Expressions view does not resolve "table" any more.

Maybe some kind of compiler optimisation regarding the closure of the anonymous inner class?
Comment 9 Sarika Sinha CLA 2019-05-21 02:22:17 EDT
Yes, still reproducible.
Comment 10 Eclipse Genie CLA 2021-05-11 15:29:53 EDT
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 11 Mauro Molinari CLA 2021-05-20 04:12:55 EDT
This "stale bug" system is very annoying...
Still reproducible with at least Eclipse 2020-09.
Comment 12 Sarika Sinha CLA 2021-05-20 05:41:30 EDT
@Gayan,
Can you look into this?
Comment 13 Gayan Perera CLA 2021-05-20 06:23:38 EDT
Sure @Sarika
Comment 14 Michael Lill CLA 2021-11-12 04:09:24 EST
@Gayan Any progress?
Possibly related to https://github.com/microsoft/vscode-java-debug/issues/754
Also I found bugs where evaluation fails if inside of lambdas. Would be nice to have some improvement there as well.
Comment 15 Eclipse Genie CLA 2023-11-03 09:09:56 EDT
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.