Skip to content

Commit

Permalink
Suppress "discarded non-Unit" warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
exoego committed Feb 22, 2018
1 parent d7225ff commit 947f39a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions internal/compiler-bridge/src/main/scala/xsbt/JavaUtils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ private[xsbt] object JavaUtils {
implicit class JavaForEach[T](val iterable: java.lang.Iterable[T]) extends AnyVal {

@inline
def foreach(op: T => Unit): Unit = {
def foreach[U](op: T => U): Unit = {
val iterator = iterable.iterator()
while (iterator.hasNext) op(iterator.next())
}
Expand All @@ -20,7 +20,7 @@ private[xsbt] object JavaUtils {
implicit class JavaMapForEach[K, V](val map: java.util.Map[K, V]) extends AnyVal {

@inline
def foreach(op: (K, V) => Unit): Unit = {
def foreach[U](op: (K, V) => U): Unit = {
val iterator = map.keySet().iterator()
while (iterator.hasNext) {
val key = iterator.next()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,16 @@ final class JavacLogger(log: sbt.util.Logger, reporter: Reporter, cwd: File) ext
private var err: ListBuffer[String] = new ListBuffer()

def out(s: => String): Unit =
synchronized { out += s }
synchronized {
out += s
()
}

def err(s: => String): Unit =
synchronized { err += s }
synchronized {
err += s
()
}

def buffer[T](f: => T): T = f

Expand Down

0 comments on commit 947f39a

Please sign in to comment.