javakotlinorbit

Converting java to kotlin


I'm developing a Kotlin application with the orbit package, but I'm with some issues to define actors Unresolved reference: T

class HelloActor():AbstractActor<T>,Hello

What should be the T param? In docs: * @param <T> a class that represents the state of this actor.


Solution

  • I don't quite understand that actor framework, but base on detail you have given in comments, I think you should replace T with either Any.

    Your HelloActor should looks like this:

    class HelloActor(): AbstractActor<Any>,Hello
    

    In kotlin, Any is mapped to java.lang.Object, or AnyRef in scala, and they have the same functionality and purpose. Any may be used wherever Object or AnyRef is used. See more kotlin to Java class mapping here.

    EDIT: Actually kotlin is more similiar to Java, so you should follow the Java tutorial instead of scala ones.