Suppress some unchecked-cast warnings we cannot avoid

Type erasure makes me sad.
This commit is contained in:
Ben Liblit 2017-08-06 20:09:49 -05:00 committed by Manu Sridharan
parent ba84b5a403
commit 11b636f764
2 changed files with 8 additions and 3 deletions

View File

@ -39,7 +39,7 @@ public class ShrikeIRFactory implements IRFactory<IBytecodeMethod<IInstruction>>
public final static boolean buildLocalMap = true;
public ControlFlowGraph makeCFG(final IBytecodeMethod method) {
public ControlFlowGraph makeCFG(final IBytecodeMethod<IInstruction> method) {
return ShrikeCFG.make(method);
}

View File

@ -18,6 +18,7 @@ import com.ibm.wala.classLoader.ShrikeIRFactory;
import com.ibm.wala.classLoader.SyntheticMethod;
import com.ibm.wala.ipa.callgraph.Context;
import com.ibm.wala.ipa.summaries.SyntheticIRFactory;
import com.ibm.wala.shrikeBT.IInstruction;
import com.ibm.wala.util.debug.Assertions;
/**
@ -42,7 +43,9 @@ public class DefaultIRFactory implements IRFactory<IMethod> {
if (method.isSynthetic()) {
return syntheticFactory.makeCFG((SyntheticMethod) method);
} else if (method instanceof IBytecodeMethod) {
return shrikeFactory.makeCFG((IBytecodeMethod) method);
@SuppressWarnings("unchecked")
final IBytecodeMethod<IInstruction> castMethod = (IBytecodeMethod) method;
return shrikeFactory.makeCFG(castMethod);
} else {
Assertions.UNREACHABLE();
return null;
@ -61,7 +64,9 @@ public class DefaultIRFactory implements IRFactory<IMethod> {
if (method.isSynthetic()) {
return syntheticFactory.makeIR((SyntheticMethod) method, c, options);
} else if (method instanceof IBytecodeMethod) {
return shrikeFactory.makeIR((IBytecodeMethod) method, c, options);
@SuppressWarnings("unchecked")
final IBytecodeMethod<IInstruction> castMethod = (IBytecodeMethod<IInstruction>) method;
return shrikeFactory.makeIR(castMethod, c, options);
} else {
Assertions.UNREACHABLE();
return null;