Re: java.lang.StackOverflowError

From: Brad BARCLAY (bbarclay_at_jsyncmanager.org)
Date: 10/27/03

  • Next message: bm: "Re: java.lang.StackOverflowError"
    Date: Mon, 27 Oct 2003 05:51:20 GMT
    
    

    Asad Khan wrote:
    > I have the following method inside I class,
    >
    > public boolean equals(Object o) {
    > return (this.equals(o));
    > }
    >
    > but when i call this method by "foo.equals(bum)" where foo and bum are some
    > objects, I get a java.lang.StackOverflowError??
    >
    > I kinda know why its happening; I think it calls the same equals method and
    > keep going round and round. But, this is what I have to do, without renaming
    > the method, so what's the way around it?

            You're getting this exception because you're recursing forever, with no
    end. This is not correct.

            Did you intend to call "super.equals(o)" instead?

    Brad BARCLAY

    -- 
    =-=-=-=-=-=-=-=-=
     From the OS/2 WARP v4.5 Desktop of Brad BARCLAY.
    The jSyncManager Project:  http://www.jsyncmanager.org
    
    

  • Next message: bm: "Re: java.lang.StackOverflowError"

    Relevant Pages

    • java.lang.StackOverflowError
      ... public boolean equals{ ... but when i call this method by "foo.equals(bum)" where foo and bum are some ... keep going round and round. ...
      (comp.lang.java)
    • java.lang.StackOverflowError
      ... public boolean equals{ ... but when i call this method by "foo.equals(bum)" where foo and bum are some ... keep going round and round. ...
      (comp.lang.java.developer)
    • java.lang.StackOverflowError
      ... public boolean equals{ ... but when i call this method by "foo.equals(bum)" where foo and bum are some ... keep going round and round. ...
      (comp.lang.java.developer)
    • java.lang.StackOverflowError
      ... public boolean equals{ ... but when i call this method by "foo.equals(bum)" where foo and bum are some ... keep going round and round. ...
      (comp.lang.java.programmer)