Fix OpenJDK compatibility (a generic type inference bug) by removing the
ability to return a different type than is requested.  None of our code
uses this ability, and it is easy enough to copy the returned list into a
list of the supertype externally anyway.

Issue: 3058
Patch by: jat
Review by: scottb, bobv



git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@5184 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/core/ext/linker/ArtifactSet.java b/dev/core/src/com/google/gwt/core/ext/linker/ArtifactSet.java
index 6e865c0..36ca26a 100644
--- a/dev/core/src/com/google/gwt/core/ext/linker/ArtifactSet.java
+++ b/dev/core/src/com/google/gwt/core/ext/linker/ArtifactSet.java
@@ -61,35 +61,30 @@
     return treeSet.containsAll(c);
   }
 
+  @Override
   public boolean equals(Object o) {
     return treeSet.equals(o);
   }
 
   /**
    * Find all Artifacts assignable to some base type. The returned value will be
-   * a snapshot of the values in the ArtifactSet. The following two examples
-   * result in an equivalent set:
+   * a snapshot of the values in the ArtifactSet. An example of how this could
+   * be used:
    * 
    * <pre>
-   * SortedSet&lt;EmittedArtifact&gt; search = artifactSet.find(PublicResource.class);
-   * search.addAll(artifactSet.find(GeneratedResource.class);
+   *   for (EmittedArtifact ea : artifactSet.find(EmittedArtifact.class)) {
+   *     ...
+   *   }
    * </pre>
    * 
-   * or
-   * 
-   * <pre>
-   * SortedSet&lt;EmittedArtifact&gt; search = artifactSet.find(EmittedArtifact.class);
-   * </pre>
-   * 
-   * @param <A> a type bound possibly wider than the desired type of artifact
    * @param <T> the desired type of Artifact
    * @param artifactType the desired type of Artifact
    * @return all Artifacts in the ArtifactSet assignable to the desired type
    */
-  public <A extends Artifact<?>, T extends A> SortedSet<A> find(
+  public <T extends Artifact<? super T>> SortedSet<T> find(
       Class<T> artifactType) {
     // TODO make this sub-linear (but must retain order for styles/scripts!)
-    SortedSet<A> toReturn = new TreeSet<A>();
+    SortedSet<T> toReturn = new TreeSet<T>();
     for (Artifact<?> artifact : this) {
       if (artifactType.isInstance(artifact)) {
         toReturn.add(artifactType.cast(artifact));
@@ -113,6 +108,7 @@
     }
   }
 
+  @Override
   public int hashCode() {
     return treeSet.hashCode();
   }