Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 364873 - Calling Equal on an EntityManagerFactoryBuilder causes ClassCastException
Summary: Calling Equal on an EntityManagerFactoryBuilder causes ClassCastException
Status: RESOLVED FIXED
Alias: None
Product: Gemini.JPA
Classification: RT
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 1.1.0 M1   Edit
Assignee: Michael Keith CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-25 16:24 EST by Christoph Laeubrich CLA
Modified: 2012-03-20 16:36 EDT (History)
1 user (show)

See Also:
michael.keith: iplog+


Attachments
patch for handling calls to equals method (758 bytes, patch)
2012-01-04 06:17 EST, Gunnar Wagenknecht CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Laeubrich CLA 2011-11-25 16:24:54 EST
Build Identifier: gemini-jpa-1.0.0.RC3

java.lang.ClassCastException: $Proxy1 cannot be cast to java.util.Map
	at org.eclipse.gemini.jpa.proxy.EMFBuilderServiceProxyHandler.invoke(EMFBuilderServiceProxyHandler.java:63)
	at $Proxy1.equals(Unknown Source)

Reproducible: Always

Steps to Reproduce:
1. Fetch an instance of EntityManagerFactoryBuilder
2. call equals (either direct or for example lock up the reference in a Map or Collection)
3. java.lang.ClassCastException: $Proxy1 cannot be cast to java.util.Map is thrown
Comment 1 Gunnar Wagenknecht CLA 2012-01-04 06:17:06 EST
Created attachment 208999 [details]
patch for handling calls to equals method

The attached patch should fix the issue. It adds handling of the #equals method.
Comment 2 Christoph Laeubrich CLA 2012-01-04 13:13:33 EST
Maybe you want handling the hashCode method also, I'm not sure if there is any issue with this, but normally if you hand over the equals to the proxy you should also use hashCode of the proxy to be consistent with the general contract of hashcode/equals.
Comment 3 Gunnar Wagenknecht CLA 2012-01-04 15:07:02 EST
Handling for hashCode as well as toString is already implemented in the proxy.
Comment 4 Christoph Laeubrich CLA 2012-01-04 15:33:14 EST
Right haven't seen that, thanks for the patch hopefully someone is applying it soon :)
Comment 5 Michael Keith CLA 2012-03-20 16:36:14 EDT
Merged in.
Thanks for the bug report and for the fix.
Comment 6 Michael Keith CLA 2012-03-20 16:36:44 EDT
Fixed.