mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-04 20:45:58 +01:00
Drop unused syntax sugars (#2728)
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
package gitbucket.core.util
|
||||
|
||||
import org.eclipse.jgit.api.Git
|
||||
import scala.util.control.Exception._
|
||||
import scala.language.reflectiveCalls
|
||||
|
||||
/**
|
||||
@@ -11,46 +9,7 @@ object SyntaxSugars {
|
||||
|
||||
def defining[A, B](value: A)(f: A => B): B = f(value)
|
||||
|
||||
@deprecated("Use scala.util.Using.resource instead", "4.32.0")
|
||||
def using[A <: { def close(): Unit }, B](resource: A)(f: A => B): B =
|
||||
try f(resource)
|
||||
finally {
|
||||
if (resource != null) {
|
||||
ignoring(classOf[Throwable]) {
|
||||
resource.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@deprecated("Use scala.util.Using.resources instead", "4.32.0")
|
||||
def using[A <: { def close(): Unit }, B <: { def close(): Unit }, C](resource1: A, resource2: B)(f: (A, B) => C): C =
|
||||
try f(resource1, resource2)
|
||||
finally {
|
||||
if (resource1 != null) {
|
||||
ignoring(classOf[Throwable]) {
|
||||
resource1.close()
|
||||
}
|
||||
}
|
||||
if (resource2 != null) {
|
||||
ignoring(classOf[Throwable]) {
|
||||
resource2.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@deprecated("Use scala.util.Using.resource instead", "4.32.0")
|
||||
def using[T](git: Git)(f: Git => T): T =
|
||||
try f(git)
|
||||
finally git.getRepository.close()
|
||||
|
||||
@deprecated("Use scala.util.Using.resources instead", "4.32.0")
|
||||
def using[T](git1: Git, git2: Git)(f: (Git, Git) => T): T =
|
||||
try f(git1, git2)
|
||||
finally {
|
||||
git1.getRepository.close()
|
||||
git2.getRepository.close()
|
||||
}
|
||||
|
||||
@deprecated("Use scala.util.Try instead", "4.36.0")
|
||||
def ignore[T](f: => Unit): Unit =
|
||||
try {
|
||||
f
|
||||
|
||||
Reference in New Issue
Block a user