title: how to fix evaluation of for looping
body: <p>I have code of javabridge but when I want to rebuild this code, I got an error in this code:
  code witch call the code error is here</p>
  <pre><code> private &lt;T&gt; SoftReference getReference(final URLClassLoaderEntry entry, final List handlers) {
          if (handlers.isEmpty()) {
              return new SoftReference((T)entry);
          }
          return new DeleteTempFileAction(entry, DynamicClassLoader.TEMP_FILE_QUEUE, handlers);
      }
  </code></pre>
  <p>here the code where i got error</p>
  <pre><code>public DeleteTempFileAction(final Object arg0, final ReferenceQueue arg1, final List handlers) {
              super(arg0, arg1);
              this.handlers = handlers;
              DynamicClassLoader.DELETE_TEMP_FILE_ACTIONS.add(this);
              if (Logger.getLogLevel() &gt; 4) {
                  int count = 0;
                  int orphaned = 0;
                  for (final SoftReference val : DynamicClassLoader.DELETE_TEMP_FILE_ACTIONS) {
                      ++count;
                      if (val.get() == null) {
                          ++orphaned;
                      }
                  }
                  Logger.logDebug(&quot;classloader stats: entries: &quot; + count + &quot; orphaned: &quot; + orphaned);
              }
          }
          
          public void command() {
              for (final DynamicHttpURLConnectionHandler handler : this.handlers) {
                  handler.deleteTempFile();
              }
          }
  </code></pre>
  <p>At this code I got 2 error there are in:
  1.</p>
  <pre><code> for (final SoftReference val : DynamicClassLoader.DELETE_TEMP_FILE_ACTIONS) {
                          ++count;
                          if (val.get() == null) {
                              ++orphaned;
                          }
                      }
  </code></pre>
  <ol start="2">
  <li><p>for (final DynamicHttpURLConnectionHandler handler : this.handlers) {
  handler.deleteTempFile();
  }</p>
  </li>
  </ol>
  <p>Error for the first code is:</p>
  <pre><code>Type Missmatch : Cannot convert from element type object to SoftReference
  </code></pre>
  <p>Error for the second code is:</p>
  <pre><code>Type Missmatch : Cannot convert from element type object to DynamicHttpURLConnectionHandler
  </code></pre>
  <p>type of DynamicClassLoader.DELETE_TEMP_FILE_ACTIONS is</p>
  <pre><code>private static final Set DELETE_TEMP_FILE_ACTIONS;
  </code></pre>
  <p>and for the second one for
  class of DynamicHttpURLConnectionHandler is</p>
  <pre><code>class DynamicHttpURLConnectionHandler extends URLStreamHandler
  {
      private JarFile jarFile;
      private File baseFile;
      private Map headerFields;
      
      public DynamicHttpURLConnectionHandler() {
          if (Logger.getLogLevel() &gt; 4) {
              Logger.logDebug(&quot;tempfile create DynamicHttpURLConnectionHander &quot; + this);
          }
      }
      
      @Override
      protected URLConnection openConnection(final URL u) throws IOException {
          return new DynamicJarURLConnection(u, this);
      }
      
      public void deleteTempFile() {
          if (Logger.getLogLevel() &gt; 4) {
              Logger.logDebug(&quot;classloader tempfile deleted: &quot; + this.baseFile + &quot; handler: &quot; + this);
          }
          this.baseFile.delete();
      }
      
      public Map getHeaderFields() {
          return this.headerFields;
      }
      
      public JarFile getTempFile() {
          return this.jarFile;
      }
      
      public void setTempFile(final JarFile jarFile, final File baseFile) {
          if (Logger.getLogLevel() &gt; 4) {
              Logger.logDebug(&quot;classloader tempfile created: &quot; + baseFile + &quot; handler&quot; + this);
          }
          this.jarFile = jarFile;
          this.baseFile = baseFile;
      }
      
      public void setHeaderFields(final Map headerFields) {
          this.headerFields = headerFields;
      }
  }
  </code></pre>
  <p>for SoftReference I have this class</p>
  <p>public class SoftReference extends Reference {</p>
  <pre><code>/**
   * Timestamp clock, updated by the garbage collector
   */
  static private long clock;
  
  /**
   * Timestamp updated by each invocation of the get method.  The VM may use
   * this field when selecting soft references to be cleared, but it is not
   * required to do so.
   */
  private long timestamp;
  
  /**
   * Creates a new soft reference that refers to the given object.  The new
   * reference is not registered with any queue.
   *
   * @param referent object the new soft reference will refer to
   */
  public SoftReference(T referent) {
      super(referent);
      this.timestamp = clock;
  }
  
  /**
   * Creates a new soft reference that refers to the given object and is
   * registered with the given queue.
   *
   * @param referent object the new soft reference will refer to
   * @param q the queue with which the reference is to be registered,
   *          or &lt;tt&gt;null&lt;/tt&gt; if registration is not required
   *
   */
  public SoftReference(T referent, ReferenceQueue&lt;? super T&gt; q) {
      super(referent, q);
      this.timestamp = clock;
  }
  
  /**
   * Returns this reference object's referent.  If this reference object has
   * been cleared, either by the program or by the garbage collector, then
   * this method returns &lt;code&gt;null&lt;/code&gt;.
   *
   * @return   The object to which this reference refers, or
   *           &lt;code&gt;null&lt;/code&gt; if this reference object has been cleared
   */
  public T get() {
      T o = super.get();
      if (o != null &amp;&amp; this.timestamp != clock)
          this.timestamp = clock;
      return o;
  }
  </code></pre>
  <p>}</p>
  <p>i have try to use Set but still got an error</p>
  <p>My question is how to fix this problem?</p>