Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-34599

Static initializers not allowed to set final fields

      The following code causes the script security plugin to fail with an ExceptionInInitializerError:

      class C {
          private final static boolean initialized;
          static { initialized = true }
      }
      

      The attached patch file adds testcases to SandboxInterceptorTest that shows this failure (and that setting the field using a field initializer and setting a non-final field via a static initalizer works)

          [JENKINS-34599] Static initializers not allowed to set final fields

          Magnus Reftel created issue -
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 170760 ] New: JNJira + In-Review [ 184026 ]
          Jesse Glick made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Jesse Glick made changes -
          Remote Link New: This issue links to "PR 132 (Web Link)" [ 17238 ]
          Jesse Glick made changes -
          Link New: This issue is duplicated by JENKINS-45446 [ JENKINS-45446 ]
          Jesse Glick made changes -
          Status Original: In Progress [ 3 ] New: In Review [ 10005 ]
          Jesse Glick made changes -
          Remote Link New: This issue links to "groovy-sandbox PR 33 (Web Link)" [ 17243 ]
          Jesse Glick made changes -
          Remote Link New: This issue links to "workflow-cps PR 157 (Web Link)" [ 17259 ]
          Jesse Glick made changes -
          Link New: This issue relates to JENKINS-45629 [ JENKINS-45629 ]
          Jesse Glick made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: In Review [ 10005 ] New: Resolved [ 5 ]
          John Forrest made changes -
          Link New: This issue relates to JENKINS-45483 [ JENKINS-45483 ]

            jglick Jesse Glick
            magnusr Magnus Reftel
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: