Fix warning about unchecked cast to generic by being less specific
Casting to `Foo<Bar>` results in an unchecked-cast warning due to Java generics type erasure. However, sometimes we don't really need a `Foo<Bar>`, but could simply use any `Foo<?>`. Casting to the latter creates no warning.
This commit is contained in:
parent
5bcc985069
commit
ba84b5a403
|
@ -183,7 +183,7 @@ public class AnnotationTest extends WalaTestCase {
|
|||
IMethod methodUnderTest = cha.resolveMethod(methodRefUnderTest);
|
||||
harness.assertTrue(methodRefUnderTest.toString() + " not found", methodUnderTest != null);
|
||||
harness.assertTrue(methodUnderTest + " must be bytecode method", methodUnderTest instanceof IBytecodeMethod);
|
||||
IBytecodeMethod<IInstruction> IBytecodeMethodUnderTest = (IBytecodeMethod<IInstruction>) methodUnderTest;
|
||||
IBytecodeMethod<?> IBytecodeMethodUnderTest = (IBytecodeMethod<?>) methodUnderTest;
|
||||
|
||||
Collection<Annotation>[] parameterAnnotations = IBytecodeMethodUnderTest.getParameterAnnotations();
|
||||
harness.assertEquals(expected.length, parameterAnnotations.length);
|
||||
|
|
|
@ -191,7 +191,7 @@ public class CodeScanner {
|
|||
return false;
|
||||
}
|
||||
|
||||
private static Collection<CallSiteReference> getCallSitesFromShrikeBT(IBytecodeMethod M) throws InvalidClassFileException {
|
||||
private static Collection<CallSiteReference> getCallSitesFromShrikeBT(IBytecodeMethod<?> M) throws InvalidClassFileException {
|
||||
return M.getCallSites();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue