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 28612

Summary: Class variables not visible
Product: debugger Reporter: bht <bht>
Component: JavaAssignee: issues@debugger <issues>
Status: VERIFIED INVALID    
Severity: blocker    
Priority: P3    
Version: 3.x   
Hardware: PC   
OS: Windows 95/98   
Issue Type: DEFECT Exception Reporter:

Description bht 2002-11-10 10:04:23 UTC
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
Comment 1 Marian Petras 2002-11-11 10:54:07 UTC
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.
Comment 2 bht 2002-11-11 18:54:23 UTC
Many thanks Marian for your comprehensive explanation!
Comment 3 Marian Petras 2002-11-22 11:18:43 UTC
*** Issue 28917 has been marked as a duplicate of this issue. ***
Comment 4 Marian Petras 2002-11-22 11:33:47 UTC
I have filed a request for enchancement - see #28936.
Comment 5 bht 2003-07-08 23:44:11 UTC
verified