Closed scabug closed 10 years ago
Imported From: https://issues.scala-lang.org/browse/SI-8243?orig=1 Reporter: Quinton Anderson (quintona) Attachments:
@retronym said:
I believe that the bytecode of class "com.aldebaran.proxy.Variant" declares that is has an inner class Variant$typeV
. The Scala classpath implementation expects to be able to find that on the classpath.
Can you post the output of the following:
% jar -tf jnaoqi-1.14.5.jar | grep Variant
% javap -verbose -classpath jnaoqi-1.14.5.jar com.aldebaran.proxy.Variant
It is possible that scalac is less tolerant of the missing class than javac.
@retronym said: Marking as incomplete pending more details.
Quinton Anderson (quintona) said: Hi,
Thanks for the quick response. Here are the brief outputs, the class details are in a text attachment:
javap -verbose -classpath jnaoqi-1.14.5.jar com.aldebaran.proxy.Variant > variantDetails.txt l10001281:lib quintonanderson$ jar -tf jnaoqi-1.14.5.jar | grep Variant com/aldebaran/proxy/Variant.class
Quinton Anderson (quintona) said: Output from javap -verbose -classpath jnaoqi-1.14.5.jar com.aldebaran.proxy.Variant
Quinton Anderson (quintona) said: Added the required details. Thanks again.
@retronym said (edited on Feb 7, 2014 8:03:32 AM UTC): Yep, its as I suspected:
public class com.aldebaran.proxy.Variant
SourceFile: "Variant.java"
InnerClasses:
public static final #44= #43 of #31; //typeV=class com/aldebaran/proxy/Variant$typeV of class com/aldebaran/proxy/Variant
minor version: 0
Not sure why Variant$typeV is missing from that JAR. I've googled around for similar problems with SWIG, but nothing obvious appears. Maybe you could check on a SWIG mailing list?
How does this work with javac? As a workaround, you could create a Java wrapper class manually for Variant, and refer to that from Scala. So long as scalac never needs to load Variant.class, you will be able to compile.
I'll leave this open pending a report of how javac works. Maybe we can demote the error to a warning.
Quinton Anderson (quintona) said: Thanks for the help. I am also not sure why the inner class was missing, I have managed to rebuild the Swig layer and now have a working jar.
I think you should leave it as an error, it was valid. Thanks.
During a scala REPL session, I get a compiler error:
scala> memoryProxy.insertData("answer", 42) error: while compiling:
during phase: typer
library version: version 2.10.3
compiler version: version 2.10.3
reconstructed args: -classpath lib/jnaoqi-1.14.5.jar:.
last tree to typer: Ident(memoryProxy) symbol: (flags: )
symbol definition:
symbol owners:
context owners: value res10 -> object $iw -> object $iw -> object $iw -> object $iw -> object $read -> package $line31
== Enclosing template or block ==
Template( // val <local $iw>:
"java.lang.Object" // parents
ValDef(
private
"_"