cuizhennan / snakeyaml

Automatically exported from code.google.com/p/snakeyaml
Apache License 2.0
1 stars 0 forks source link

loadAs method does not work with UserDefinedConstructor #150

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. create a user defined DiceConstructor
2. use it as document Constructor
3. call loadAs method, the parsing bypass the specified constructor

What version of SnakeYAML are you using? On what Java version?
SnakeYAML 1.9 and Java 1.7_04

Original issue reported on code.google.com by tarek.tu...@gmail.com on 10 Jun 2012 at 12:47

GoogleCodeExporter commented 9 years ago
Can you please provide a (failing) JUnit test ? The current test suite has a 
lot of examples where it works properly. We need to see the context where it 
fails.

Original comment by py4fun@gmail.com on 11 Jun 2012 at 12:10

GoogleCodeExporter commented 9 years ago
Hi Andrei
You will find attached an example of the bug. Hope it will help.

Original comment by tarek.tu...@gmail.com on 18 Jun 2012 at 12:57

Attachments:

GoogleCodeExporter commented 9 years ago
Yes, it does help.
http://code.google.com/p/snakeyaml/source/detail?r=fa585dfab6753a84428dde3f1c30c
c5969d7f8b3

Original comment by py4fun@gmail.com on 18 Jun 2012 at 4:05

GoogleCodeExporter commented 9 years ago
This is not a bug. The implicit tag is ignored when the runtime class is known.
I have added some info here:
http://code.google.com/p/snakeyaml/wiki/Documentation#Tags

There is no way now to add an "explicit" tag based on a regular expression. It 
works in your first example because there you use your own machinery to create 
an instance. You can extend this machinery to create !wheel tag. 

http://code.google.com/p/snakeyaml/source/browse/src/test/java/org/yaml/snakeyam
l/issues/issue150/YamlLoadAsIssueTest.java

Original comment by py4fun@gmail.com on 18 Jun 2012 at 5:56

GoogleCodeExporter commented 9 years ago
Documentation added.

Original comment by py4fun@gmail.com on 11 Jul 2012 at 2:32