I am grappling with this codebase called JPF that is unfortunately developed in Java. I would like to get JPF to analyse my Scala stuff. Apparently, I am missing something basic in plugging Scala code into Java codebase. That I say because JPF fails to find the class files of my Scala.Can anyone help on that please?
I have even copied RC2.class and RC2$.class to my src/classes and build/main. But, I still get the same error message, which indicates JPF not being able to locate files.
What requirements does JPF have for ‘application classes’? If JPF needs
to instantiate those classes, it will probably have some expectations
about the accessibility and signatures of their constructors, for
example, which a Scala object is unlikely to meet. (Those are just some
ideas, I have no idea what JPF is.) Could RC2 be a class instead of an
object?
PS: Maybe it was just there for illustration, but the line
var data: Int = ???
will cause an exception to be thrown from RC2’s constructor.
I don’t know all their requirements, in fact. More to the point is that I don’t know how to find that out. I haven’t been able to find a clear list in their documentations. Neither is the JPF mailing list active/informative.
Well, the thing is that JPF’s entry point has to be a Java main method. So, I also tried:
class MyRCTest3 extends App {
var data: Int = 0
setData( 42)
setData(-42)
def setData(d: Int) {data = d}
def getInstance() = new MyRCTest3
}
[SEVERE] cannot load application class scala.reflect.ScalaSignature
I javap’ed my MyRCTest3.class and there is no mention of scala.reflect.ScalaSignature. I wonder where JPF gets that from… Anyway, maybe I should ask how do I find scala.reflect.ScalaSignature on my machine?
scala.reflect.ScalaSignature is located in the scala-library-*.jar, * being whatever Scala version you’re using.
I think it’s an annotation that the compiler applies to the classes it generates to preserve some extra information that the compiler and possibly runtime reflection needs later on.
I am just guessing here, but possibly native_classpath is where it looks for native libraries (meaning dll, so, …)? What about the normal classpath variable? If that doesn’t work, possibly (still guessing) there is also a bootclasspath?
The problem is that I don’t know the syntax for more than one classpath item.
And, I get the same error message with both bootclasspath and boot_classpath. Perhaps, JPF is simply ignoring its unknown keys. And, I don’t know where to find the list of key…
The most commonly used kind of jar file is the one that contains the
class files to satisfy dependencies. But there are also jar files that
instead provide source code or documentation. The word “source” in the name
of your jar file made me wonder whether you got one of those.
Didn’t work either. I’ll try to pick that specifically up with the JPF list.
But, one thing I’d like here is that, given that there is no mention of scala.reflect.ScalaSignature in my javap outputs, I wonder where that ended up getting in my code from. Any idea?