After upgrading java on my workstation I am observing one of these two exceptions during xml deserialization:
java.lang.ClassCastException: java.lang.Object cannot be cast to java.lang.String
org.simpleframework.xml.core.MethodException: Method types do not match for value in class java.lang.String
I investigated the problem and found out that this exception is thrown, because of java bug fix JDK-6695379 introduced in version 1.7.0_80 (Oracle Corporation). With this fix java compiler copies annotations to bridge methods. Therefore method MethodScanner.build(MethodPart, MethodPart) throws an exception, because cannot match get() and set() types. Or the ClassCastException is thrown, because the bridge with wrong data type is chosen.
I am attaching an example program demonstrating this problem. To test it, run the SerializationUtilsTest.testDeserializeXml test on Oracle java version 1.7.0_79 (the test should pass) and on Oracle java version 1.7.0_80 or higher (the test should fail).
To filter out bridge methods the java.lang.reflect.Method.isBridge() method can be used.
Last edit: Piotr 2016-01-14
I made more tests and it seems to fix the bug the DetailScanner.methods(Class) should be changed as follows: