security sandbox disallows groovy implicit class constructors

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      The sandbox appears to be unhappy with groovy classes unless they have an explicit constructor. Eg.

      class Foo {
          String bar
      }
      
      def f = new Foo(bar: 'baz')
      echo f.bar
      

      Blows up with:

      org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: unclassified new Foo java.util.LinkedHashMap
      	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onNewInstance(SandboxInterceptor.java:126)
      ...
      

      While it is happy with:

      class Foo {
          String bar
          
          Foo(String b) {
              this.bar = b
          }
      }
      
      def f = new Foo('baz')
      echo f.bar

            Assignee:
            Andrew Bayer
            Reporter:
            Joshua Hoblitt
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: