EsotericSoftware / EsotericSoftware/yamlbeans

ClassCastException ParameterizedTypeImpl cannot be cast to Class

Open
#63 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
568
Forks
146
PR merge metrics
No merged PRs in 30d

Description

Simple test case to reproduce is available here: https://github.com/olegs/yamlbeans/blob/master/test/com/esotericsoftware/yamlbeans/GenericsTest.java

Version 1.11 fails, while 1.08 works well in this case. As far as I can see the problem is located within the following commit: https://github.com/EsotericSoftware/yamlbeans/commit/98bb93060a6714fc3e9e048460c60e1b6902d893#diff-3fc4c5fd5c3ad7273e6668dfdf14b79eR249

Stacktrace:
```
java.lang.ClassCastException: sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to java.lang.Class

at com.esotericsoftware.yamlbeans.Beans$Property.getElementTypeFromGenerics(Beans.java:283)
at com.esotericsoftware.yamlbeans.Beans$Property.(Beans.java:272)
at com.esotericsoftware.yamlbeans.Beans$FieldProperty.(Beans.java:245)
at com.esotericsoftware.yamlbeans.Beans.getProperties(Beans.java:153)
at com.esotericsoftware.yamlbeans.YamlWriter.countObjectReferences(YamlWriter.java:308)
at com.esotericsoftware.yamlbeans.YamlWriter.write(YamlWriter.java:77)
at com.esotericsoftware.yamlbeans.GenericsTest.testComplexMap(GenericsTest.java:36)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.