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.
Created attachment 146761 [details] Screenshot Hi, i have the following snippet: public class Test { public static class Data { public void sayHello() { System.err.println("Hello"); } } public static class Cha { public Data data; public void sayHello() { this.data.sayHello(); } } public static class Con extends Cha { public Data data; } public static void main(String[] args) { Cha obj = new Con(); obj.data = new Data(); Data data = obj.data; data.sayHello(); } } When I stopped at the line: Data data = obj.data; The Variables window showed that the value of obj.data is null. But on the next line, the value of variable data is not null (obj.data is still null). Can I call this a bug?
Reproduced. When "obj" is expanded in Variables window, data shows null (from Con class) and Inherited data shows the value that was set (from Cha class). Debugger seems to be inconsistent with the runtime. In the runtime ((Cha) obj).data is used, but ((Con) obj).data is displayed in debugger.
Fixed by changeset: 276510:4627b96ba353 http://hg.netbeans.org/core-main/rev/4627b96ba353
Integrated into 'main-silver', will be available in build *201407280405* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/4627b96ba353 User: mentlicher@netbeans.org Log: #243847: When retrieving a value of a field on an object, prefer the object type declared in the source code.