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

methods and fields are confused

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 0.9
    • Fix Version/s: 1.0
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      1.0alpha3
    • CPU:
      sparc
    • OS:
      solaris_2.4
    • Verification:
      Not verified

      Description


      The following code produces an error. It should be legal to declare
      a method and a variable with the same name.

      class test {
          int foo;

          void foo() {
          }

          void bar(test t) {
      t.foo = 1;
      t.foo();
          }
      }

      test.java:9: Attempt to reference method foo in class test as an instance variable.
              t.foo = 1;
               ^
      1 error

        Attachments

          Activity

            People

            • Assignee:
              ahoffsunw Arthur Hoff (Inactive)
              Reporter:
              ahoffsunw Arthur Hoff (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: