title: What is the effect of @NonCPS in a Jenkins pipeline script
body: <p>I have a pipeline script in Jenkins.</p>
  
  <p>I used to get this exception:</p>
  
  <blockquote>
    <p>org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException:
    Scripts not permitted to use method groovy.json.JsonSlurperClassic
    parseText java.lang.String</p>
  </blockquote>
  
  <p>I looked the exception up and I found some indications that I should annotate the method where theexception occurs with <code>@NonCPS</code>. I did this, without really understanding what this does.</p>
  
  <p>After that however, an Exception that I was throwing in that method was no longer caught by a <code>try</code> clause.</p>
  
  <p>So what's the idea behind <code>@NonCPS</code>? What are the effects of using it?</p>