Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove warnings #1994

Open
wants to merge 57 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
390f199
refactor: remove warnings from json project.
Dec 4, 2021
f73c993
refactor: remove warnings from util project.
Dec 4, 2021
0791720
chore: remove warnings from actor project.
Dec 6, 2021
54030b1
chore: remove warnings from common project.
Dec 6, 2021
ae7e804
chore: remove warnings from common test project.
Dec 6, 2021
e2a4095
chore: remove warnings from json project.
Dec 6, 2021
b677a6d
chore: remove warnings from json test project.
Dec 6, 2021
6029180
chore: remove warnings from markdown project.
Dec 6, 2021
65590c8
chore: remove warnings from markdown test project.
Dec 6, 2021
53104fe
chore: remove warnings from util project.
Dec 6, 2021
acad15e
chore: remove warnings from tests of util project.
Dec 6, 2021
e93efac
chore: remove warnings from db project.
Dec 6, 2021
0fe8f90
chore: remove warnings from mongdb record project.
Dec 6, 2021
371fea0
chore: remove warnings from test for mongdb record project.
Dec 6, 2021
5c5034d
chore: remove warnings from mongodb project.
Dec 6, 2021
be76c5c
chore: remove warnings from tests of mongodb project.
Dec 6, 2021
1781095
chore: remove warnings from proto project.
Dec 6, 2021
a2c2b9b
chore: remove warnings from testkit project.
Dec 6, 2021
1327fa9
chore: remove warnings from webkit project.
Dec 6, 2021
2c80dbe
chore: remove warnings from tests for webkit project.
Dec 6, 2021
d903609
fix: replace http by https in project urls.
Dec 6, 2021
61f36b1
chore: remove warnings from json-ext project.
Dec 8, 2021
7b7d256
chore: remove warnings from json-scalaz7 project.
Dec 8, 2021
d90ff10
chore: remove warnings from mapper project.
Dec 8, 2021
46e1676
chore: remove warnings from mongodb project.
Dec 8, 2021
5c20736
chore: remove warnings from mongodb-record project.
Dec 8, 2021
e9db711
chore: remove warnings from proto project.
Dec 8, 2021
580b94f
chore: remove warnings from record project.
Dec 8, 2021
61036fb
chore: remove wrongly added code in webkit project.
Dec 8, 2021
e21c5e1
chore: remove warnings from squeryl-record project.
Dec 8, 2021
839e2dc
chore: remove warnings from mapper project.
Dec 8, 2021
97f0809
chore: remove warnings from json-scalaz7 project.
Dec 8, 2021
81f0af4
chore: remove warnings in tests from json-ext project.
Dec 8, 2021
50d54e3
chore: remove warnings in tests from json project.
Dec 8, 2021
a23300f
chore: remove warnings in tests from markdown project.
Dec 8, 2021
a94a2b9
chore: remove warnings in tests from mapper project.
Dec 8, 2021
ede2597
chore: remove warnings in tests from mongodb project.
Dec 8, 2021
d5dc54b
chore: don't use spray json. Use scala json parser.
Dec 8, 2021
e06ae31
chore: add message to all nowarn annotations.
Dec 8, 2021
5136647
chore: update build configuration to remove warnings.
Dec 8, 2021
8b34255
chore: activate unused warnings and remove them.
Dec 9, 2021
5a747e1
chore: remove more unused imports.
Dec 9, 2021
4487d45
chore: remove implicitConversions import.
Dec 9, 2021
114cfa2
chore: remove more unused imports.
Dec 10, 2021
aa91f95
chore: replace import scala.language.higherKinds by compiler option.
Dec 10, 2021
7bbf8f0
chore: remove scaladoc warnings.
Dec 10, 2021
cddd80e
chore: use @unchecked instead of throwing an exception.
Dec 12, 2021
bdc6a94
chore: remove warning in util tests.
Dec 12, 2021
89176af
chore: check pf4 type instead of removing it.
Dec 12, 2021
b67f994
chore: remove all unused in tests of actor.
Dec 12, 2021
5f5e3a2
chore: remove all unused in tests of common.
Dec 12, 2021
4c55183
chore: remove all unused in tests of json-ext.
Dec 12, 2021
fbf2974
chore: remove all unused in tests of json.
Dec 12, 2021
ac0dae4
chore: remove all unused in tests of markdown.
Dec 12, 2021
59f2556
chore: remove all unused in tests of mapper.
Dec 12, 2021
98618a9
chore: remove all unused in tests of testkit.
Dec 12, 2021
c51cded
chore: remove all unused in tests of webkit.
Dec 12, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
56 changes: 50 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,58 @@ import LiftSbtHelpers._

organization in ThisBuild := "net.liftweb"
version in ThisBuild := "3.6.0-SNAPSHOT"
homepage in ThisBuild := Some(url("http://www.liftweb.net"))
licenses in ThisBuild += ("Apache License, Version 2.0", url("http://www.apache.org/licenses/LICENSE-2.0.txt"))
homepage in ThisBuild := Some(url("https://www.liftweb.net"))
licenses in ThisBuild += ("Apache License, Version 2.0", url("https://www.apache.org/licenses/LICENSE-2.0.txt"))
startYear in ThisBuild := Some(2006)
organizationName in ThisBuild := "WorldWide Conferencing, LLC"

val scala211Version = "2.11.12"
// Bug in compiler for versions 2.12.13, 14 and 15. StringBuiledr.length()
// cannot be written with ().
val scala212Version = "2.12.12"
val scala213Version = "2.13.2"
val scala213Version = "2.13.7"

val crossUpTo212 = Seq(scala212Version, scala211Version)
val crossUpTo213 = scala213Version +: crossUpTo212

scalaVersion in ThisBuild := scala212Version
scalaVersion in ThisBuild := scala212Version
crossScalaVersions in ThisBuild := crossUpTo212 // default everyone to 2.12 for now

libraryDependencies in ThisBuild ++= Seq(specs2, specs2Matchers, specs2Mock, scalacheck, scalactic, scalatest)
libraryDependencies in ThisBuild ++= {
scalaVersion.value.split("\\.") match {
case Array("2", m, p) =>
val minor = m.toInt
val patch = p.toInt

// See published versions at: https://repo1.maven.org/maven2/com/github/ghik/
val silencerVersion = minor match {
case 11 => Some("1.7.7")
case 12 => if (patch <= 10) Some("1.6.0")
else if (patch <= 12) Some("1.7.1")
else None // Some("1.7.7"), nowarn is backported since 2.12.13
case 13 => if (patch == 1) Some("1.6.0")
else None // Some("1.7.7"), nowarn is backported since 2.13.2
}

scalacOptions in ThisBuild ++= Seq("-deprecation")
(
// Allows @scala.annotation.nowarn
silencerVersion match {
case Some(version) =>
List(
compilerPlugin("com.github.ghik" % "silencer-plugin" % version cross CrossVersion.full),
"com.github.ghik" % "silencer-lib" % version % Provided cross CrossVersion.full,
)
case None => Nil
}
) ++ (
// Allows import scala.jdk.CollectionConverters._
if (minor < 13) List(scala_compat)
else Nil
)
case _ => Nil
}
}

// Settings for Sonatype compliance
pomIncludeRepository in ThisBuild := { _ => false }
Expand Down Expand Up @@ -123,7 +157,6 @@ lazy val util =
description := "Utilities Library",
parallelExecution in Test := false,
libraryDependencies ++= Seq(
scala_compiler(scalaVersion.value),
joda_time,
joda_convert,
commons_codec,
Expand Down Expand Up @@ -269,6 +302,12 @@ lazy val mongodb =
)
}
)
.settings(
// Because of one warning: While parsing annotations in
// mongodb-driver-core-3.12.7.jar(com/mongodb/lang/Nullable.class): could
// not find MAYBE in enum <none>.
scalacOptions ~= ((opts) => opts.filterNot(Set("-Xfatal-warnings")))
)

lazy val mongodb_record =
persistenceProject("mongodb-record")
Expand All @@ -277,3 +316,8 @@ lazy val mongodb_record =
crossScalaVersions := crossUpTo213,
parallelExecution in Test := false
)
.settings(
// Because of multiple warnings about using deprecated method instead of
// BsonableField.
scalacOptions ~= ((opts) => opts.filterNot(Set("-Xfatal-warnings")))
)
18 changes: 9 additions & 9 deletions core/actor/src/main/scala/net/liftweb/actor/LAFuture.scala
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class LAFuture[T](val scheduler: LAScheduler = LAScheduler, context: Box[LAFutur
* value has not been satisfied, execute the function
* when the value is satified
*/
def foreach(f: T => Unit) {
def foreach(f: T => Unit): Unit = {
onSuccess(f)
}

Expand Down Expand Up @@ -188,7 +188,7 @@ class LAFuture[T](val scheduler: LAScheduler = LAScheduler, context: Box[LAFutur
/**
* Abort the future. It can never be satified
*/
def abort() {
def abort(): Unit = {
fail(Empty)
}

Expand All @@ -197,7 +197,7 @@ class LAFuture[T](val scheduler: LAScheduler = LAScheduler, context: Box[LAFutur
*
* @param f the function to execute on success.
*/
def onSuccess(f: T => Unit) {
def onSuccess(f: T => Unit): Unit = {
val contextFn = LAFuture.inContext(f, context)
synchronized {
if (satisfied) {LAFuture.executeWithObservers(scheduler, () => contextFn(item))} else
Expand All @@ -212,7 +212,7 @@ class LAFuture[T](val scheduler: LAScheduler = LAScheduler, context: Box[LAFutur
*
* @param f the function to execute. Will receive a Box[Nothing] which may be a Failure if there's exception data
*/
def onFail(f: Box[Nothing] => Unit) {
def onFail(f: Box[Nothing] => Unit): Unit = {
val contextFn = LAFuture.inContext(f, context)
synchronized {
if (aborted) LAFuture.executeWithObservers(scheduler, () => contextFn(failure)) else
Expand All @@ -227,7 +227,7 @@ class LAFuture[T](val scheduler: LAScheduler = LAScheduler, context: Box[LAFutur
*
* @param f the function to execute on completion of the Future
*/
def onComplete(f: Box[T] => Unit) {
def onComplete(f: Box[T] => Unit): Unit = {
val contextFn = LAFuture.inContext(f, context)
synchronized {
if (satisfied) {LAFuture.executeWithObservers(scheduler, () => contextFn(Full(item)))} else
Expand All @@ -240,15 +240,15 @@ class LAFuture[T](val scheduler: LAScheduler = LAScheduler, context: Box[LAFutur
* If the execution fails, do this
* @param e
*/
def fail(e: Exception) {
def fail(e: Exception): Unit = {
fail(Failure(e.getMessage, Full(e), Empty))
}

/**
* If the execution fails as a Box[Nothing], do this
* @param e
*/
def fail(e: Box[Nothing]) {
def fail(e: Box[Nothing]): Unit = {
synchronized {
if (!satisfied && !aborted) {
aborted = true
Expand Down Expand Up @@ -311,14 +311,14 @@ object LAFuture {
*
* @param future
*/
private def notifyObservers(future: LAFuture[_]) {
private def notifyObservers(future: LAFuture[_]): Unit = {
val observers = threadInfo.get()
if (null eq observers) {} else {
observers.foreach(_(future))
}
}

private def executeWithObservers(scheduler: LAScheduler, f: () => Unit) {
private def executeWithObservers(scheduler: LAScheduler, f: () => Unit): Unit = {
val cur = threadInfo.get()
scheduler.execute(() => {
val old = threadInfo.get()
Expand Down
2 changes: 1 addition & 1 deletion core/actor/src/main/scala/net/liftweb/actor/LAPinger.scala
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ object LAPinger {
try {
service.schedule(r, delay, TimeUnit.MILLISECONDS)
} catch {
case e: RejectedExecutionException => throw PingerException(msg + " could not be scheduled on " + to, e)
case e: RejectedExecutionException => throw PingerException(msg.toString + " could not be scheduled on " + to, e)
}
}

Expand Down
16 changes: 8 additions & 8 deletions core/actor/src/main/scala/net/liftweb/actor/LiftActor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ object LAScheduler extends LAScheduler with Loggable {
})

def execute(f: () => Unit): Unit =
es.execute(new Runnable{def run() {
es.execute(new Runnable{def run(): Unit = {
try {
f()
} catch {
Expand All @@ -93,7 +93,7 @@ object LAScheduler extends LAScheduler with Loggable {
*
* @param f the function to execute on another thread
*/
def execute(f: () => Unit) {
def execute(f: () => Unit): Unit = {
synchronized {
if (exec eq null) {
exec = createExecutor()
Expand All @@ -102,7 +102,7 @@ object LAScheduler extends LAScheduler with Loggable {
}
}

def shutdown() {
def shutdown(): Unit = {
synchronized {
if (exec ne null) {
exec.shutdown()
Expand All @@ -129,7 +129,7 @@ trait SpecializedLiftActor[T] extends SimpleActor[T] {
if (f(this)) Full(this) else next.find(f)
*/

def remove() {
def remove(): Unit = {
prev.next = next
next.prev = prev
}
Expand Down Expand Up @@ -221,7 +221,7 @@ trait SpecializedLiftActor[T] extends SimpleActor[T] {
toDo()
}

private def processMailbox(ignoreProcessing: Boolean) {
private def processMailbox(ignoreProcessing: Boolean): Unit = {
around {
proc2(ignoreProcessing)
}
Expand All @@ -240,7 +240,7 @@ trait SpecializedLiftActor[T] extends SimpleActor[T] {
case Nil => f
case xs => CommonLoanWrapper(xs)(f)
}
private def proc2(ignoreProcessing: Boolean) {
private def proc2(ignoreProcessing: Boolean): Unit = {
var clearProcessing = true
baseMailbox.synchronized {
if (!ignoreProcessing && processing) return
Expand Down Expand Up @@ -404,7 +404,7 @@ with ForwardableActor[Any, Any] {



protected final def forwardMessageTo(msg: Any, forwardTo: TypedActor[Any, Any]) {
protected final def forwardMessageTo(msg: Any, forwardTo: TypedActor[Any, Any]): Unit = {
if (null ne responseFuture) {
forwardTo match {
case la: LiftActor => la ! MsgWithResp(msg, responseFuture)
Expand Down Expand Up @@ -507,7 +507,7 @@ with ForwardableActor[Any, Any] {
* The Actor should call this method with a reply
* to the message
*/
protected def reply(v: Any) {
protected def reply(v: Any): Unit = {
if (null ne responseFuture) {
responseFuture.satisfy(v)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package net.liftweb.actor

import net.liftweb.common.{Box, Failure, Full}
import org.specs2.mutable.Specification
import java.util.concurrent.atomic.AtomicBoolean

class LAFutureSpec extends Specification {
sequential
Expand Down
5 changes: 2 additions & 3 deletions core/common/src/main/scala/net/liftweb/common/Box.scala
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package net.liftweb
package common

import scala.language.implicitConversions
import scala.language.existentials
import scala.reflect.Manifest

Expand Down Expand Up @@ -1117,11 +1116,11 @@ object BoxOrRaw {
implicit def rawToBoxOrRaw[T, Q <: T](r: Q): BoxOrRaw[T] =
RawBoxOrRaw(r: T)

implicit def boxToBoxOrRaw[T, Q <% T](r: Box[Q]): BoxOrRaw[T] = {
implicit def boxToBoxOrRaw[T, Q](r: Box[Q])(implicit qToT: Q => T): BoxOrRaw[T] = {
BoxedBoxOrRaw(r.map(v => v: T))
}

implicit def optionToBoxOrRaw[T, Q <% T](r: Option[Q]): BoxOrRaw[T] = {
implicit def optionToBoxOrRaw[T, Q](r: Option[Q])(implicit qToT: Q => T): BoxOrRaw[T] = {
BoxedBoxOrRaw(r.map(v => v: T))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package net.liftweb
package common

import scala.language.implicitConversions

/**
* Via an `[[HLists.HList HList]]` containing a collection of `[[Box]]`, either generates an
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package net.liftweb
package common

import scala.language.implicitConversions
import scala.xml._

/*
Expand Down Expand Up @@ -48,7 +47,7 @@ sealed trait StringOrNodeSeq {
* their needs dictate.
*/
object StringOrNodeSeq {
implicit def strTo[T <% String](str: T): StringOrNodeSeq =
implicit def strTo[T](str: T)(implicit tToString: T => String): StringOrNodeSeq =
new StringOrNodeSeq {
def nodeSeq: NodeSeq = Text(str)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package net.liftweb
package common

import scala.language.implicitConversions

object FuncJBridge extends FuncJBridge

Expand Down
4 changes: 2 additions & 2 deletions core/common/src/main/scala/net/liftweb/common/HList.scala
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ object HLists {
* }}}
*/
final case class :+:[+H, +T <: HList](head: H, tail: T) extends HList {
override def toString = head + " :+: " + tail
override def toString = head.toString + " :+: " + tail
}

/**
Expand All @@ -129,7 +129,7 @@ object HLists {
hlist match {
case HNil =>
0
case head :+: rest =>
case head@_ :+: rest =>
1 + rest.length
}
}
Expand Down
Loading