Skip to content

Commit

Permalink
fix warnigns - now builds in "Release Mode"
Browse files Browse the repository at this point in the history
  • Loading branch information
ehigham committed Oct 1, 2024
1 parent 5c6fcc8 commit 28e88c8
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 22 deletions.
18 changes: 13 additions & 5 deletions hail/src/main/scala/is/hail/backend/api/Py4JBackendApi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import org.json4s.jackson.{JsonMethods, Serialization}
import sourcecode.Enclosing

import javax.annotation.Nullable
import scala.annotation.nowarn

final class Py4JBackendApi(backend: Backend) extends Closeable with ErrorHandling {

Expand Down Expand Up @@ -92,9 +93,14 @@ final class Py4JBackendApi(backend: Backend) extends Closeable with ErrorHandlin
val cloudfsConf = CloudStorageFSConfig.fromFlagsAndEnv(None, flags)

val rpConfig: Option[RequesterPaysConfig] =
(Option(project).filter(_.nonEmpty), Option(buckets)) match {
case (Some(project), buckets) => Some(RequesterPaysConfig(project, buckets.map(_.asScala.toSet)))
case (None, Some(_)) => fatal("A non-empty, non-null requester pays google project is required to configure requester pays buckets.")
(
Option(project).filter(_.nonEmpty),
Option(buckets).map(_.asScala.toSet.filterNot(_.isBlank)).filter(_.nonEmpty),
) match {
case (Some(project), buckets) => Some(RequesterPaysConfig(project, buckets))
case (None, Some(_)) => fatal(
"A non-empty, non-null requester pays google project is required to configure requester pays buckets."
)
case (None, None) => None
}

Expand All @@ -115,7 +121,9 @@ final class Py4JBackendApi(backend: Backend) extends Closeable with ErrorHandlin
persistedIr.remove(id)

def pyAddSequence(name: String, fastaFile: String, indexFile: String): Unit =
references(name).addSequence(IndexedFastaSequenceFile(tmpFileManager.getFs, fastaFile, indexFile))
references(name).addSequence(
IndexedFastaSequenceFile(tmpFileManager.getFs, fastaFile, indexFile)
)

def pyRemoveSequence(name: String): Unit =
references(name).removeSequence()
Expand Down Expand Up @@ -440,7 +448,7 @@ final class Py4JBackendApi(backend: Backend) extends Closeable with ErrorHandlin
t
}

def port: Int = httpServer.getAddress.getPort
@nowarn def port: Int = httpServer.getAddress.getPort
override def close(): Unit = httpServer.stop(10)

thread.start()
Expand Down
35 changes: 18 additions & 17 deletions hail/src/main/scala/is/hail/utils/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,24 @@ package utils {
b.result()
}
}


class Lazy[A] private[utils] (f: => A) {
private[this] var option: Option[A] = None

def apply(): A =
synchronized {
option match {
case Some(a) => a
case None => val a = f; option = Some(a); a
}
}

def isEvaluated: Boolean =
synchronized {
option.isDefined
}
}
}

package object utils
Expand Down Expand Up @@ -1058,23 +1076,6 @@ package object utils

implicit def evalLazy[A](f: Lazy[A]): A =
f()

class Lazy[A] private[utils] (f: => A) {
private[this] var option: Option[A] = None

def apply(): A =
synchronized {
option match {
case Some(a) => a
case None => val a = f; option = Some(a); a
}
}

def isEvaluated: Boolean =
synchronized {
option.isDefined
}
}
}

class CancellingExecutorService(delegate: ExecutorService) extends AbstractExecutorService {
Expand Down

0 comments on commit 28e88c8

Please sign in to comment.