Fix ClassCastException in tryClimb building inheritance map

The interface uses the generic Collection type but the implementation
an ArrayList. Fix by creating an ArrayList from the Collection. Resolves
this crash observed when updating MCPC+'s plugin loader:

https://gist.github.com/agaricusb/5471423
This commit is contained in:
Agaricus 2013-04-26 18:03:31 -07:00
parent 04069fb8b9
commit d33223562d
2 changed files with 3 additions and 3 deletions

View File

@ -127,8 +127,8 @@ public class InheritanceMap implements InheritanceProvider {
return inheritanceMap.get(className); return inheritanceMap.get(className);
} }
public void setParents(String className, ArrayList<String> parents) { public void setParents(String className, Collection<String> parents) {
inheritanceMap.put(className, parents); inheritanceMap.put(className, new ArrayList<String>(parents));
} }
public int size() { public int size() {

View File

@ -81,7 +81,7 @@ public class JarMapping {
parents = inheritanceMap.getParents(owner); parents = inheritanceMap.getParents(owner);
} else if (fallbackInheritanceProvider != null) { } else if (fallbackInheritanceProvider != null) {
parents = fallbackInheritanceProvider.getParents(owner); parents = fallbackInheritanceProvider.getParents(owner);
inheritanceMap.setParents(owner, (ArrayList<String>) parents); inheritanceMap.setParents(owner, parents);
} }
if (parents != null) { if (parents != null) {