-
Notifications
You must be signed in to change notification settings - Fork 2
/
README
69 lines (44 loc) · 1.51 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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.
Build
=====
Use "sbt package".
Run
===
You can instruct scalac to pick up your plugin using
-Xplugin:path/to/jar, or you can copy the plugin jar to
$SCALA_HOME/misc/scala-devel/plugins.
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
Use
===
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)
}
@noboxing
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.
Credits
=======
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)