Ray Milkey
Committed by Gerrit Code Review

Fix some compiler warnings about unchecked types

Change-Id: Ib360aa05fd0e194a65bbc0b624447e4bdb4ced93
......@@ -241,6 +241,16 @@ public class BgpSessionManagerTest {
return new BgpRouteEntryAndPeerMatcher(bgpRouteEntry);
}
@SuppressWarnings("unchecked")
private Dictionary<String, String>
getDictionaryMock(ComponentContext componentContext) {
Dictionary<String, String> dictionary = createMock(Dictionary.class);
expect(dictionary.get("bgpPort")).andReturn("0");
replay(dictionary);
expect(componentContext.getProperties()).andReturn(dictionary);
return dictionary;
}
@Before
public void setUp() throws Exception {
peer1 = new TestBgpPeer(BGP_PEER1_ID);
......@@ -258,10 +268,7 @@ public class BgpSessionManagerTest {
bgpSessionManager = new BgpSessionManager();
// NOTE: We use port 0 to bind on any available port
ComponentContext componentContext = createMock(ComponentContext.class);
Dictionary<String, String> dictionary = createMock(Dictionary.class);
expect(dictionary.get("bgpPort")).andReturn("0");
replay(dictionary);
expect(componentContext.getProperties()).andReturn(dictionary);
Dictionary<String, String> dictionary = getDictionaryMock(componentContext);
replay(componentContext);
bgpSessionManager.activate(componentContext);
bgpSessionManager.start(dummyRouteListener);
......@@ -288,7 +295,7 @@ public class BgpSessionManagerTest {
BgpRouteEntry.PathSegment pathSegment1 =
new BgpRouteEntry.PathSegment(pathSegmentType1, segmentAsNumbers1);
pathSegments.add(pathSegment1);
asPathShort = new BgpRouteEntry.AsPath(new ArrayList(pathSegments));
asPathShort = new BgpRouteEntry.AsPath(new ArrayList<>(pathSegments));
//
byte pathSegmentType2 = (byte) BgpConstants.Update.AsPath.AS_SET;
ArrayList<Long> segmentAsNumbers2 = new ArrayList<>();
......
......@@ -56,6 +56,7 @@ public class DefaultTransactionContext implements TransactionContext {
}
@Override
@SuppressWarnings("unchecked")
public <K, V> TransactionalMap<K, V> createTransactionalMap(String mapName,
Serializer serializer) {
checkNotNull(mapName, "map name is null");
......@@ -69,6 +70,7 @@ public class DefaultTransactionContext implements TransactionContext {
return txMaps.get(mapName);
}
@SuppressWarnings("unchecked")
@Override
public void commit() {
checkState(isOpen, TX_NOT_OPEN_ERROR);
......
......@@ -155,6 +155,11 @@ public class EventuallyConsistentMapImplTest {
ecMap.destroy();
}
@SuppressWarnings("unchecked")
private EventuallyConsistentMapListener<String, String> getListener() {
return createMock(EventuallyConsistentMapListener.class);
}
@Test
public void testSize() throws Exception {
expectAnyMessage(clusterCommunicator);
......@@ -262,7 +267,7 @@ public class EventuallyConsistentMapImplTest {
// Set up expectations of external events to be sent to listeners during
// the test. These don't use timestamps so we can set them all up at once.
EventuallyConsistentMapListener<String, String> listener
= createMock(EventuallyConsistentMapListener.class);
= getListener();
listener.event(new EventuallyConsistentMapEvent<>(
EventuallyConsistentMapEvent.Type.PUT, KEY1, VALUE1));
listener.event(new EventuallyConsistentMapEvent<>(
......@@ -313,7 +318,7 @@ public class EventuallyConsistentMapImplTest {
// Set up expectations of external events to be sent to listeners during
// the test. These don't use timestamps so we can set them all up at once.
EventuallyConsistentMapListener<String, String> listener
= createMock(EventuallyConsistentMapListener.class);
= getListener();
listener.event(new EventuallyConsistentMapEvent<>(
EventuallyConsistentMapEvent.Type.REMOVE, KEY1, null));
expectLastCall().times(2);
......@@ -384,7 +389,7 @@ public class EventuallyConsistentMapImplTest {
// Set up the listener with our expected events
EventuallyConsistentMapListener<String, String> listener
= createMock(EventuallyConsistentMapListener.class);
= getListener();
listener.event(new EventuallyConsistentMapEvent<>(
EventuallyConsistentMapEvent.Type.PUT, KEY1, VALUE1));
listener.event(new EventuallyConsistentMapEvent<>(
......@@ -412,7 +417,7 @@ public class EventuallyConsistentMapImplTest {
@Test
public void testClear() throws Exception {
EventuallyConsistentMapListener<String, String> listener
= createMock(EventuallyConsistentMapListener.class);
= getListener();
listener.event(new EventuallyConsistentMapEvent<>(
EventuallyConsistentMapEvent.Type.REMOVE, KEY1, null));
listener.event(new EventuallyConsistentMapEvent<>(
......
......@@ -421,7 +421,7 @@ public class OFSwitchImplSpringOpenTTP extends AbstractOpenFlowSwitch {
// executed - if there is an action to output/group in the action
// set
// the packet will be sent there, otherwise it will be dropped.
instructions = (List<OFInstruction>) Collections.EMPTY_LIST;
instructions = Collections.<OFInstruction>emptyList();
}
OFMessage tableMissEntry = factory.buildFlowAdd()
......
......@@ -46,7 +46,7 @@ public class KshortestPathSearch<V extends Vertex, E extends Edge<V>> {
// Initialize the graph.
public KshortestPathSearch(Graph<V, E> graph) {
immutableGraph = graph;
mutableGraph = new MutableAdjacencyListsGraph(graph.getVertexes(),
mutableGraph = new MutableAdjacencyListsGraph<>(graph.getVertexes(),
graph.getEdges());
}
......@@ -136,6 +136,7 @@ public class KshortestPathSearch<V extends Vertex, E extends Edge<V>> {
}
}
@SuppressWarnings({ "rawtypes", "unchecked" })
private List<E> searchShortestPath(Graph<V, E> graph, V src, V dst) {
// Determine the shortest path from the source to the destination by using the Dijkstra algorithm.
DijkstraGraphSearch dijkstraAlg = new DijkstraGraphSearch();
......