Closed GoogleCodeExporter closed 9 years ago
Well, how do you expect to distinguish 3 constructors for the proposed syntax:
!!Foo ['a','b','c']
public class Foo {
public final List<String> bars;
public Foo(List<String> bars) { //1st
this.bars = bars;
//do some stuff
}
public Foo(String... args) { // 2nd
this.bars = bars;
//do some other stuff
}
public Foo(String s1, String s2, String s3) { //3rd
this.bars = bars;
//do yet another stuff
}
}
What about this ?
public class Foo extends List<String>
Please be aware that SnakeYAML has some restrictions on the object construction
because it tries to stay general. If you write your own Constructor (sorry for
the confusing terminology), you can create anything you like. You are only
restricted by your imagination...
Original comment by py4fun@gmail.com
on 24 Sep 2013 at 8:42
My apologies for a faulty issue description. I *meant* to say:
YAML: !!Foo [['a','b','c']]
Should find a constructor signature like:
Foo(List list)
But at the moment, it will only find:
Foo(ArrayList list)
And for primitives:
YAML: !!Bar [1]
Should find constructor signature:
Bar(int i)
But at the moment it only finds:
Bar(Integer i)
I observed a similar 'could not find constructor' issue for
boolean/java.lang.Boolean as well.
I agree that it isn't snakeyaml's place to try and second-guess the signatures
and marshall String,String,String to List<String>. My bad, sorry.
Original comment by david.bu...@machaira.com.au
on 24 Sep 2013 at 11:41
would it be possible to get failing TestCase ?
Original comment by alexande...@gmail.com
on 25 Sep 2013 at 6:02
btw, are those constructors public? (I mean in your particular case - int,
boolean, ...)
Seems like we search only for public constructors at the moment. Ant tests
connected to immutable objects do use primitive constructors. For example
Color(int,int,int)
2py4fun : should we actually check all af them?
Original comment by alexande...@gmail.com
on 25 Sep 2013 at 6:13
[deleted comment]
[deleted comment]
[deleted comment]
Sorry, my problem is an old snakeyaml on the classpath, thanks to it being
bundled with TestNG. Isolating for just 1.14-SNAPSHOT it works just as it
ought to. Sorry about the bogus report. Please close this issue as 'cannot
reproduce'.
Original comment by david.bu...@machaira.com.au
on 25 Sep 2013 at 7:45
2 alexander.maslov:
we may try to check them all (if you know how to do it without a lot of
overhead)
Original comment by py4fun@gmail.com
on 25 Sep 2013 at 7:54
Original issue reported on code.google.com by
david.bu...@machaira.com.au
on 24 Sep 2013 at 2:39