You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Devaprasadh Xavier (Jira)" <ji...@apache.org> on 2021/04/17 14:59:00 UTC

[jira] [Created] (GROOVY-10039) groovy.lang.MissingPropertyException for a property that exists

Devaprasadh Xavier created GROOVY-10039:
-------------------------------------------

             Summary: groovy.lang.MissingPropertyException for a property that exists
                 Key: GROOVY-10039
                 URL: https://issues.apache.org/jira/browse/GROOVY-10039
             Project: Groovy
          Issue Type: Bug
          Components: GroovyScriptEngine
    Affects Versions: 3.0.7, 3.0.6
         Environment: 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
            Reporter: Devaprasadh Xavier


Consider the below script, {{SnakeYaml.groovy}}

 
{noformat}
@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)){noformat}
 

 

When running the below script as {{groovy SnakeYaml.groovy}} in groovy 3.x, the below exception is thrown:
{noformat}
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){noformat}
 

The same script runs fine in groovy 2.5.x and returns the below output as expected:
{noformat}
array:
 - 1
 - 2
{noformat}
 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)