Fix Eclipse errors with Java 8/Scala 87/34387/2
authorRobert Varga <rovarga@cisco.com>
Wed, 10 Feb 2016 11:37:38 +0000 (12:37 +0100)
committerRobert Varga <rovarga@cisco.com>
Wed, 10 Feb 2016 11:41:06 +0000 (12:41 +0100)
This adds workarounds for ambiguous method error reported by Eclipse.
The issue is reported and analyzed at
https://bugs.eclipse.org/bugs/show_bug.cgi?id=468276. This patch adds
alternative use of methods which trigger the behavior.

Change-Id: If463d4567e3555efff8e11b39e8708d0e51838c1
Signed-off-by: Robert Varga <rovarga@cisco.com>
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/RemoteTransactionContextSupport.java
opendaylight/md-sal/sal-distributed-datastore/src/main/java/org/opendaylight/controller/cluster/datastore/ShardManager.java
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/ShardManagerTest.java

index 4302ed0..e160367 100644 (file)
@@ -110,7 +110,7 @@ final class RemoteTransactionContextSupport {
             // For write-only Tx's we prepare the transaction modifications directly on the shard actor
             // to avoid the overhead of creating a separate transaction actor.
             transactionContextWrapper.executePriorTransactionOperations(createValidTransactionContext(
-                    primaryShard, primaryShard.path().toString(), primaryShardInfo.getPrimaryShardVersion()));
+                    primaryShard, String.valueOf(primaryShard.path()), primaryShardInfo.getPrimaryShardVersion()));
         } else {
             tryCreateTransaction();
         }
index 70bdb20..4b511fa 100644 (file)
@@ -750,7 +750,7 @@ public class ShardManager extends AbstractUntypedPersistentActorWithMetering {
     }
 
     private void memberRemoved(ClusterEvent.MemberRemoved message) {
-        String memberName = message.member().roles().head();
+        String memberName = message.member().roles().iterator().next();
 
         LOG.debug("{}: Received MemberRemoved: memberName: {}, address: {}", persistenceId(), memberName,
                 message.member().address());
@@ -763,7 +763,7 @@ public class ShardManager extends AbstractUntypedPersistentActorWithMetering {
     }
 
     private void memberExited(ClusterEvent.MemberExited message) {
-        String memberName = message.member().roles().head();
+        String memberName = message.member().roles().iterator().next();
 
         LOG.debug("{}: Received MemberExited: memberName: {}, address: {}", persistenceId(), memberName,
                 message.member().address());
@@ -776,7 +776,7 @@ public class ShardManager extends AbstractUntypedPersistentActorWithMetering {
     }
 
     private void memberUp(ClusterEvent.MemberUp message) {
-        String memberName = message.member().roles().head();
+        String memberName = message.member().roles().iterator().next();
 
         LOG.debug("{}: Received MemberUp: memberName: {}, address: {}", persistenceId(), memberName,
                 message.member().address());
@@ -799,7 +799,7 @@ public class ShardManager extends AbstractUntypedPersistentActorWithMetering {
     }
 
     private void memberReachable(ClusterEvent.ReachableMember message) {
-        String memberName = message.member().roles().head();
+        String memberName = message.member().roles().iterator().next();
         LOG.debug("Received ReachableMember: memberName {}, address: {}", memberName, message.member().address());
 
         addPeerAddress(memberName, message.member().address());
@@ -808,7 +808,7 @@ public class ShardManager extends AbstractUntypedPersistentActorWithMetering {
     }
 
     private void memberUnreachable(ClusterEvent.UnreachableMember message) {
-        String memberName = message.member().roles().head();
+        String memberName = message.member().roles().iterator().next();
         LOG.debug("Received UnreachableMember: memberName {}, address: {}", memberName, message.member().address());
 
         markMemberUnavailable(memberName);
index 4e45dc4..c2af9f9 100644 (file)
@@ -2001,22 +2001,22 @@ public class ShardManagerTest extends AbstractActorTest {
                 if(message instanceof FindPrimary) {
                     findPrimaryMessageReceived.countDown();
                 } else if(message instanceof ClusterEvent.MemberUp) {
-                    String role = ((ClusterEvent.MemberUp)message).member().roles().head();
+                    String role = ((ClusterEvent.MemberUp)message).member().roles().iterator().next();
                     if(!getCluster().getCurrentMemberName().equals(role)) {
                         memberUpReceived.countDown();
                     }
                 } else if(message instanceof ClusterEvent.MemberRemoved) {
-                    String role = ((ClusterEvent.MemberRemoved)message).member().roles().head();
+                    String role = ((ClusterEvent.MemberRemoved)message).member().roles().iterator().next();
                     if(!getCluster().getCurrentMemberName().equals(role)) {
                         memberRemovedReceived.countDown();
                     }
                 } else if(message instanceof ClusterEvent.UnreachableMember) {
-                    String role = ((ClusterEvent.UnreachableMember)message).member().roles().head();
+                    String role = ((ClusterEvent.UnreachableMember)message).member().roles().iterator().next();
                     if(!getCluster().getCurrentMemberName().equals(role)) {
                         memberUnreachableReceived.countDown();
                     }
                 } else if(message instanceof ClusterEvent.ReachableMember) {
-                    String role = ((ClusterEvent.ReachableMember)message).member().roles().head();
+                    String role = ((ClusterEvent.ReachableMember)message).member().roles().iterator().next();
                     if(!getCluster().getCurrentMemberName().equals(role)) {
                         memberReachableReceived.countDown();
                     }