This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 253649 - Unable to change the value of a field in an outer class
Summary: Unable to change the value of a field in an outer class
Status: RESOLVED FIXED
Alias: None
Product: debugger
Classification: Unclassified
Component: Java (show other bugs)
Version: 8.1
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Martin Entlicher
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-07-22 12:06 UTC by Jan Stola
Modified: 2015-07-30 01:24 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Stola 2015-07-22 12:06:44 UTC
Test case 1:

public class OuterClass {
    int field;

    public static void main(String[] args) {
        new OuterClass().new InnerClass().method();
    }
    
    class InnerClass {
        
        void method() {
            System.out.println(field);
        }
        
    }
}

Test case 2:

public class OuterClass {
    static int field;

    public static void main(String[] args) {
        new StaticInnerClass().method();
    }
    
    static class StaticInnerClass {
        
        void method() {
            System.out.println(field);
        }
        
    }
}

Steps to reproduce:
1. Put a breakpoint on the System.out.println() statement in one of the test-cases above.
2. Debug the file and wait till it hits the breakpoint.
3. Add "field" watch.
4. Attempt to change the value of the "field" watch.
   => The value is not changed and a warning dialog is shown.
   The dialog says "Cannot set value to 'field', unknown variable.".
Comment 1 Martin Entlicher 2015-07-27 16:00:03 UTC
Reproduced.
Comment 2 Martin Entlicher 2015-07-28 17:48:40 UTC
Fixed by changeset:   290253:b16159558cd6
http://hg.netbeans.org/core-main/rev/b16159558cd6
Comment 3 Quality Engineering 2015-07-30 01:24:39 UTC
Integrated into 'main-silver', will be available in build *201507300002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/b16159558cd6
User: mentlicher@netbeans.org
Log: #253649: Remember the container of the evaluated value, if there is one, and use it to set watch values.