Community
Participate
Working Groups
Build Identifier: Version: Juno Release Build id: 20120614-1722 If you have variables with same name in class and it's static method (class variable must be static too), and you stopped on breakpoint in this method and you want to see method's variable value, class's variable will be shown. Reproducible: Always Steps to Reproduce: 1. create a project with one class with this code: public class Main { static String[] a = new String[] { "0", "1", "2" }; public static void main(String[] args) { int[] a = new int[] { 101, 102 }; System.err.println(a[1]); } } 2. add breakpoint on println line 3. debug the project as java application 4. When debug will stop on breakpoint, try to inspect a's value. this will show value of class's scope a, but we definitely need value from method's scope.
Created attachment 218379 [details] related screenshot
Created attachment 220073 [details] proposed fix Basically modified the findVariable method in JDIStackFrame class. The intended modification is to give preference in the search criteria to a Local variable when there are multiple variables with the same name in the stack frame.
*** Bug 377620 has been marked as a duplicate of this bug. ***
Comment on attachment 220073 [details] proposed fix The patch works as expected, thanks Samrat!
pushed fix to: http://git.eclipse.org/c/jdt/eclipse.jdt.debug.git/commit/?id=3dcdaba35ccb9fe70fe2cd0a12810ea80ccdb16e pushed additional unit tests to: http://git.eclipse.org/c/jdt/eclipse.jdt.debug.git/commit/?id=37410bf06424223bef4bc96185dfe5a74fce903e