Permalink
Browse files

Merge pull request #1292 from lift/diego_issue_1292

change all deprecated messages to be 2.9.x compatible
  • Loading branch information...
David Pollak
David Pollak committed Jul 20, 2012
2 parents 001d956 + c82e783 commit 517a9bc014421e593efe08ca7bae269557a85cbe
Showing with 125 additions and 154 deletions.
  1. +6 −12 core/common/src/main/scala/net/liftweb/common/Box.scala
  2. +1 −1 core/common/src/main/scala/net/liftweb/common/HList.scala
  3. +1 −1 core/common/src/main/scala/net/liftweb/common/ParseDouble.scala
  4. +4 −8 core/json/benchmark/Serbench.scala
  5. +3 −3 core/json/src/main/scala/net/liftweb/json/Formats.scala
  6. +1 −1 core/json/src/main/scala/net/liftweb/json/JsonAST.scala
  7. +1 −1 core/json/src/main/scala/net/liftweb/json/JsonParser.scala
  8. +1 −1 core/json/src/main/scala/net/liftweb/json/Meta.scala
  9. +6 −6 core/util/src/main/scala/net/liftweb/util/BindHelpers.scala
  10. +6 −3 core/util/src/main/scala/net/liftweb/util/ClassHelpers.scala
  11. +1 −1 core/util/src/main/scala/net/liftweb/util/StringHelpers.scala
  12. +1 −1 core/util/src/main/scala/net/liftweb/util/TimeHelpers.scala
  13. +1 −1 core/util/src/main/scala/net/liftweb/util/ValueHolder.scala
  14. +1 −1 core/util/src/main/scala/net/liftweb/util/package.scala
  15. +2 −2 persistence/db/src/main/scala/net/liftweb/db/DB.scala
  16. +2 −3 persistence/mapper/src/main/scala/net/liftweb/mapper/MappedField.scala
  17. +3 −3 persistence/mapper/src/main/scala/net/liftweb/mapper/MappedForeignKey.scala
  18. +1 −1 persistence/mapper/src/main/scala/net/liftweb/mapper/MappedString.scala
  19. +2 −2 persistence/mapper/src/main/scala/net/liftweb/mapper/MappedUniqueId.scala
  20. +1 −2 persistence/mapper/src/main/scala/net/liftweb/mapper/Mapper.scala
  21. +6 −6 persistence/mapper/src/main/scala/net/liftweb/mapper/ProtoUser.scala
  22. +1 −1 persistence/mapper/src/main/scala/net/liftweb/mapper/package.scala
  23. +1 −1 persistence/mongodb/src/main/scala/net/liftweb/mongodb/JObjectParser.scala
  24. +3 −3 persistence/mongodb/src/main/scala/net/liftweb/mongodb/Meta.scala
  25. +1 −1 persistence/mongodb/src/main/scala/net/liftweb/mongodb/Mongo.scala
  26. +6 −6 persistence/record/src/main/scala/net/liftweb/record/ProtoUser.scala
  27. +1 −1 persistence/record/src/main/scala/net/liftweb/record/RecordHelpers.scala
  28. +1 −1 persistence/squeryl-record/src/main/scala/net/liftweb/squerylrecord/SquerylRecord.scala
  29. +4 −4 web/testkit/src/main/scala/net/liftweb/mocks/MockHttpServletRequest.scala
  30. +1 −1 web/webkit/src/main/scala/net/liftweb/builtin/snippet/A.scala
  31. +1 −2 web/webkit/src/main/scala/net/liftweb/builtin/snippet/Msgs.scala
  32. +5 −7 web/webkit/src/main/scala/net/liftweb/http/CometActor.scala
  33. +1 −1 web/webkit/src/main/scala/net/liftweb/http/LiftResponse.scala
  34. +11 −11 web/webkit/src/main/scala/net/liftweb/http/LiftRules.scala
  35. +1 −1 web/webkit/src/main/scala/net/liftweb/http/LiftScreen.scala
  36. +1 −1 web/webkit/src/main/scala/net/liftweb/http/LiftSession.scala
  37. +2 −2 web/webkit/src/main/scala/net/liftweb/http/Paginator.scala
  38. +3 −6 web/webkit/src/main/scala/net/liftweb/http/Req.scala
  39. +1 −8 web/webkit/src/main/scala/net/liftweb/http/RequestType.scala
  40. +16 −22 web/webkit/src/main/scala/net/liftweb/http/S.scala
  41. +2 −2 web/webkit/src/main/scala/net/liftweb/http/SHtml.scala
  42. +2 −2 web/webkit/src/main/scala/net/liftweb/http/Templates.scala
  43. +1 −1 web/webkit/src/main/scala/net/liftweb/http/jquery/JqSHtml.scala
  44. +2 −2 web/webkit/src/main/scala/net/liftweb/http/js/JsCommands.scala
  45. +3 −3 web/webkit/src/main/scala/net/liftweb/http/js/jquery/JqJsCmds.scala
  46. +1 −1 web/webkit/src/main/scala/net/liftweb/http/package.scala
  47. +1 −1 web/webkit/src/main/scala/net/liftweb/http/provider/servlet/HTTPResponseServlet.scala
  48. +0 −1 web/webkit/src/main/scala/net/liftweb/http/provider/servlet/HTTPServletSession.scala
  49. +1 −1 web/webkit/src/main/scala/net/liftweb/http/rest/RestContinuation.scala
@@ -106,7 +106,7 @@ sealed trait BoxTrait {
*
* @return <code>Full(in)</code> if <code>in</code> is not null; Empty otherwise
*/
- @deprecated("Use legacyNullTest")
+ @deprecated("Use legacyNullTest", "2.5")
def apply[T](in: T): Box[T] = legacyNullTest(in)
/**
@@ -192,8 +192,7 @@ sealed trait BoxTrait {
* <li> you can "pass" a Box to a function for side effects: <code>Full(1) $ { x: Box[Int] => println(x openOr 0) }</code></li>
* </ul>
*/
-@serializable
-sealed abstract class Box[+A] extends Product {
+sealed abstract class Box[+A] extends Product with Serializable{
self =>
/**
* Returns true if this Box contains no value (is Empty or Failure or ParamFailure)
@@ -472,8 +471,7 @@ sealed abstract class Box[+A] extends Product {
/**
* Full is a Box containing a value.
*/
-@serializable
-final case class Full[+A](value: A) extends Box[A] {
+final case class Full[+A](value: A) extends Box[A]{
def isEmpty: Boolean = false
@@ -551,14 +549,12 @@ final case class Full[+A](value: A) extends Box[A] {
/**
* Singleton object representing an Empty Box
*/
-@serializable
case object Empty extends EmptyBox
/**
* The EmptyBox is a Box containing no value.
*/
-@serializable
-sealed abstract class EmptyBox extends Box[Nothing] {
+sealed abstract class EmptyBox extends Box[Nothing] with Serializable {
def isEmpty: Boolean = true
@@ -600,8 +596,7 @@ object Failure {
* A Failure is an EmptyBox with an additional failure message explaining the reason for its being empty.
* It can also optionally provide an exception or a chain of causes represented as a list of other Failure objects
*/
-@serializable
-sealed case class Failure(msg: String, exception: Box[Throwable], chain: Box[Failure]) extends EmptyBox {
+sealed case class Failure(msg: String, exception: Box[Throwable], chain: Box[Failure]) extends EmptyBox{
type A = Nothing
/**
@@ -683,11 +678,10 @@ sealed case class Failure(msg: String, exception: Box[Throwable], chain: Box[Fai
* A ParamFailure is a Failure with an additional typesafe parameter that can
* allow an application to store other information related to the failure.
*/
-@serializable
final class ParamFailure[T](override val msg: String,
override val exception: Box[Throwable],
override val chain: Box[Failure], val param: T) extends
- Failure(msg, exception, chain) {
+ Failure(msg, exception, chain) with Serializable{
override def toString(): String = "ParamFailure("+msg+", "+exception+
", "+chain+", "+param+")"
@@ -101,7 +101,7 @@ sealed trait ExcludeThisType[A, B]
* that a type is not a subtype of another type
*/
object ExcludeThisType {
- def unexpected: Nothing = error("Unexpected invocation")
+ def unexpected: Nothing = sys.error("Unexpected invocation")
// Uses ambiguity to rule out the cases we're trying to exclude
implicit def nsub[A, B]: A ExcludeThisType B = null
@@ -27,7 +27,7 @@ package common
*
* @see http://blogs.oracle.com/security/entry/security_alert_for_cve-2010-44
*/
-@deprecated("Use a newer or patched JVM instead.")
+@deprecated("Use a newer or patched JVM instead.", "2.5")
object ParseDouble {
private val BrokenDouble = BigDecimal("2.2250738585072012e-308")
@@ -41,12 +41,8 @@ object Serbench extends Benchmark {
}
}
- @serializable
- case class Project(name: String, startDate: Date, lang: Option[Language], teams: List[Team])
- @serializable
- case class Language(name: String, version: Double)
- @serializable
- case class Team(role: String, members: List[Employee])
- @serializable
- case class Employee(name: String, experience: Int)
+ case class Project(name: String, startDate: Date, lang: Option[Language], teams: List[Team]) extends Serializable
+ case class Language(name: String, version: Double) extends Serializable
+ case class Team(role: String, members: List[Employee]) extends Serializable
+ case class Employee(name: String, experience: Int) extends Serializable
}
@@ -166,7 +166,7 @@ trait TypeHints {
* Chooses most specific class.
*/
def hintFor(clazz: Class[_]): String = components.filter(_.containsHint_?(clazz))
- .map(th => (th.hintFor(clazz), th.classFor(th.hintFor(clazz)).getOrElse(error("hintFor/classFor not invertible for " + th))))
+ .map(th => (th.hintFor(clazz), th.classFor(th.hintFor(clazz)).getOrElse(sys.error("hintFor/classFor not invertible for " + th))))
.sort((x, y) => (delta(x._2, clazz) - delta(y._2, clazz)) < 0).head._1
def classFor(hint: String): Option[Class[_]] = {
@@ -197,15 +197,15 @@ private[json] object ClassDelta {
else if (class2.isAssignableFrom(class1)) {
1 + delta(class1.getSuperclass, class2)
}
- else error("Don't call delta unless one class is assignable from the other")
+ else sys.error("Don't call delta unless one class is assignable from the other")
}
}
/** Do not use any type hints.
*/
case object NoTypeHints extends TypeHints {
val hints = Nil
- def hintFor(clazz: Class[_]) = error("NoTypeHints does not provide any type hints.")
+ def hintFor(clazz: Class[_]) = sys.error("NoTypeHints does not provide any type hints.")
def classFor(hint: String) = None
}
@@ -396,7 +396,7 @@ object JsonAST {
case JDouble(n) => text(n.toString)
case JInt(n) => text(n.toString)
case JNull => text("null")
- case JNothing => error("can't render 'nothing'")
+ case JNothing => sys.error("can't render 'nothing'")
case JString(null) => text("null")
case JString(s) => text("\"" + quote(s) + "\"")
case JArray(arr) => text("[") :: series(trimArr(arr).map(render)) :: text("]")
@@ -134,7 +134,7 @@ object JsonParser {
private val BrokenDouble = BigDecimal("2.2250738585072012e-308")
private[json] def parseDouble(s: String) = {
val d = BigDecimal(s)
- if (d == BrokenDouble) error("Error parsing 2.2250738585072012e-308")
+ if (d == BrokenDouble) sys.error("Error parsing 2.2250738585072012e-308")
else d.doubleValue
}
@@ -394,7 +394,7 @@ private[json] object Meta {
case x: java.lang.Short => JInt(BigInt(x.asInstanceOf[Short]))
case x: Date => JString(formats.dateFormat.format(x))
case x: Symbol => JString(x.name)
- case _ => error("not a primitive " + a.asInstanceOf[AnyRef].getClass)
+ case _ => sys.error("not a primitive " + a.asInstanceOf[AnyRef].getClass)
}
}
}
@@ -708,7 +708,7 @@ trait BindHelpers {
/**
* transforms a Box into a Text node
*/
- @deprecated("use -> instead")
+ @deprecated("use -> instead", "2.4")
object BindParamAssoc {
implicit def canStrBoxNodeSeq(in: Box[Any]): Box[NodeSeq] = in.map(_ match {
case null => Text("null")
@@ -789,7 +789,7 @@ trait BindHelpers {
*
* @deprecated use -> instead
*/
- @deprecated("use -> instead")
+ @deprecated("use -> instead", "2.4")
class BindParamAssoc(val name: String) {
def -->(value: String): BindParam = TheBindParam(name, if (null eq value) NodeSeq.Empty else Text(value))
def -->(value: NodeSeq): BindParam = TheBindParam(name, value)
@@ -812,7 +812,7 @@ trait BindHelpers {
*
* @deprecated use -> instead
*/
- @deprecated("use -> instead")
+ @deprecated("use -> instead", "2.4")
implicit def strToBPAssoc(in: String): BindParamAssoc = new BindParamAssoc(in)
/**
@@ -822,7 +822,7 @@ trait BindHelpers {
*
* @deprecated use -> instead
*/
- @deprecated("use -> instead")
+ @deprecated("use -> instead", "2.4")
implicit def symToSAAssoc(in: Symbol): SuperArrowAssoc = new SuperArrowAssoc(in.name)
/**
@@ -831,7 +831,7 @@ trait BindHelpers {
*
* @deprecated use bind instead
*/
- @deprecated("use bind instead")
+ @deprecated("use bind instead", "2.4")
def xbind(namespace: String, xml: NodeSeq)(transform: PartialFunction[String, NodeSeq => NodeSeq]): NodeSeq = {
def rec_xbind(xml: NodeSeq): NodeSeq = {
xml.flatMap {
@@ -1133,7 +1133,7 @@ trait BindHelpers {
* @param atWhat data to bind
* @deprecated use the bind function instead
*/
- @deprecated("use the bind function instead")
+ @deprecated("use the bind function instead", "2.3")
def processBind(around: NodeSeq, atWhat: Map[String, NodeSeq]): NodeSeq = {
/** Find element matched predicate f(x).isDefined, and return f(x) if found or None otherwise. */
@@ -151,9 +151,12 @@ trait ClassHelpers { self: ControlHelpers =>
def findClass(where: List[(String, List[String])]): Box[Class[AnyRef]] =
findType[AnyRef](where)
- @deprecated("Use StringHelpers.camelify") def camelCase(name : String): String = StringHelpers.camelify(name)
- @deprecated("Use StringHelpers.camelifyMethod") def camelCaseMethod(name: String): String = StringHelpers.camelifyMethod(name)
- @deprecated("Use StringHelpers.snakify") def unCamelCase(name : String) = StringHelpers.snakify(name)
+ @deprecated("Use StringHelpers.camelify", "2.3")
+ def camelCase(name : String): String = StringHelpers.camelify(name)
+ @deprecated("Use StringHelpers.camelifyMethod", "2.3")
+ def camelCaseMethod(name: String): String = StringHelpers.camelifyMethod(name)
+ @deprecated("Use StringHelpers.snakify", "2.3")
+ def unCamelCase(name : String) = StringHelpers.snakify(name)
/**
* @return true if the method is public and has no parameters
@@ -364,7 +364,7 @@ trait StringHelpers {
/** @return a SuperString with more available methods such as roboSplit or commafy */
implicit def listStringToSuper(in: List[String]): SuperListString = new SuperListString(in)
- @deprecated("Use blankForNull instead")
+ @deprecated("Use blankForNull instead", "2.3")
def emptyForNull(s: String) = blankForNull(s)
/**
@@ -295,9 +295,9 @@ trait TimeHelpers { self: ControlHelpers =>
def currentYear: Int = Calendar.getInstance.get(Calendar.YEAR)
/**
- * @deprecated use now instead
* @return the current time as a Date object
*/
+ @deprecated("use now instead", "2.4")
def timeNow = new Date
/**
@@ -25,7 +25,7 @@ trait ValueHolder {
*
* @deprecated
*/
- @deprecated("Use get")
+ @deprecated("Use get", "2.4")
def is: ValueType
/**
@@ -26,6 +26,6 @@ package object util {
/**
* Changed the name ActorPing to Schedule
*/
- @deprecated("Use Schedule")
+ @deprecated("Use Schedule", "2.3")
val ActorPing = Schedule
}
@@ -147,7 +147,7 @@ trait DB extends Loggable {
* perform this function after transaction has ended. This is helpful for sending messages to Actors after we know
* a transaction has been either committed or rolled back
*/
- @deprecated("Use appendPostTransaction {committed => ...}")
+ @deprecated("Use appendPostTransaction {committed => ...}", "2.4")
def performPostCommit(f: => Unit) {
postCommit = (() => f) :: postCommit
}
@@ -328,7 +328,7 @@ trait DB extends Loggable {
/**
* Append a function to be invoked after the transaction has ended for the given connection identifier
*/
- @deprecated("Use appendPostTransaction (name, {committed => ...})")
+ @deprecated("Use appendPostTransaction (name, {committed => ...})", "2.4")
def appendPostFunc(name: ConnectionIdentifier, func: () => Unit) {
appendPostTransaction(name, dontUse => func())
}
@@ -66,8 +66,7 @@ trait MixableMappedField extends BaseField {
* The base (not Typed) trait that defines a field that is mapped to a column or more than 1 column
* (e.g., MappedPassword) in the database
*/
-@serializable
-trait BaseMappedField extends SelectableField with Bindable with MixableMappedField {
+trait BaseMappedField extends SelectableField with Bindable with MixableMappedField with Serializable{
def dbDisplay_? = true
@@ -695,7 +694,7 @@ trait MappedField[FieldType <: Any,OwnerType <: Mapper[OwnerType]] extends Typed
}
object MappedField {
- @deprecated("Automatic conversion to the field's type is not safe and will be removed. Please use field.get instead")
+ @deprecated("Automatic conversion to the field's type is not safe and will be removed. Please use field.get instead", "2.5")
implicit def mapToType[T, A<:Mapper[A]](in : MappedField[T, A]): T = in.is
}
@@ -210,12 +210,12 @@ with LifecycleCallbacks {
}
-@deprecated("Functionality folded into MappedForeignKey, so just use MappedLongForeignKey. Will be removed in 2.5")
+@deprecated("Functionality folded into MappedForeignKey, so just use MappedLongForeignKey. Will be removed in 2.5", "2.4")
class LongMappedMapper[T<:Mapper[T], O<:KeyedMapper[Long,O]](theOwner: T, foreign: => KeyedMetaMapper[Long, O])
extends MappedLongForeignKey[T,O](theOwner, foreign)
-@deprecated("Functionality folded into MappedForeignKey, so just use MappedLongForeignKey. Will be removed in 2.5")
+@deprecated("Functionality folded into MappedForeignKey, so just use MappedLongForeignKey. Will be removed in 2.5", "2.4")
trait LongMappedForeignMapper[T<:Mapper[T],O<:KeyedMapper[Long,O]]
extends MappedLongForeignKey[T,O]
@@ -226,7 +226,7 @@ extends MappedLong[T](theOwner) with MappedForeignKey[Long,T,O] with BaseForeign
def foreignMeta = _foreignMeta
- @deprecated("Use 'box' instead")
+ @deprecated("Use 'box' instead", "2.4")
def can: Box[Long] = if (defined_?) Full(is) else Empty
def box: Box[Long] = if (defined_?) Full(is) else Empty
@@ -52,7 +52,7 @@ trait ValidateLength extends MixableMappedField {
}
trait HasApplyBoxString[T] {
- @deprecated("Just use apply(x openOr null). Will be removed in 2.5.")
+ @deprecated("Just use apply(x openOr null). Will be removed in 2.5.", "2.4")
def apply(ov: Box[String])(implicit disambiguateFromApplyBoxedForeign: BoxedStringToken): T = apply(ov openOr null)
def apply(x: String): T
}
@@ -35,10 +35,10 @@ abstract class MappedUniqueId[T<:Mapper[T]](override val fieldOwner: T, override
* A field that holds the birth year for the user
*/
abstract class MappedBirthYear[T <: Mapper[T]](owner: T, minAge: Int) extends MappedInt[T](owner) {
- override def defaultValue = year(timeNow) - minAge
+ override def defaultValue = year(now) - minAge
override def _toForm: Box[NodeSeq] = {
- val end = (year(timeNow) - minAge)
+ val end = (year(now) - minAge)
val start = end - 100
Full(SHtml.selectObj((start to end).
toList.
@@ -32,8 +32,7 @@ trait BaseMapper extends FieldContainer {
def save: Boolean
}
-@serializable
-trait Mapper[A<:Mapper[A]] extends BaseMapper {
+trait Mapper[A<:Mapper[A]] extends BaseMapper with Serializable{
self: A =>
type MapperType = A
Oops, something went wrong.

0 comments on commit 517a9bc

Please sign in to comment.