title: Type mismatch: cannot convert from <ObjectTypeX> to <ObjectTypeX> in Tomcat7/Java 1.7
body: <p>I'm encountering a strange error on the following line:</p>
  
  <pre><code>ArrayList&lt;BlastHit&gt; filtered = new ArrayList&lt;BlastHit&gt;();
  </code></pre>
  
  <p>...where BlastHit is a class I have written.</p>
  
  <p>This is in a .jsp file, executed by Tomcat 7 on Ubuntu, with Java 1.7.</p>
  
  <p>The full stacktrace is:</p>
  
  <pre><code>org.apache.jasper.JasperException: Unable to compile class for JSP: 
  
  An error occurred at line: 26 in the jsp file: /results.jsp
  Type mismatch: cannot convert from java.util.ArrayList&lt;BlastHit&gt; to java.util.ArrayList&lt;BlastHit&gt;
  23: ArrayList&lt;BlastHit&gt; filtered = new ArrayList&lt;BlastHit&gt;();
  24: try {
  25:     blastResults = new BlastResults(json);
  26:     filtered = Blast.filterBySpecies(blastResults.getHits(), request.getParameterValues("species"));
  27: } catch (Exception e) {
  28:     blastResults = new BlastResults();
  29:     filtered = new ArrayList&lt;BlastHit&gt;();
  
  
  An error occurred at line: 58 in the jsp file: /results.jsp
  The method makeHitHTML(BlastHit) in the type Blast is not applicable for the arguments (BlastHit)
  55:             out.println("No hits found");
  56:         }
  57:         for (int i = 0; i &lt; filtered.size(); i++) {
  58:             out.println(Blast.makeHitHTML((BlastHit)filtered.get(i)));
  59:         }
  60:     }
  61:     %&gt;
  
  
  Stacktrace:
  org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
  org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:366)
  org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:468)
  org.apache.jasper.compiler.Compiler.compile(Compiler.java:378)
  org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
  org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
  org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:657)
  org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
  org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
  </code></pre>
  
  <p>Isn't it essentially telling me that it can't convert from type <code>BlastHit</code> to type <code>BlastHit</code>? They're the same class! What's going on here?</p>
  
  <p>I've probably omitted some vital piece of data, so feel free to ask me for more information.</p>
  
  <p>Thanks a lot.</p>
  
  <p>P.S. I appreciate you're not really supposed to write scriptlets in JSP pages these days but... well, one problem at a time.</p>
  
  <p>EDIT: I appreciate the error message says the problem is on line 26, but if you remove this it then has a problem with the <code>ArrayList&lt;BlastHit&gt; filtered = new ArrayList&lt;BlastHit&gt;();</code> line.</p>