Skip to content

Instantly share code, notes, and snippets.

@goldmann
Last active November 26, 2019 13:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save goldmann/5edf85e44578c8a725f6dc761c7574b5 to your computer and use it in GitHub Desktop.
Save goldmann/5edf85e44578c8a725f6dc761c7574b5 to your computer and use it in GitHub Desktop.
@Grapes([
@Grab('org.yaml:snakeyaml:1.25')
])
import org.yaml.snakeyaml.constructor.Constructor
import org.yaml.snakeyaml.nodes.NodeId
import org.yaml.snakeyaml.nodes.MappingNode
class SelectiveConstructor extends Constructor {
SelectiveConstructor() {
new ConstructProduct()
}
class ConstructProduct extends Constructor.ConstructMapping {
}
}
new SelectiveConstructor()
@goldmann
Copy link
Author

Failing with:

Caught: java.lang.ArrayIndexOutOfBoundsException: 0
java.lang.ArrayIndexOutOfBoundsException: 0
        at SelectiveConstructor$ConstructProduct.<init>(YamlConstruct.groovy)
        at SelectiveConstructor.<init>(YamlConstruct.groovy:12)
        at YamlConstruct.run(YamlConstruct.groovy:31)

Similar to: https://stackoverflow.com/questions/25656479/looking-to-extend-inner-classes-in-groovy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment