Just curious the following code (adapted from 
"http://doc.akka.io/docs/akka-stream-and-http-experimental/2.0.2/java/stream-graphs.html";)
 compile fails with
an Error: 
java: incompatible types: 
akka.stream.UniformFanOutShape<java.lang.Object,java.lang.Object> cannot be 
converted to akka.stream.UniformFanOutShape<java.lang.Integer,java.lang.Integer>

if I change 
final UniformFanOutShape<Integer, Integer> bcast = (UniformFanOutShape<Integer, 
Integer>)builder.add(Broadcast.create(2));
to 
final UniformFanOutShape<Integer, Integer> bcast = 
builder.add(Broadcast.create(2));

everything works.

Can Anybody explain to me what's the reason?


import akka.stream.ClosedShape;

import akka.stream.UniformFanOutShape;
import akka.stream.javadsl.*;
import scala.concurrent.Future;
import java.util.List;

public class Main {

   public static void main(String[] args) {
      final Sink<List<String>, Future<List<String>>> sink = Sink.head();


      final RunnableGraph<Future<List<String>>> result =
            RunnableGraph.<Future<List<String>>>fromGraph(
                  GraphDSL
                        .create(
                              sink,
                              (builder, out) -> {
                                 final UniformFanOutShape<Integer, Integer> 
bcast = (UniformFanOutShape<Integer, Integer>)builder.add(Broadcast.create(2));
                                 return ClosedShape.getInstance();
                              }));
      
   }
}

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to