Hi all,
I'm writing a program that uses a closed-source jar in its library (with permission, of course).
One of the classes in that jar wasn't working as I wanted it to, so I extended the class and overwrote one of its methods. So, when using the class, instead of calling
ThirdPartyClass obj = new ThirdPartyClass();
I could use
MyThirdPartyClass obj = new MyThirdPartyClass();
This seems to work, until a certain line of their code throws a class cast exception:
java.lang.ClassCastException: org.thirdparty.ThirdPartyClass$2
at org.thirdparty.Event.findTop(Event.java:279)
at org.thirdparty.ThreadUtils$4.run(ThreadUtils.java:86
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
....
Why does this occur? Surely, since MyThirdPartyClass is a child of ThirdPartyClass, anything that expects a ThirdPartyClass shouldn't have any problem, right? Or do I have that backwards? And if so, is there anything I can do to fix the problem?
Thanks!
Sam