Fix Eclipse warnings about unchecked casts to generics

This is the first time I can ever remember explicitly casting to
`Object`.  Such a cast might seem useless, and certainly it is
statically known to always succeed.  However, it is here for good
reason.  Without the cast, we end up making a `Pair<Object, ?>` but
what we really want is a `Pair<Object, Object>`.
This commit is contained in:
Ben Liblit 2017-08-06 19:15:48 -05:00 committed by Manu Sridharan
parent bb6be21e2d
commit daea7095e2
1 changed files with 4 additions and 4 deletions

View File

@ -100,17 +100,17 @@ public abstract class TestCAstTranslator extends WalaTestCase {
}
}
Pair<Object, Object>[] instanceMethods = (Pair[]) entry[4];
Pair<?, ?>[] instanceMethods = (Pair[]) entry[4];
if (instanceMethods != null) {
for (int i = 0; i < instanceMethods.length; i++) {
this.instanceMethods.put(Pair.make(clsName, instanceMethods[i].fst), instanceMethods[i].snd);
this.instanceMethods.put(Pair.make(clsName, (Object) instanceMethods[i].fst), instanceMethods[i].snd);
}
}
Pair<Object, Object>[] staticMethods = (Pair[]) entry[5];
Pair<?, ?>[] staticMethods = (Pair[]) entry[5];
if (staticMethods != null) {
for (int i = 0; i < staticMethods.length; i++) {
this.staticMethods.put(Pair.make(clsName, staticMethods[i].fst), staticMethods[i].snd);
this.staticMethods.put(Pair.make(clsName, (Object) staticMethods[i].fst), staticMethods[i].snd);
}
}
}