Tuesday, January 25, 2011

scala generics and eclipse autocompletion

The Scala 2.8.1 compiler doesn't create correctly the generics signature in some cases

https://lampsvn.epfl.ch/trac/scala/ticket/4067

Eclipse 3.6 is very strict about the signatures and it's autocompletion feature throws an exception when you work on a java project using scala code:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=332423

The issue is being fixed in both projects, but in the meantime I needed to work in eclipse with the akka library, and this issue is annoying.

I wrote a small tool which tries to fix the scala classes. Currently I tested it only on scala-library.jar, which contained the "orElse" method whose signature affected my setup. I don't know if it fixes all the problems, but I tried it on my project and eclipse  doesn't complain.

For now I only tried to put that jar in the eclipse IDE classpath, while keeping the original scala-library.jar in the executable classpath.

You can get the code at:

https://github.com/mmikulicic/scala-fix-generics

5 comments:

  1. It's great that you've done this, but I have to complain anyway :-)
    1. What's with the current laziness of just providing source code? Compile the damn jar, man.
    2. What's with the dependencies? You couldn't do this without two external Guice libraries? That's just lazy.

    There, got that off my chest.

    ReplyDelete
  2. Hi anonymous,

    1. there is a precompiled jar in project's github downloads page. I didn't emphatize this in the text though...

    2. w.r.t guice: I was playing with guice, so it's natural that I wanted to learn something new and fix a problem at hand in the same shot.
    I prefer to evaluate by writing something concrete so I can see how it can handle things wthat I don't expect in advance.

    ReplyDelete