On Mon, Nov 16, 2009 at 3:33 PM, Kris Nuttycombe
<kris.nuttyco...@gmail.com>wrote:

> Oops... I didn't realize I'd committed the pom with that in! I've no
> problem putting the extra warnings into a profile. Does Scala have an
> equivalent of or support the @SuppressWarnings annotation that you
> have in Java?
>

I'm not aware of any annotations that would suppress these warnings.

One solution to avoid the warnings would be to declare a class such as:

class UncheckedErasure[T](implicit m: scala.reflect.Manifest[T]) {
  def unapply(x: Any) = x match {
    case _ if m.erasure.isInstance(x) => Some(x.asInstanceOf[T])
    case _ => None
  }
}

and everytime we  have an unchecked match, we could write, e.g.,

object uncheckedMap extends UncheckedErasure[Map[String, String]]

...

x match {
  case uncheckedMap(map) =>
    // do something with map
}

This gets us the same amount of compile-time and runtime type checking,
makes the unchecked matches stand out in code, remaining easily searchable,
at practically the same runtime cost.

alex

--

You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to lift...@googlegroups.com.
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=.


Reply via email to