A Scala compiler plugin that issues warnings when boxing occurs.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Noboxing Scala Compiler plugin

This compiler plugin issues warnings when the scalac compiler adds a
box or unbox operation in a @noboxing annotated definition. It
requires scala 2.9.2.


Use "sbt package".


You can instruct scalac to pick up your plugin using
-Xplugin:path/to/jar, or you can copy the plugin jar to

Alternatively, if you are using SBT, you can drop the jar
in your /lib directory, and add the following to your scalac
options, like so:

    scalacOptions := Seq(..., "-Xplugin:lib/noboxing_2.9.2-0.1-SNAPSHOT.jar")

From the project root, type

$ scalac -Xplugin:target/scala-2.9.2/noboxing_2.9.2-0.1-SNAPSHOT.jar -Xplugin-list

You should see:

noboxing - checks for boxing operations
continuations - applies selective cps conversion


In your source code, import ssol.tools.noboxing.noboxing and annotate
a class or definition.  For example:

import ssol.tools.noboxing.noboxing

class Test {
  def hello(x: String) {
    println("Hello, " + x)

  def arith(x: List[Int]) = x(0) + x(1)

Then run scalac with your plugin

$ scalac -Xplugin:target/scala_2.9.2/noboxing-plugin_2.9.2-0.1.jar -cp \
    target/scala_2.9.2/noboxing-plugin_2.9.2-0.1.jar test.scala

Don't forget to add the jar to your compilation classpath as well.


Written originally for Scala 2.8.0 by:

    Iulian Dragos (https://github.com/dragos)

updated to Scala 2.9.2 by:

    Adam Klein (https://github.com/adamklein)