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

configscript prevents extensions to work, order-dependent, probably commandline parser problem

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • Compiler

    Description

      In the scenario detailed below, commands

      groovy -cp ext --configscript c.groovy t.groovy
      groovy --configscript c.groovy -cp ext t.groovy
      

      behave differently. Probably a bug in command line parsing; might be related to the way short and long options are handled.

      The test case is somewhat convoluted, there's an extension which works properly with one order of arguments, does not with another:

      177 /tmp> >ext.groovy                                                       
      class ext {
       static void foo(Object dummy) { println "Okay" }
      }
      178 /tmp> groovyc -d ext ext.groovy                                         
      179 /tmp> mkdir -p ext/META-INF/services                                    
      180 /tmp> >ext/META-INF/services/org.codehaus.groovy.runtime.ExtensionModule
      moduleName=ext
      moduleVersion=1.0
      staticExtensionClasses=ext
      181 /tmp> >t.groovy                                           
      @groovy.transform.TypeChecked class t {
       static def main(av) {
         t.foo()
       }
      }
      182 /tmp> groovy -cp ext t.groovy                             
      Okay
      183 /tmp> >c.groovy
      configuration.sourceEncoding="UTF-8"
      184 /tmp> 
      191 /tmp> groovy -cp ext --configscript c.groovy t.groovy      
      Okay
      192 /tmp> groovy --configscript c.groovy -cp ext t.groovy
      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      /private/tmp/t.groovy: 3: [Static type checking] - Cannot find matching 
      method java.lang.Class#foo(). Please check if the declared type is right and
       if the method exists.
      @ line 3, column 5.
            t.foo()
            ^
      1 error
      193 /tmp> 
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            oc OC
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: