Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Migrating Java to Scala

What are the most important points to be aware of, and the workarounds, when gradually migrating an existing Java codebase to Scala? With a (potentially very long) intermediate phase where both languages are in use.

The sort of things I'm thinking about are:

  • different collection hierarchies
  • Java constructs that Scala can't handle well
  • Scala constructs that are impractical to use in Java
  • build tools
  • compilation order
  • immutability support in frameworks
  • etc.
like image 716
Kevin Wright Avatar asked Oct 19 '10 11:10

Kevin Wright


1 Answers

Scala doesn't like:

  • inner Java classes
  • static methods and variables (especially in super classes)
  • raw types

Java doesn't like:

  • Scala objects traits
  • closures
  • actors (except Scarlett Johansson and Akka Actors since they have a Java API)
  • implicits, especially Manifests
  • advanced type constructs (higher kinded types, structural types, abstract type vars)
like image 86
Landei Avatar answered Oct 03 '22 18:10

Landei