Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4059046

Setting private data member of an inner class doesn't work

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.1.5
    • 1.1beta2, 1.1.1, 1.1.2, 1.1.4
    • tools
    • 1.1.5
    • generic, x86, sparc
    • generic, solaris_2.5.1, windows_95
    • Verified

        This code doesn't compile:

        public class foo {
            public static class bar {
         
                private int i;
         
                private void setI(int i) {
                    this.i = i;
                }
            
            }
         
            static public void main(String args[]) {
                bar b = new bar();
                System.out.println(b.i);
                // b.setI(42);
                b.i = 42;
                System.out.println(b.i);
            }
        }

        It dies with foo.java:18: Invalid left hand side of assignment.
                b.i = 42;

        However, if I replace the "b.i = 42" with "b.setI(42)", it works.

        I haven't tried against 1.2, but this bug might be there, too.

        (Note to myself: When this gets fixed, take the gratituous private
        mutator methods out of sunw.hotjava.misc.RequestProcessor.Request)

        john.bui@eng 1997-10-17

        No specific test case available. Implicity tested, closed with exposure.

              wmaddoxsunw William Maddox (Inactive)
              bfootesunw Bill Foote (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: