summaryrefslogtreecommitdiff
path: root/src/library/scala/annotation/elidable.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-01-12 19:32:10 +0000
committerPaul Phillips <paulp@improving.org>2011-01-12 19:32:10 +0000
commitb4ba25da7ea3ed8f7f6ab23af241f025d4e9ea27 (patch)
tree207c19eafeba624a0d706aedccd05461585dd0d3 /src/library/scala/annotation/elidable.scala
parent236f61c04c9bd3f4bb8651c0bd2fe1ac8c663095 (diff)
downloadscala-b4ba25da7ea3ed8f7f6ab23af241f025d4e9ea27.tar.gz
scala-b4ba25da7ea3ed8f7f6ab23af241f025d4e9ea27.tar.bz2
scala-b4ba25da7ea3ed8f7f6ab23af241f025d4e9ea27.zip
Some modifications to @elidable: for reasons lo...
Some modifications to @elidable: for reasons lost to me now it had a default value such that annotated methods might be elided even if the option wasn't given. It now does nothing in that situation. Closes #4051, #4151, no review.
Diffstat (limited to 'src/library/scala/annotation/elidable.scala')
-rw-r--r--src/library/scala/annotation/elidable.scala39
1 files changed, 27 insertions, 12 deletions
diff --git a/src/library/scala/annotation/elidable.scala b/src/library/scala/annotation/elidable.scala
index 1767e044fe..ef8c20b43b 100644
--- a/src/library/scala/annotation/elidable.scala
+++ b/src/library/scala/annotation/elidable.scala
@@ -39,22 +39,34 @@ final class elidable(final val level: Int) extends annotation.StaticAnnotation {
* @since 2.8
*/
object elidable {
- final val ALL = Int.MinValue // Level.ALL.intValue()
- final val FINEST = 300 // Level.FINEST.intValue()
- final val FINER = 400 // Level.FINER.intValue()
- final val FINE = 500 // Level.FINE.intValue()
- final val CONFIG = 700 // Level.CONFIG.intValue()
- final val INFO = 800 // Level.INFO.intValue()
- final val WARNING = 900 // Level.WARNING.intValue()
- final val SEVERE = 1000 // Level.SEVERE.intValue()
- final val OFF = Int.MaxValue // Level.OFF.intValue()
+ /** The levels ALLĀ and OFF are confusing in this context because the
+ * sentiment being expressed when using the annotation is at cross purposes
+ * with the one being expressed via -Xelide-below. This confusion reaches
+ * its zenith at level OFF, where the annotation means "never elide this method"
+ * but -Xelide-below OFF is how you would say "elide everything possible."
+ *
+ * With no simple remedy at hand, the issue is now at least documented,
+ * and aliases MAXIMUM and MINIMUM are offered.
+ */
+ final val ALL = Int.MinValue // Level.ALL.intValue()
+ final val FINEST = 300 // Level.FINEST.intValue()
+ final val FINER = 400 // Level.FINER.intValue()
+ final val FINE = 500 // Level.FINE.intValue()
+ final val CONFIG = 700 // Level.CONFIG.intValue()
+ final val INFO = 800 // Level.INFO.intValue()
+ final val WARNING = 900 // Level.WARNING.intValue()
+ final val SEVERE = 1000 // Level.SEVERE.intValue()
+ final val OFF = Int.MaxValue // Level.OFF.intValue()
- // and since we had to do that anyway, we can add a few of our own
+ // a couple aliases for the confusing ALL and OFF
+ final val MAXIMUM = OFF
+ final val MINIMUM = ALL
+
+ // and we can add a few of our own
final val ASSERTION = 2000 // we should make this more granular
// for command line parsing so we can use names or ints
val byName: Map[String, Int] = Map(
- "ALL" -> ALL,
"FINEST" -> FINEST,
"FINER" -> FINER,
"FINE" -> FINE,
@@ -62,7 +74,10 @@ object elidable {
"INFO" -> INFO,
"WARNING" -> WARNING,
"SEVERE" -> SEVERE,
+ "ASSERTION" -> ASSERTION,
+ "ALL" -> ALL,
"OFF" -> OFF,
- "ASSERTION" -> ASSERTION
+ "MAXIMUM" -> MAXIMUM,
+ "MINIMUM" -> MINIMUM
)
}