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

ConfigSlurper cannot parse 'main' config

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.5.3, 2.5.4, 2.5.5, 2.5.6, 2.5.7
    • Fix Version/s: None
    • Component/s: groovy-jdk
    • Labels:
      None
    • Environment:
      jdk1.8.0_212, macos 10.14.5

      Description

      Groovy 2.5.3+ ConfigSlurper throws a MissingMethodException when parsing a groovy configuration script that contains a node named "main".  In prior versions of groovy (tested with 2.4.17, 2.5.0, 2.5.1, 2.5.2), such a configuration script parses the 'main' config without incident.

      You can use this repo to reproduce the issue.

      https://github.com/niels1voo/groovy-config-slurper

      top {

        main {     

          prop1 = 'one'

          }

      }

       

      Exception in thread "main" groovy.lang.MissingMethodException: No signature of method: static script15627752169791997469366.main() is applicable for argument types: (script15627752169791997469366$_run_closure1$_closure2) values: [script15627752169791997469366$_run_closure1$_closure2@15de0b3c]
      Possible solutions: main([Ljava.lang.String, wait(), wait(long), run(), run(), find()
      at groovy.lang.MetaClassImpl.invokeStaticMissingMethod(MetaClassImpl.java:1528)
      at groovy.lang.MetaClassImpl.invokeStaticMethod(MetaClassImpl.java:1514)
      at groovy.lang.ExpandoMetaClass.invokeStaticMethod(ExpandoMetaClass.java:1143)
      at org.codehaus.groovy.runtime.callsite.StaticMetaClassSite.callStatic(StaticMetaClassSite.java:64)
      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:55)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:196)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:208)
      at script15627752169791997469366$_run_closure1.doCall(script15627752169791997469366.groovy:5)
      at script15627752169791997469366$_run_closure1.doCall(script15627752169791997469366.groovy)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:104)
      at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:326)
      at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264)
      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1041)
      at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:41)
      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:119)
      at groovy.util.ConfigSlurper$_parse_closure5.doCall(ConfigSlurper.groovy:258)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:104)
      at org.codehaus.groovy.runtime.metaclass.ClosureMetaMethod.invoke(ClosureMetaMethod.java:84)
      at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1128)
      at groovy.lang.DelegatingMetaClass.invokeMethod(DelegatingMetaClass.java:230)
      at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:68)
      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:156)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:168)
      at script15627752169791997469366.run(script15627752169791997469366.groovy:2)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:104)
      at org.codehaus.groovy.reflection.CachedMethod$invoke.call(Unknown Source)
      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:135)
      at groovy.util.ConfigSlurper$_parse_closure5.doCall(ConfigSlurper.groovy:270)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:498)
      at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:104)
      at org.codehaus.groovy.runtime.metaclass.ClosureMetaMethod.invoke(ClosureMetaMethod.java:84)
      at groovy.lang.ExpandoMetaClass.invokeMethod(ExpandoMetaClass.java:1128)
      at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1041)
      at groovy.lang.DelegatingMetaClass.invokeMethod(DelegatingMetaClass.java:151)
      at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:41)
      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:119)
      at groovy.util.ConfigSlurper.parse(ConfigSlurper.groovy:288)
      at groovy.util.ConfigSlurper$parse$2.callCurrent(Unknown Source)
      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:156)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:176)
      at groovy.util.ConfigSlurper.parse(ConfigSlurper.groovy:162)
      at groovy.util.ConfigSlurper$parse$1.callCurrent(Unknown Source)
      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:156)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:168)
      at groovy.util.ConfigSlurper.parse(ConfigSlurper.groovy:151)
      at groovy.util.ConfigSlurper$parse$0.callCurrent(Unknown Source)
      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:156)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:168)
      at groovy.util.ConfigSlurper.parse(ConfigSlurper.groovy:142)
      at groovy.util.ConfigSlurper$parse.call(Unknown Source)
      at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:115)
      at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:127)
      at gcs2417.App.main(App.groovy:28)

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              nielsv Niels Voorhoeve
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: