title: Apache Beam returns "Input values must not be mutated in any way." when using local direct runner
body: <p>I wrote an Apache Beam DoFn </p>
  
  <pre><code>static class FillLocation extends DoFn&lt;TrackingRequest, TrackingRequest&gt; {
          @ProcessElement
          public void processElement(ProcessContext c) {    
              TrackingRequest rq = c.element();
              rq.location = getLocationFromIP(rq.IP);         
              c.output(rq);
          }
  }
  </code></pre>
  
  <p>And it gave me this error when testing it locally
   PTransform .. illegaly mutated value .. of class.....</p>
  
  <pre><code> Input values must not be mutated in any way.
      at org.apache.beam.runners.direct.ImmutabilityEnforcementFactory$ImmutabilityCheckingEnforcement.verifyUnmodified(ImmutabilityEnforcementFactory.java:96)
      at org.apache.beam.runners.direct.ImmutabilityEnforcementFactory$ImmutabilityCheckingEnforcement.afterElement(ImmutabilityEnforcementFactory.java:71)
      at org.apache.beam.runners.direct.TransformExecutor.processElements(TransformExecutor.java:149)
      at org.apache.beam.runners.direct.TransformExecutor.run(TransformExecutor.java:107)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      at java.lang.Thread.run(Thread.java:745)
  </code></pre>