I'm trying to do something like this in scala:
class SessionObject {
def setParameter(parameterOne : String): Unit = {
//Doing some stuff
}
def getResult(javaListParameter: java.util.List[String]): JsonObject = {
//doing some stuff
}
}
Once I compile the scala code I'm trying to use it in Java as a library. Something like this:
SessionObject object = new SessionObject();
object.setParameter("Something");
List<String> theList = new ArrayList<String>();
object.getResult(theList);
However, I'm not able to see/access the "getResult" method in Java. Is this a scala limitation or I'm missing something?
Thanks!
EDIT:
I tried this solution, however doesn't seem to work. Any method that uses java.util.List as a parameter or as a result cannot be used in java code.
Forgot to mention the compiler info. I'm using the maven-scala-plugin version 2.15.2 with scala version 2.10.3
EDIT:
Ok, as wingedsubmariner suggested, I ignored the IDE pre-compiling hints and compiled anyway. Now I'm getting this:
method com.*.*.*.*.SessionObject.getResult(java.lang.String,scala.collection.immutable.List<java.lang.String>,java.lang.String,scala.collection.immutable.List<java.lang.String>) is not applicable
(actual argument java.util.List<java.lang.String> cannot be converted to scala.collection.immutable.List<java.lang.String> by method invocation conversion)
method com.*.*.*.*.SessionObject.getResult(java.lang.String,java.util.ArrayList<java.lang.String>,java.lang.String,java.util.ArrayList<java.lang.String>) is not applicable
(actual argument java.util.List<java.lang.String> cannot be converted to java.util.ArrayList<java.lang.String> by method invocation conversion)
This seems to tell me that somehow the java.util.List parameter definition is being ignored.