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.
I am using Q-build 200210300100 with JDK 1.4.1. When I debug the following testcase then I cannot see any class variables even if they are referenced from within the current method. Please refer to the simple testcase below. I would be glad if you could give me your opinion as to whether I can expect this to work in a future version or should I change the structure of my programs? Please accept my apologies if I am simply overlooking a way to do this properly. public class ClassDebug { private static String outerStaticString; public static void main(String[] args) { InnerClass.innerMethod(); }// method private static class InnerClass{ private static String innerString; public static void innerMethod(){ StringBuffer orderStatusBuf; // If I stop on the following line then I cannot inspect the value // of "outerStaticString" by tooltip. "outerStaticString" is also // not shown in the "Local Variables" section in the debugger. // I am sure there should be a way to inspect static variables. if(outerStaticString == null){ System.out.println("null"); }// if }// method }// inner class }// class
The debugger currently displays the following types of variables in panel "Local Variables" of the Debugger Window: - local variables (i.e. variables declared within a method body) of the current call stack frame (alias "method call") - value of <this> if applicable (i.e. if the call stack frame refers to a non-static non-native method) and of all fields (both instance and static) of <this> object Variable "outerStaticString" is not a local variable (it is a member of a class). Nor is it displayed under <this> because there is no <this> available in static context. You can watch values of static class members if you create a watch for them or if you create an instance of the class and watch values of all its members (as described above). Note that private fields of a class are not directly accessible from (because not members of) its nested classes. Java compiler generates synthetic accessor methods for accessing them.
Many thanks Marian for your comprehensive explanation!
*** Issue 28917 has been marked as a duplicate of this issue. ***
I have filed a request for enchancement - see #28936.
verified