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

@Newify(auto=false) causing error (in Groovy Web Console)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.4.13
    • None
    • None

    Description

      When I run this with no auto=flase attribute or with auto=true, it runs successfully (in Groovy Web Console). When I run as below, I get a strange error:

      java.lang.ExceptionInInitializerError
      	at Script1.run(Script1.groovy:15)
      Caused by: groovy.lang.MissingMethodException: No signature of method: static Bar.Foo() is applicable for argument types: () values: []
      Possible solutions: any(), is(java.lang.Object), any(groovy.lang.Closure), use([Ljava.lang.Object;), use(java.util.List, groovy.lang.Closure), use(java.lang.Class, groovy.lang.Closure)
      	at Bar.<clinit>(Script1.groovy:10)
      
      class Foo {
        Foo() {
          println 'new foo'
        }
      }
      
      @Newify(auto=false, value=Foo)
      class Bar {
        static {
          Foo foo = Foo()
        }
        static void method() {}
      }
      
      ​Bar.method()
      

      Attachments

        Issue Links

          Activity

            People

              jwagenleitner John Wagenleitner
              emilles Eric Milles
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: