upgrading to snakeyaml-2.0 causing compile errors

Issue #1068 invalid
Ruixin Bao created an issue

Hi,

When I upgrade snakeyaml to version 2.0, I encounter compile errors caused by Constructor class, the code I was having is something like the following:

Constructor constructor = new Constructor(Example.class)

The error mentioned that Example.class can not be converted to LoaderOptions

I tried searching past issues and documentation but didn’t seem to find much relevant info, so I am wondering if someone can provide info/recommendation for the equivalent code in 2.0? Thank you in advance for your help!

Comments (5)

  1. Andrey Somov

    here it is

      /**
       * Create
       *
       * @param theRoot - the class to create (to be the root of the YAML document)
       * @param loadingConfig - options
       */
      public Constructor(Class<? extends Object> theRoot, LoaderOptions loadingConfig) {
        this(new TypeDescription(checkRoot(theRoot)), null, loadingConfig);
      }
    

    which becomes:

    Constructor constructor = new Constructor(Example.class, new LoaderOptions());

    but it is better to create and configure the options for your context

  2. Log in to comment