Menu

#1 Error when calling hashCode, equals and toString methods on a jInterflex proxy

1.0-Beta4
closed
None
2014-12-24
2014-10-13
Xavi Miró
No

In every Java object there are three public methods always available for which it makes sense to be called on the real object of a proxy created with JInterflex.proxy(): hashCode, toString and equals. Currently, if one of these methods is called on a proxy object and they are not explicitly written in its auxiliary interface, an exception is thrown with an error message similar to (for instance with equals):

"The method 'equals' is not accessible. Please make sure that this method exists and is public."

The proxy objects created with proxy() should allow calling these Object public methods without problems and the calls should return the same result as the real object the proxy object represents. The other public methods inherited from Object (wait, notify etc.) are currently allowed and they are called on the proxy object (not on the real one), as expected (this is the same behaviour as with Java Dynamic Proxies).

Discussion

  • Xavi Miró

    Xavi Miró - 2014-12-24

    Solved. Now these methods are called without problems, they give the expected result (the same result as the real object would return) and are called efficiently (without reflection).

     
  • Xavi Miró

    Xavi Miró - 2014-12-24
    • status: open --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB
Gen AI apps are built with MongoDB Atlas
Atlas offers built-in vector search and global availability across 125+ regions. Start building AI apps faster, all in one place.