diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/compute/strategy/EC2ListNodesStrategy.java b/apis/ec2/src/main/java/org/jclouds/ec2/compute/strategy/EC2ListNodesStrategy.java index 88a65ec638..6e67abc3a5 100644 --- a/apis/ec2/src/main/java/org/jclouds/ec2/compute/strategy/EC2ListNodesStrategy.java +++ b/apis/ec2/src/main/java/org/jclouds/ec2/compute/strategy/EC2ListNodesStrategy.java @@ -96,12 +96,17 @@ public class EC2ListNodesStrategy implements ListNodesStrategy { @SuppressWarnings("unchecked") @Override public Future>> apply(String from) { - return (Future>>) client - .getInstanceServices().describeInstancesInRegion(from); + return castToSpecificTypedFuture(client.getInstanceServices().describeInstancesInRegion(from)); } }, executor, null, logger, "reservations"); return concat(concat(reservations)); } + + // "hide" this cast (i.e. do not perform inline) from the Java 7 compiler - see http://stackoverflow.com/questions/8637937/why-does-a-generic-cast-of-a-list-extends-set-to-listset-succeed-on-sun + @SuppressWarnings("unchecked") + private static Future castToSpecificTypedFuture(Future input) { + return (Future) input; + } }