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

Bug 461001

Summary: Debug/Display on anomymous class methods is broken
Product: [Eclipse Project] JDT Reporter: Zorzella Mising name <zorzella>
Component: DebugAssignee: Sarika Sinha <sarika.sinha>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: sarika.sinha
Version: 4.4.1   
Target Milestone: 4.5 M6   
Hardware: All   
OS: All   
Whiteboard:

Description Zorzella Mising name CLA 2015-02-26 16:41:05 EST
/**
 * Put a breakpoint where indicated below, and "Debug As Java Application".
 * Once the breakpoint hits, select each of the things in the allInScope array,
 * and hit Shift+Ctrl+D ("Display") to display their values (or use the
 * "Display View"). Of the 4 things that are in scope, only the "local"
 * variable can be displayed. For the others, you get a
 * '... cannot be resolved to a variable".
 */
public class AnonClassDebugDisplayBug {
  public static void main(final String[] args) {    
    final String bar = "bar";
    new Runnable() {
      
      String baz = "baz";
      
      @Override public void run() {
        String local = "local";
        Object[] allInScope = new Object[]{args, bar, baz, local};
        System.out.println(allInScope.length); // PUT A BREAKPOINT HERE
      }
    }.run();
  }  
}
Comment 1 Sarika Sinha CLA 2015-02-27 00:49:02 EST
It has been fixed in 4.5 M5.

*** This bug has been marked as a duplicate of bug 45507 ***