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

Static initializers not allowed to set final fields

XMLWordPrintable

      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)

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

              Created:
              Updated:
              Resolved: