Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Examples of Java frameworks which don't play well with Scala

Has anybody run across a Java/Java EE framework which causes problems if used with Scala?

like image 776
Nermin Serifovic Avatar asked May 10 '11 20:05

Nermin Serifovic


3 Answers

Don't know of a specific one, but any pre-Java 5 framework that uses raw types may cause trouble at some point in Scala, especially if you have a raw type in the hierarchy of a class you must implement. Here are a few questions related to this issue:

  • Implementing methods having raw types in Scala
  • Why does Scala complain about illegal inheritance when there are raw types in the class hierarchy?
  • Scala class cant override compare method from Java Interface which extends java.util.comparator
like image 79
Jean-Philippe Pellet Avatar answered Nov 13 '22 05:11

Jean-Philippe Pellet


The was a problem for a while with JSoup hitting a bug in Scala, making typical JSoup usage broken in Scala without writing a bit of extra Java. Interestingly, the JSoup developers altered JSoup to avoid this bug, so current versions integrate smoothly. I'm not sure if the Scala bug responsible is fixed yet.

like image 1
Sam Stainsby Avatar answered Nov 13 '22 05:11

Sam Stainsby


Commons-CLI won't work in Scala (at least, not if you use their OptionBuilder class). The reason is that the OptionBuilder uses static methods, and then has you call them via an instance. Javac will let you get away with that (it's at worst a warning), but scalac won't find the static methods. It looks for them on the instance, but they're not there. From scala's perspective, they'd be on the companion object, but that's not what you have.

like image 1
Ian McLaird Avatar answered Nov 13 '22 04:11

Ian McLaird