Skip to content
Browse files

Worked on some deprecation warnings

  • Loading branch information...
1 parent dbce425 commit 04a87a12112a4ae4c36b5abd693467debc9bea31 @dpp dpp committed Feb 14, 2011
View
12 core/common/src/main/scala/net/liftweb/common/Box.scala
@@ -1,5 +1,5 @@
/*
- * Copyright 2007-2010 WorldWide Conferencing, LLC
+ * Copyright 2007-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package net.liftweb {
-package common {
+package net.liftweb
+package common
-import _root_.scala.reflect.Manifest
+import scala.reflect.Manifest
/**
* The Box companion object provides methods to create a Box from:
@@ -431,7 +431,7 @@ final case class Full[+A](value: A) extends Box[A] {
override def flatMap[B](f: A => Box[B]): Box[B] = f(value)
- override def elements: Iterator[A] = Iterator.fromValues(value)
+ override def elements: Iterator[A] = Iterator(value)
override def toList: List[A] = List(value)
@@ -627,6 +627,4 @@ object ParamFailure {
}
}
-}
-}
// vim: set ts=2 sw=2 et:
View
2 core/json/src/main/scala/net/liftweb/json/Formats.scala
@@ -131,7 +131,7 @@ trait TypeHints {
*/
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))))
- .sort((x, y) => delta(x._2, clazz) - delta(y._2, clazz) < 0).head._1
+ .sortWith((x, y) => delta(x._2, clazz) - delta(y._2, clazz) < 0).head._1
def classFor(hint: String): Option[Class[_]] = hints find (hintFor(_) == hint)
View
2 core/util/src/main/scala/net/liftweb/util/BaseField.scala
@@ -139,7 +139,7 @@ trait StringValidators {
def crop(in: ValueType): ValueType =
boxStrToValType(valueTypeToBoxString(in).map{
case null => null
- case s => s.substring(0, Math.min(s.length, maxLen))
+ case s => s.substring(0, math.min(s.length, maxLen))
})
def removeRegExChars(regEx: String)(in: ValueType): ValueType=
View
29 core/util/src/main/scala/net/liftweb/util/BindHelpers.scala
@@ -725,6 +725,7 @@ trait BindHelpers {
/**
* transforms a Box into a Text node
*/
+ @deprecated("use -> instead")
object BindParamAssoc {
implicit def canStrBoxNodeSeq(in: Box[Any]): Box[NodeSeq] = in.map(_ match {
case null => Text("null")
@@ -802,7 +803,7 @@ trait BindHelpers {
*
* @deprecated use -> instead
*/
- @deprecated
+ @deprecated("use -> instead")
class BindParamAssoc(val name: String) {
def -->(value: String): BindParam = TheBindParam(name, Text(value))
def -->(value: NodeSeq): BindParam = TheBindParam(name, value)
@@ -819,7 +820,7 @@ trait BindHelpers {
*
* @deprecated use -> instead
*/
- @deprecated
+ @deprecated("use -> instead")
implicit def strToBPAssoc(in: String): BindParamAssoc = new BindParamAssoc(in)
/**
@@ -829,7 +830,7 @@ trait BindHelpers {
*
* @deprecated use -> instead
*/
- @deprecated
+ @deprecated("use -> instead")
implicit def symToBPAssoc(in: Symbol): BindParamAssoc = new BindParamAssoc(in.name)
/**
@@ -838,7 +839,7 @@ trait BindHelpers {
*
* @deprecated use bind instead
*/
- @deprecated
+ @deprecated("use bind instead")
def xbind(namespace: String, xml: NodeSeq)(transform: PartialFunction[String, NodeSeq => NodeSeq]): NodeSeq = {
def rec_xbind(xml: NodeSeq): NodeSeq = {
xml.flatMap {
@@ -1025,7 +1026,7 @@ trait BindHelpers {
case _ => false
}
- bound.elements.toList match {
+ bound.iterator.toList match {
case xs :: _ => Some(e -> xs.value.text)
case _ => None
}
@@ -1140,12 +1141,12 @@ trait BindHelpers {
* @param atWhat data to bind
* @deprecated use the bind function instead
*/
- @deprecated
+ @deprecated("use the bind function instead")
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. */
def findMap[A, B](s: Iterable[A])(f: A => Option[B]): Option[B] =
- s.projection.map(f).find(_.isDefined).getOrElse(None)
+ s.view.map(f).find(_.isDefined).getOrElse(None)
around.flatMap {
v =>
@@ -1182,11 +1183,11 @@ trait BindHelpers {
* to Some
*/
def findOption[T](nodes: Seq[Node])(f: Elem => Option[T]): Option[T] = {
- nodes.projection.flatMap {
+ nodes.view.flatMap {
case Group(g) => findOption(g)(f)
case e: Elem => f(e) orElse findOption(e.child)(f)
case _ => None
- }.firstOption
+ }.headOption
}
/**
@@ -1203,11 +1204,11 @@ trait BindHelpers {
* to Full
*/
def findBox[T](nodes: Seq[Node])(f: Elem => Box[T]): Box[T] = {
- nodes.projection.flatMap {
+ nodes.view.flatMap {
case Group(g) => findBox(g)(f)
case e: Elem => f(e) or findBox(e.child)(f)
case _ => Empty
- }.firstOption
+ }.headOption
}
@@ -1830,7 +1831,7 @@ private class SelectorMap(binds: List[CssBind]) extends Function1[NodeSeq, NodeS
// get into an issue where we're trying to apply the whole
// transform to the whole shooting match
private def sortBinds(lst: List[CssBind]): List[CssBind] = {
- lst.sort {
+ lst.sortWith {
case (SubNode(me: EmptyBox), SubNode(_)) => true
case (SubNode(_), SubNode(them: EmptyBox)) => false
case (SubNode(Full(KidsSubNode())), SubNode(_)) => false
@@ -2005,7 +2006,7 @@ private class SelectorMap(binds: List[CssBind]) extends Function1[NodeSeq, NodeS
case 0 => NodeSeq.Empty
case 1 => new Elem(realE.prefix, realE.label,
realE.attributes, realE.scope,
- todo.transform(realE.child, calced.first) :_*)
+ todo.transform(realE.child, calced.head) :_*)
case _ if id.isEmpty =>
calced.map(kids => new Elem(realE.prefix, realE.label,
realE.attributes, realE.scope,
@@ -2087,7 +2088,7 @@ private class SelectorMap(binds: List[CssBind]) extends Function1[NodeSeq, NodeS
calced.length match {
case 0 => NodeSeq.Empty
case 1 => {
- calced.first match {
+ calced.head match {
case Group(g) => g
case e: Elem => new Elem(e.prefix,
e.label, mergeAll(e.attributes, false),
View
20 core/util/src/main/scala/net/liftweb/util/ClassHelpers.scala
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2010 WorldWide Conferencing, LLC
+ * Copyright 2006-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,12 +14,12 @@
* limitations under the License.
*/
-package net.liftweb {
-package util {
+package net.liftweb
+package util
-import _root_.java.lang.reflect.{Method, InvocationTargetException}
-import _root_.java.lang.reflect.Modifier._
-import _root_.scala.reflect.Manifest
+import java.lang.reflect.{Method, InvocationTargetException}
+import java.lang.reflect.Modifier._
+import scala.reflect.Manifest
import common._
object ClassHelpers extends ClassHelpers with ControlHelpers
@@ -151,9 +151,9 @@ trait ClassHelpers { self: ControlHelpers =>
def findClass(where: List[(String, List[String])]): Box[Class[AnyRef]] =
findType[AnyRef](where)
- @deprecated def camelCase(name : String): String = StringHelpers.camelify(name)
- @deprecated def camelCaseMethod(name: String): String = StringHelpers.camelifyMethod(name)
- @deprecated def unCamelCase(name : String) = StringHelpers.snakify(name)
+ @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)
/**
* @return true if the method is public and has no parameters
@@ -384,5 +384,3 @@ trait ClassHelpers { self: ControlHelpers =>
}
}
-}
-}
View
2 core/util/src/main/scala/net/liftweb/util/Currency.scala
@@ -28,7 +28,7 @@ class Currency(val amount: Long, val symbol: String, val decimals: Int) {
if (decimals == 0) symbol+amount
else {
val d = amount.toDouble
- val pow = Math.pow(10, decimals)
+ val pow = math.pow(10, decimals)
symbol+(d / pow)
}
}
View
37 core/util/src/main/scala/net/liftweb/util/CurrencyZone.scala
@@ -1,5 +1,5 @@
/*
- * Copyright 2007-2010 WorldWide Conferencing, LLC
+ * Copyright 2007-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,48 +14,48 @@
* limitations under the License.
*/
-package net.liftweb {
-package util {
+package net.liftweb
+package util
-import _root_.java.util.Locale
-import _root_.java.text.{NumberFormat, DecimalFormat}
+import java.util.Locale
+import java.text.{NumberFormat, DecimalFormat}
trait TwoFractionDigits {
- val numberOfFractionDigits = 2
- val scale = 10
+ def numberOfFractionDigits = 2
+ def scale = 10
}
trait DollarCurrency extends TwoFractionDigits {
- val currencySymbol = "$"
+ def currencySymbol: String = "$"
}
/* Various Currencies */
object AU extends CurrencyZone {
type Currency = AUD
var locale = new Locale("en", "AU")
- def make(x: BigDecimal) = new Currency{val amount = x}
+ def make(x: BigDecimal) = new Currency{def amount = x}
abstract class AUD extends AbstractCurrency("AUD") with DollarCurrency {}
}
object US extends CurrencyZone {
type Currency = USD
var locale = Locale.US
- def make(x: BigDecimal) = new Currency{val amount = x}
+ def make(x: BigDecimal) = new Currency{def amount = x}
abstract class USD extends AbstractCurrency("USD") with DollarCurrency {}
}
object GB extends CurrencyZone {
type Currency = GBP
var locale = Locale.UK
- def make(x: BigDecimal) = new Currency{val amount = x}
- abstract class GBP extends AbstractCurrency("GBP") with TwoFractionDigits {val currencySymbol = "£"}
+ def make(x: BigDecimal) = new Currency{def amount = x}
+ abstract class GBP extends AbstractCurrency("GBP") with TwoFractionDigits {def currencySymbol = "£"}
}
object EU extends CurrencyZone {
type Currency = EUR
var locale = Locale.GERMANY // guess this is why its a var
- def make(x: BigDecimal) = new Currency{val amount = x; override val _locale = locale}
- abstract class EUR extends AbstractCurrency("EUR") with TwoFractionDigits {val currencySymbol = ""}
+ def make(x: BigDecimal) = new Currency{def amount = x; override val _locale = locale}
+ abstract class EUR extends AbstractCurrency("EUR") with TwoFractionDigits {def currencySymbol = ""}
}
abstract class CurrencyZone {
@@ -87,9 +87,9 @@ abstract class CurrencyZone {
def amount: BigDecimal
def floatValue = amount.floatValue
def doubleValue = amount.doubleValue
- val currencySymbol: String
- val numberOfFractionDigits: Int
- val scale: Int
+ def currencySymbol: String
+ def numberOfFractionDigits: Int
+ def scale: Int
def +(that: Currency): Currency = make(this.amount + that.amount)
def +(that: Int): Currency = this + make(that)
@@ -148,6 +148,3 @@ abstract class CurrencyZone {
}
}
-
-}
-}
View
2 core/util/src/main/scala/net/liftweb/util/HttpHelpers.scala
@@ -227,7 +227,7 @@ trait HttpHelpers {
- private val serial = new AtomicLong(Math.abs(Helpers.randomLong(Helpers.millis)) + 1000000L)
+ private val serial = new AtomicLong(math.abs(Helpers.randomLong(Helpers.millis)) + 1000000L)
/**
* Get a monotonically increasing number that's guaranteed to be unique for the
View
113 core/util/src/main/scala/net/liftweb/util/Log.scala
@@ -1,5 +1,5 @@
/*
- * Copyright 2006-2010 WorldWide Conferencing, LLC
+ * Copyright 2006-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-package net.liftweb {
-package util {
+package net.liftweb
+package util
-import _root_.java.util.Properties
+import java.util.Properties
import Helpers._
-import _root_.org.apache.log4j._
-import _root_.org.apache.log4j.xml._
+import org.apache.log4j._
+import org.apache.log4j.xml._
import common.{Logger => _, _}
/**
@@ -50,7 +50,7 @@ import common.{Logger => _, _}
object LoggingAutoConfigurer {
import ClassHelpers._
- private def findTheFile(files: String*): Box[(_root_.java.net.URL)] = {
+ private def findTheFile(files: String*): Box[(java.net.URL)] = {
val namesToTry = Props.toTry.flatMap(f => files.toList.map(file => f()+file))
first(namesToTry) (name => tryo(getClass.getResource(name)).filter(_ ne null).map(s => s))
}
@@ -82,59 +82,59 @@ object LoggingAutoConfigurer {
*
* @deprecated Use net.liftweb.common.Logger
*/
-@deprecated object Log extends LiftLogger {
+@deprecated("Use net.liftweb.common.Logger") object Log extends LiftLogger {
lazy val rootLogger: LiftLogger = LogBoot.loggerByName("lift")
- @deprecated override def trace(msg: => AnyRef) = rootLogger.trace(msg)
- @deprecated override def trace(msg: => AnyRef, t: => Throwable) = rootLogger.trace(msg, t)
+ @deprecated("Use net.liftweb.common.Logger") override def trace(msg: => AnyRef) = rootLogger.trace(msg)
+ @deprecated("Use net.liftweb.common.Logger") override def trace(msg: => AnyRef, t: => Throwable) = rootLogger.trace(msg, t)
- @deprecated override def assertLog(assertion: Boolean, msg: => String) = rootLogger.assertLog(assertion, msg)
+ @deprecated("Use net.liftweb.common.Logger") override def assertLog(assertion: Boolean, msg: => String) = rootLogger.assertLog(assertion, msg)
- @deprecated override def isEnabledFor(level: LiftLogLevels.Value) = rootLogger.isEnabledFor(level)
- @deprecated override def isDebugEnabled = rootLogger.isDebugEnabled
- @deprecated override def debug(msg: => AnyRef) = rootLogger.debug(msg)
+ @deprecated("Use net.liftweb.common.Logger") override def isEnabledFor(level: LiftLogLevels.Value) = rootLogger.isEnabledFor(level)
+ @deprecated("Use net.liftweb.common.Logger") override def isDebugEnabled = rootLogger.isDebugEnabled
+ @deprecated("Use net.liftweb.common.Logger") override def debug(msg: => AnyRef) = rootLogger.debug(msg)
// override def debugF(msg: => AnyRef) = debug(msg)
- @deprecated override def debug(msg: => AnyRef, t: => Throwable) = rootLogger.debug(msg, t)
+ @deprecated("Use net.liftweb.common.Logger") override def debug(msg: => AnyRef, t: => Throwable) = rootLogger.debug(msg, t)
- @deprecated override def isErrorEnabled = rootLogger.isEnabledFor(LiftLogLevels.Error)
- @deprecated override def error(msg: => AnyRef) = rootLogger.error(msg)
+ @deprecated("Use net.liftweb.common.Logger") override def isErrorEnabled = rootLogger.isEnabledFor(LiftLogLevels.Error)
+ @deprecated("Use net.liftweb.common.Logger") override def error(msg: => AnyRef) = rootLogger.error(msg)
// override def errorF(msg: => AnyRef) = error(msg)
- @deprecated override def error(msg: => AnyRef, t: => Throwable) = rootLogger.error(msg, t)
+ @deprecated("Use net.liftweb.common.Logger") override def error(msg: => AnyRef, t: => Throwable) = rootLogger.error(msg, t)
- @deprecated override def fatal(msg: AnyRef) = rootLogger.fatal(msg)
+ @deprecated("Use net.liftweb.common.Logger") override def fatal(msg: AnyRef) = rootLogger.fatal(msg)
// override def fatalF(msg: AnyRef) = fatal(msg)
- @deprecated override def fatal(msg: AnyRef, t: Throwable) = rootLogger.fatal(msg, t)
+ @deprecated("Use net.liftweb.common.Logger") override def fatal(msg: AnyRef, t: Throwable) = rootLogger.fatal(msg, t)
- @deprecated override def level = rootLogger.level
- @deprecated override def level_=(level: LiftLogLevels.Value) = rootLogger.level = level
- @deprecated override def name = rootLogger.name
+ @deprecated("Use net.liftweb.common.Logger") override def level = rootLogger.level
+ @deprecated("Use net.liftweb.common.Logger") override def level_=(level: LiftLogLevels.Value) = rootLogger.level = level
+ @deprecated("Use net.liftweb.common.Logger") override def name = rootLogger.name
// def parent = rootLogger.parent
- @deprecated override def isInfoEnabled = rootLogger.isInfoEnabled
- @deprecated override def info(msg: => AnyRef) = rootLogger.info(msg)
+ @deprecated("Use net.liftweb.common.Logger") override def isInfoEnabled = rootLogger.isInfoEnabled
+ @deprecated("Use net.liftweb.common.Logger") override def info(msg: => AnyRef) = rootLogger.info(msg)
/**
* @deprecated Use Schemifier.infoF
*/
- @deprecated def infoF(msg: => AnyRef) = info(msg)
- @deprecated override def info(msg: => AnyRef, t: => Throwable) = rootLogger.info(msg, t)
+ @deprecated("Use Schemifier.infoF") def infoF(msg: => AnyRef) = info(msg)
+ @deprecated("Use net.liftweb.common.Logger") override def info(msg: => AnyRef, t: => Throwable) = rootLogger.info(msg, t)
// def isEnabledFor(level: Priority) = rootLogger.isEnabledFor(level)
- @deprecated override def isWarnEnabled = rootLogger.isWarnEnabled
- @deprecated override def warn(msg: => AnyRef) = rootLogger.warn(msg)
+ @deprecated("Use net.liftweb.common.Logger") override def isWarnEnabled = rootLogger.isWarnEnabled
+ @deprecated("Use net.liftweb.common.Logger") override def warn(msg: => AnyRef) = rootLogger.warn(msg)
// def warnF(msg: => AnyRef) = warn(msg)
- @deprecated override def warn(msg: => AnyRef, t: => Throwable) = rootLogger.warn(msg, t)
+ @deprecated("Use net.liftweb.common.Logger") override def warn(msg: => AnyRef, t: => Throwable) = rootLogger.warn(msg, t)
- @deprecated def never(msg: => AnyRef) {}
+ @deprecated("Use net.liftweb.common.Logger") def never(msg: => AnyRef) {}
/**
* @deprecated Use Schemifier.neverF
*/
- @deprecated def neverF(msg: => AnyRef) {}
- @deprecated def never(msg: => AnyRef, t: => Throwable) {}
+ @deprecated("Use Schemifier.neverF") def neverF(msg: => AnyRef) {}
+ @deprecated("Use net.liftweb.common.Logger") def never(msg: => AnyRef, t: => Throwable) {}
- @deprecated override def isTraceEnabled = rootLogger.isTraceEnabled
+ @deprecated("Use net.liftweb.common.Logger") override def isTraceEnabled = rootLogger.isTraceEnabled
}
/**
@@ -157,15 +157,15 @@ object LoggingAutoConfigurer {
* Thus, if you name your log4j config file 'default.log4j.xml' or
* 'default.log4j.props' it will be picked up correctly.
*/
-@deprecated object LogBoot {
- @deprecated lazy val checkConfig: Boolean = loggerSetup()
+@deprecated("Use net.liftweb.common.Logger") object LogBoot {
+ @deprecated("Use net.liftweb.common.Logger") lazy val checkConfig: Boolean = loggerSetup()
// Prevent double initialization of log4j by new/old logging code
private[util] var log4JInited = false
- @deprecated var loggerSetup: () => Boolean = _log4JSetup _
+ @deprecated("Use net.liftweb.common.Logger") var loggerSetup: () => Boolean = _log4JSetup _
- @deprecated var defaultProps =
+ @deprecated("Use net.liftweb.common.Logger") var defaultProps =
"""<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
@@ -179,14 +179,14 @@ object LoggingAutoConfigurer {
</log4j:configuration>
"""
- @deprecated def _log4JSetup() =
+ @deprecated("Use net.liftweb.common.Logger") def _log4JSetup() =
{
if (log4JInited) {
true
} else {
log4JInited = true
def log4jIsConfigured = LogManager.getLoggerRepository.getCurrentLoggers.hasMoreElements
- def findTheFile: Box[(_root_.java.net.URL, String)] = (first(Props.toTry.flatMap(f => List(f()+"log4j.props", f()+"log4j.xml")))
+ def findTheFile: Box[(java.net.URL, String)] = (first(Props.toTry.flatMap(f => List(f()+"log4j.props", f()+"log4j.xml")))
(name =>tryo(getClass.getResource(name)).filter(_ ne null).map(s => (s, name))))
val (log4jUrl, fileName) = findTheFile match {
@@ -204,7 +204,7 @@ object LoggingAutoConfigurer {
if (!log4jUrl.isDefined && !log4jIsConfigured) {
val domConf = new DOMConfigurator
val defPropBytes = defaultProps.toString.getBytes("UTF-8")
- val is = new _root_.java.io.ByteArrayInputStream(defPropBytes)
+ val is = new java.io.ByteArrayInputStream(defPropBytes)
domConf.doConfigure(is, LogManager.getLoggerRepository())
}
true
@@ -214,17 +214,17 @@ object LoggingAutoConfigurer {
private def _loggerCls(clz: Class[AnyRef]): LiftLogger = if (checkConfig) new Log4JLogger(Logger.getLogger(clz)) else NullLogger
private def _logger(name: String): LiftLogger = if (checkConfig) new Log4JLogger(Logger.getLogger(name)) else NullLogger
- @deprecated var loggerByName: String => LiftLogger = _logger
- @deprecated var loggerByClass: Class[AnyRef] => LiftLogger = _loggerCls _
+ @deprecated("Use net.liftweb.common.Logger") var loggerByName: String => LiftLogger = _logger
+ @deprecated("Use net.liftweb.common.Logger") var loggerByClass: Class[AnyRef] => LiftLogger = _loggerCls _
}
-@deprecated object NullLogger extends LiftLogger {
+@deprecated("Use net.liftweb.common.Logger") object NullLogger extends LiftLogger {
}
/**
* @deprecated Use net.liftweb.common.Logger
*/
-@deprecated trait LiftLogger {
+@deprecated("Use net.liftweb.common.Logger") trait LiftLogger {
def isTraceEnabled: Boolean = false
def trace(msg: => AnyRef): Unit = ()
def trace(msg: => AnyRef, t: => Throwable): Unit = ()
@@ -258,18 +258,18 @@ object LoggingAutoConfigurer {
def warn(msg: => AnyRef, t: => Throwable): Unit = ()
}
-@deprecated object LiftLogLevels extends Enumeration {
- @deprecated val All = Value(1, "All")
- @deprecated val Trace = Value(3, "Trace")
- @deprecated val Debug = Value(5, "Debug")
- @deprecated val Warn = Value(7, "Warn")
- @deprecated val Error = Value(9, "Error")
- @deprecated val Fatal = Value(11, "Fatal")
- @deprecated val Info = Value(13, "Info")
- @deprecated val Off = Value(15, "Off")
+@deprecated("Use net.liftweb.common.Logger") object LiftLogLevels extends Enumeration {
+ @deprecated("Use net.liftweb.common.Logger") val All = Value(1, "All")
+ @deprecated("Use net.liftweb.common.Logger") val Trace = Value(3, "Trace")
+ @deprecated("Use net.liftweb.common.Logger") val Debug = Value(5, "Debug")
+ @deprecated("Use net.liftweb.common.Logger") val Warn = Value(7, "Warn")
+ @deprecated("Use net.liftweb.common.Logger") val Error = Value(9, "Error")
+ @deprecated("Use net.liftweb.common.Logger") val Fatal = Value(11, "Fatal")
+ @deprecated("Use net.liftweb.common.Logger") val Info = Value(13, "Info")
+ @deprecated("Use net.liftweb.common.Logger") val Off = Value(15, "Off")
}
-@deprecated class Log4JLogger(val logger: Logger) extends LiftLogger {
+@deprecated("Use net.liftweb.common.Logger") class Log4JLogger(val logger: Logger) extends LiftLogger {
override def isTraceEnabled = logger.isTraceEnabled
override def trace(msg: => AnyRef) = if (isTraceEnabled) logger.trace(msg)
override def trace(msg: => AnyRef, t: => Throwable) = if (isTraceEnabled) logger.trace(msg, t)
@@ -323,6 +323,3 @@ object LoggingAutoConfigurer {
override def warn(msg: => AnyRef) = if (isWarnEnabled) logger.warn(msg)
override def warn(msg: => AnyRef, t: => Throwable) = if (isWarnEnabled) logger.warn(msg, t)
}
-
-}
-}
View
2 core/util/src/main/scala/net/liftweb/util/NamedPartialFunction.scala
@@ -34,7 +34,7 @@ trait NamedPartialFunction[-A, +B] extends PartialFunction[A, B] {
class NamedPF[-A, +B](name: String, f: PartialFunction[A, B]) extends NamedPartialFunction[A, B] {
override def isDefinedAt(x: A): Boolean = f.isDefinedAt(x)
override def apply(x: A): B = f(x)
- val functionName = name
+ def functionName = name
}
object NamedPF {
View
16 core/util/src/main/scala/net/liftweb/util/Slf4jLogger.scala
@@ -1,5 +1,5 @@
/*
- * Copyright 2007-2010 WorldWide Conferencing, LLC
+ * Copyright 2007-2011 WorldWide Conferencing, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,10 +14,10 @@
* limitations under the License.
*/
-package net.liftweb {
-package util {
+package net.liftweb
+package util
-import _root_.org.slf4j.{Logger, LoggerFactory}
+import org.slf4j.{Logger, LoggerFactory}
/**
* Object use to configure lift to use slf4j for as internal logging.
@@ -26,7 +26,7 @@ import _root_.org.slf4j.{Logger, LoggerFactory}
* <pre name="code" class="scala">
* package bootstrap.liftweb
*
- * import _root_.net.liftweb.util._
+ * import net.liftweb.util._
* ...
* class Boot {
* def boot {
@@ -56,7 +56,7 @@ import _root_.org.slf4j.{Logger, LoggerFactory}
* </pre>
*
*/
-@deprecated object Slf4jLogBoot {
+@deprecated("use net.liftweb.common.Logger") object Slf4jLogBoot {
private def _loggerByClass(clz: Class[AnyRef]): LiftLogger = new Slf4jLogger(LoggerFactory.getLogger(clz))
private def _loggerByName(name: String): LiftLogger = new Slf4jLogger(LoggerFactory.getLogger(name))
@@ -73,7 +73,7 @@ import _root_.org.slf4j.{Logger, LoggerFactory}
* Adapter use internaly by lift as Logger, if Slf4jLogBoot is enabled.
* @see Slf4jLogBoot
*/
-@deprecated class Slf4jLogger(val logger: Logger) extends LiftLogger {
+@deprecated("use net.liftweb.common.Logger") class Slf4jLogger(val logger: Logger) extends LiftLogger {
override def isTraceEnabled = logger.isTraceEnabled
override def trace(msg: => AnyRef) = if (isTraceEnabled) logger.trace(String.valueOf(msg))
override def trace(msg: => AnyRef, t: => Throwable) = if (isTraceEnabled) logger.trace(String.valueOf(msg), t)
@@ -116,5 +116,3 @@ import _root_.org.slf4j.{Logger, LoggerFactory}
override def warn(msg: => AnyRef, t: => Throwable) = if (isWarnEnabled) logger.warn(String.valueOf(msg), t)
}
-}
-}
View
39 web/webkit/src/main/scala/net/liftweb/builtin/snippet/Tail.scala
@@ -18,8 +18,11 @@ package net.liftweb
package builtin
package snippet
+import http._
+import util._
import scala.xml._
-import net.liftweb.http._
+
+
object Tail extends DispatchSnippet {
def dispatch: DispatchIt = {
@@ -29,10 +32,42 @@ object Tail extends DispatchSnippet {
def render(xhtml: NodeSeq) : NodeSeq = <tail>{xhtml}</tail>
}
+/**
+ * The 'head' snippet. Use this snippet to move
+ * a chunk of
+ */
object Head extends DispatchSnippet {
+ lazy val valid = Set("title", "base",
+ "link", "meta", "style",
+ "script")
+
def dispatch: DispatchIt = {
case _ => render _
}
- def render(xhtml: NodeSeq) : NodeSeq = <head>{xhtml}</head>
+ def render(_xhtml: NodeSeq) : NodeSeq = {
+ def validHeadTagsOnly(in: NodeSeq): NodeSeq =
+ in flatMap {
+ case Group(ns) => validHeadTagsOnly(ns)
+ case e: Elem if (null eq e.prefix) && valid.contains(e.label) => {
+ new Elem(e.prefix,
+ e.label,
+ e.attributes,
+ e.scope,
+ validHeadTagsOnly(e.child) :_*)
+ }
+ case e: Elem if (null eq e.prefix) => NodeSeq.Empty
+ case x => x
+ }
+
+ val xhtml = validHeadTagsOnly(_xhtml)
+
+ <head>{
+ if (S.attr("withResourceId").filter(Helpers.toBoolean).isDefined) {
+ WithResourceId.render(xhtml)
+ } else {
+ xhtml
+ }
+ }</head>
+ }
}
View
2 web/webkit/src/main/scala/net/liftweb/sitemap/SiteMap.scala
@@ -114,7 +114,7 @@ final class SiteMapJBridge {
object SiteMap extends SiteMapSingleton
-sealed trait SiteMapSingleton {
+sealed class SiteMapSingleton {
/**
* By default, Lift enforced unique links in a SiteMap. However, you
* can disable this feature by setting enforceUniqueLinks to false

0 comments on commit 04a87a1

Please sign in to comment.
Something went wrong with that request. Please try again.