FIX: Error Generated when Variable and Method Have Same Name

Last reviewed: January 29, 1998
Article ID: Q160113
The information in this article applies to:
  • Microsoft Visual J++, version 1.0

SYMPTOMS

When a class contains a variable and method of the same name and the variable is accessed using the "this" object reference, the compiler generates the following error message thinking you are trying to access the method:

     Error J0070: need argument list for call to member "XXX"

Where XXX is the variable or method.

WORKAROUND

Do not access the variable using the "this" object reference. You can use the name directly.

STATUS

Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem has been fixed in Visual J++ 1.1.

MORE INFORMATION

Steps to Reproduce Problem

  1. Compile the following code:

    //[Test.java]
    
class Test {
   int Same;
   void Same()
   {
   }
   void Bar()
   {
      this.Same = 1;

                // to avoid the error, remove the "this" object
                // reference, like the following
                // Same = 1;
   }
}

You will get the following error message:

   error:  J0070:  Need argument list for call to member 'void Same()'

REFERENCES

For the latest Knowledge Base articles and other support information on Visual J++ and the SDK for Java, see the following page on the Microsoft Technical Support site:

   http://support.microsoft.com/support/visualj/
   http://support.microsoft.com/support/java/

Keywords          : kbtool CmdLnUtils
Technology        : kbInetDev
Version           : 1.0
Platform          : WINDOWS
Issue type        : kbbug
Solution Type     : kbfix


================================================================================


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: January 29, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.