UcasRichard / snakeyaml

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

org.yaml.snakeyaml.Yaml yaml = new org.yaml.snakeyaml.Yaml(new Constructor()) reports undefined Constructor #113

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. When trying to construct a Yaml instance with a Constructor argument in 
Eclipse, Eclipse reports an undefined Constructor. Only default and Dumper 
constructor are visible

This occurs on SnakeYML 1.8 and 1.7 and Java 1.5.12

Original issue reported on code.google.com by jsn.har...@gmail.com on 18 Mar 2011 at 12:43

GoogleCodeExporter commented 9 years ago
Are you sure you imported Constructor from SnakeYAML ?
Can you please show the complete source which fails to compile ?

Original comment by py4fun@gmail.com on 18 Mar 2011 at 1:56

GoogleCodeExporter commented 9 years ago
Here's the complete source:
package com.flirtomatic;

import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.constructor.Constructor;

public class YamlTest {

    public void wontAllowYamlWithConstructor(){
        //Just using String.class as an example
        Constructor constructor = new Constructor(String.class);
        Yaml yaml = new Yaml(constructor);
    }
}

It seems that its specific to Eclipse as compilation outside of Eclipse 
succeeds. snakeyaml is definitely on my Eclipse build path.

Actually, I just removed the testng jar from my Eclipse build path and the 
above code now compiles (in Eclipse). There's a class in testNg called Yaml as 
well so I guess Eclipse was not distinguishing classes properly. And now that 
I've re-added the testng jar, Eclipse is still happy(!) Very strange, but its 
not a SnakeYAML issue. 
Thanks anyway.

Original comment by jsn.har...@gmail.com on 18 Mar 2011 at 5:17

GoogleCodeExporter commented 9 years ago
I assume you use TestNG 6.0: 
http://beust.com/weblog/2011/03/15/announcing-testng-6-0/

Original comment by py4fun@gmail.com on 18 Mar 2011 at 6:11