ilmoeuro / snakeyaml

Automatically exported from code.google.com/p/snakeyaml
0 stars 0 forks source link

Improve construction of generic collections #25

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
So while type erase makes no difference between Class<Foo> and Class<Bar> at 
runtime, the information about generics is still accessible via reflection 
from Method/Field

Original issue reported on code.google.com by py4fun@gmail.com on 16 Oct 2009 at 3:20

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by py4fun@gmail.com on 16 Oct 2009 at 3:21

GoogleCodeExporter commented 9 years ago

Original comment by py4fun@gmail.com on 18 Oct 2009 at 9:25

GoogleCodeExporter commented 9 years ago
Thanks to Benjamin Bentmann for the idea.

Example is here:
http://code.google.com/p/snakeyaml/source/browse/src/test/java/examples/collecti
ons/Typ
eSafeListTest.java

Only parsing is implemented.
When dumping the redundant global tags are still emitted.

Original comment by py4fun@gmail.com on 20 Oct 2009 at 3:28

GoogleCodeExporter commented 9 years ago
Nice.
Maybe somewhere in documentation should be mentioned that it does not work if 
generic type is abstract class 
(interface). You have to put an explicit tags in your yaml.
Or am I wrong?

Original comment by alexande...@gmail.com on 21 Oct 2009 at 7:09

GoogleCodeExporter commented 9 years ago
You are right. I have added a test to prove it:
http://code.google.com/p/snakeyaml/source/browse/src/test/java/examples/collecti
ons/Typ
eSafeListWithInterfaceTest.java

Original comment by py4fun@gmail.com on 21 Oct 2009 at 10:40

GoogleCodeExporter commented 9 years ago
Both parsing and dumping is implemented. Check 
'http://code.google.com/p/snakeyaml/source/browse/#hg/src/test/java/examples/col
lection
s' for examples.

Original comment by py4fun@gmail.com on 23 Oct 2009 at 10:26