I must have missed that, or misunderstood it. You have seen the
tickets and comments on this matter, I hope?
https://issues.scala-lang.org/browse/SI-3872
Where iulian says "There is no one 'right' lub after erasure,
unfortunately. This is one of the reasons we still don't have a jvm6
backend."
Also something to be aware of, in TypeKinds:
/** The compiler's lub calculation does not order classes before traits.
* This is apparently not wrong but it is inconvenient, and causes the
* icode checker to choke when things don't match up. My attempts to
* alter the calculation at the compiler level were failures, so in the
* interests of a working icode checker I'm making the adjustment here.
*
* Example where we'd like a different answer:
*
* abstract class Tom
* case object Bob extends Tom
* case object Harry extends Tom
* List(Bob, Harry) // compiler calculates "Product with Tom"
rather than "Tom with Product"
*
* Here we make the adjustment by rewinding to a pre-erasure state and
* sifting through the parents for a class type.
*/
> The problem I mentioned yesterday, obtaining "the" LUB given the internal
> names of JVM class files, can be solved taking into account that:
You have seen the tickets and comments on this matter, I hope?
--
Daniel C. Sobral
I travel to the future all the time.
--
I would suggest repackaging ASM to scala.tools.asm._ or similar.
JARJAR can perform the translation. This eliminates the possibility of
clashes with another version of ASM on the user's classpath, and the
practice is suggested in ASM's FAQ [1]
Admittedly this is only a concern if the users is programmatically
using the compiler, but this might become more common with the runtime
compiler toolbox offered in 2.10.
-jason
I would suggest to namespace it even if you use a public version. It
is too commonly used to force a particular version on anyone that
needs the compiler on the classpath. (I remember the pain this caused
users of Hibernate 3.x before they turned to JARJAR.)
-jason
Does jarjar auto namespace it?
What's the best means of accomplishing this?
2. java -jar jarjar.jar process rules.txt asm-orig.jar asm-scala.jar
3. Write your code against the new package name.
More info:
http://code.google.com/p/jarjar/w/list
-jason
Does jarjar auto namespace it?
What's the best means of accomplishing this?
On Apr 4, 2012 1:45 AM, "Jason Zaugg" wrote:
Can it not be added to lib/extra? I intended that specifically and
only for developer-local jars.
That's the backend at https://github.com/magarciaEPFL/scala/tree/GenASM2
The problem I mentioned yesterday, obtaining "the" LUB given the internal names of JVM class files, can be solved taking into account that:
Quoting from gallium.inria.fr/~xleroy/publi/bytecode-verification-JAR.pdf
--- start quote ---
The simplest solution to the [least upper bound of] interface problem is to be found in Sun’s implementation of the
JDK bytecode verifier. (This approach is documented nowhere, but can easily be inferred by
experimentation.) Namely, bytecode verification ignores interfaces, treating all interface types as
the class type Object. Thus, the type algebra used by the verifier contains only proper classes
and no interfaces, and subtyping between proper classes is simply the inheritance relation between
them. Since Java has single inheritance (a class can implement several interfaces, but inherit from
one class only), the subtyping relation is tree-shaped and trivially forms a semi-lattice: the least
upper bound of two classes is simply their closest common ancestor in the inheritance tree.
--- end quote ---
abstract class Tom
case object Bob extends Tom
case object Harry extends Tom
def moo(x: Tom) {} def moo2(x: Product) {} moo(if (c) new Bob else new Harry) moo2(if (c) new Bob else new Harry)