2

I have defined a list of subscribers

public class PropertyHandlerInfo<T> {
...
    public final List<ActorRef> subscribers = new ArrayList<>();
...
}

when I want to retrieve an element of list I get an Object type not a ActorRef.

PropertyHandlerInfo propertyHandlerInfo = new PropertyHandlerInfo();
...
ActorRef o = propertyHandlerInfo.subscribers.get(0);

I get the floowing error:

Error:(34, 61) java: incompatible types: java.lang.Object cannot be converted to akka.actor.ActorRef

What can be the problem?

UPDATE:

This question asks a practical problem, some people showed me a similar theoretical question:

What is a raw type and why shouldn't we use it?

I can extrapolate the answer to this question from that link.

The most helpful comment was for me: "Using a raw type erases ALL generics in that class." by Jorn Vernee

Dániel Kis
  • 2,341
  • 5
  • 28
  • 51

0 Answers0