Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-10039

groovy.lang.MissingPropertyException for a property that exists

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.0.6, 3.0.7
    • 3.0.8
    • GroovyScriptEngine
    • None
    • OS: Mac OS X, Ubuntu 18.04
      Groovy versions with exception: 3.x(3.0.7, 3.0.6)
      Groovy versions working as expected: 2.5.x(2.5.14, 2.5.8)
      JDK versions: Happening in JDK8 and JDK11

    Description

      Consider the below script, SnakeYaml.groovy

       

      @Grab(group = 'org.yaml', module = 'snakeyaml', version = '1.28')
      
      import org.yaml.snakeyaml.DumperOptions
      import org.yaml.snakeyaml.Yaml
      
      def object = [
       array: [1, 2]
      ]
      DumperOptions dumperOptions = new DumperOptions(defaultFlowStyle: DumperOptions.FlowStyle.BLOCK,
       indent: 2, width: 200, indentWithIndicator: true, indicatorIndent: 2)
      println(new Yaml(dumperOptions).dump(object))

       

       

      When running the below script as groovy SnakeYaml.groovy in groovy 3.x, the below exception is thrown:

      Caught: groovy.lang.MissingPropertyException: No such property: indentWithIndicator for class: org.yaml.snakeyaml.DumperOptions
      groovy.lang.MissingPropertyException: No such property: indentWithIndicator for class: org.yaml.snakeyaml.DumperOptions
      	at SnakeYaml.run(SnakeYaml.groovy:9)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

       

      The same script runs fine in groovy 2.5.x and returns the below output as expected:

      array:
       - 1
       - 2
      

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            devatherock Devaprasadh Xavier
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: