diff --git a/interface/src/main/java/xsbti/api/Modifiers.java b/interface/src/main/java/xsbti/api/Modifiers.java index 78fa13901..5e103c7ec 100644 --- a/interface/src/main/java/xsbti/api/Modifiers.java +++ b/interface/src/main/java/xsbti/api/Modifiers.java @@ -10,7 +10,7 @@ public final class Modifiers implements java.io.Serializable private static final int LazyBit = 5; private static final int MacroBit = 6; - private static final int flag(boolean set, int bit) + private static int flag(boolean set, int bit) { return set ? (1 << bit) : 0; } @@ -30,7 +30,7 @@ public final class Modifiers implements java.io.Serializable private final byte flags; - private final boolean flag(int bit) + private boolean flag(int bit) { return (flags & (1 << bit)) != 0; } diff --git a/interface/src/main/java/xsbti/compile/CompileOrder.java b/interface/src/main/java/xsbti/compile/CompileOrder.java index 62b15bf1f..5683f75d9 100644 --- a/interface/src/main/java/xsbti/compile/CompileOrder.java +++ b/interface/src/main/java/xsbti/compile/CompileOrder.java @@ -30,5 +30,5 @@ public enum CompileOrder * Then, Java sources are passed to the Java compiler, which generates class files for the Java sources. * The Scala classes compiled in the first step are included on the classpath to the Java compiler. */ - ScalaThenJava; + ScalaThenJava } \ No newline at end of file diff --git a/util/collection/src/main/scala/sbt/AList.scala b/util/collection/src/main/scala/sbt/AList.scala index 10e1454e7..24368219b 100644 --- a/util/collection/src/main/scala/sbt/AList.scala +++ b/util/collection/src/main/scala/sbt/AList.scala @@ -46,7 +46,7 @@ object AList { def traverse[M[_], N[_], P[_]](s: List[M[T]], f: M ~> (N ∙ P)#l)(implicit np: Applicative[N]): N[List[P[T]]] = ??? } - /** AList for the abitrary arity data structure KList. */ + /** AList for the arbitrary arity data structure KList. */ def klist[KL[M[_]] <: KList[M] { type Transform[N[_]] = KL[N] }]: AList[KL] = new AList[KL] { def transform[M[_], N[_]](k: KL[M], f: M ~> N) = k.transform(f) def foldr[M[_], T](k: KL[M], f: (M[_], T) => T, init: T): T = k.foldr(f, init) diff --git a/util/collection/src/main/scala/sbt/Settings.scala b/util/collection/src/main/scala/sbt/Settings.scala index de7d9a8fb..a8e5b1d6c 100644 --- a/util/collection/src/main/scala/sbt/Settings.scala +++ b/util/collection/src/main/scala/sbt/Settings.scala @@ -24,14 +24,14 @@ private final class Settings0[Scope](val data: Map[Scope, AttributeMap], val del def get[T](scope: Scope, key: AttributeKey[T]): Option[T] = delegates(scope).toStream.flatMap(sc => getDirect(sc, key)).headOption def definingScope(scope: Scope, key: AttributeKey[_]): Option[Scope] = - delegates(scope).toStream.filter(sc => getDirect(sc, key).isDefined).headOption + delegates(scope).toStream.find(sc => getDirect(sc, key).isDefined) def getDirect[T](scope: Scope, key: AttributeKey[T]): Option[T] = (data get scope).flatMap(_ get key) def set[T](scope: Scope, key: AttributeKey[T], value: T): Settings[Scope] = { - val map = (data get scope) getOrElse AttributeMap.empty + val map = data getOrElse(scope, AttributeMap.empty) val newData = data.updated(scope, map.put(key, value)) new Settings0(newData, delegates) } @@ -85,7 +85,7 @@ trait Init[Scope] { */ private[sbt] final def validated[T](key: ScopedKey[T], selfRefOk: Boolean): ValidationCapture[T] = new ValidationCapture(key, selfRefOk) - @deprecated("0.13.7", "Use the version with default arguments and default paramter.") + @deprecated("0.13.7", "Use the version with default arguments and default parameter.") final def derive[T](s: Setting[T], allowDynamic: Boolean, filter: Scope => Boolean, trigger: AttributeKey[_] => Boolean): Setting[T] = derive(s, allowDynamic, filter, trigger, false) /** @@ -258,7 +258,7 @@ trait Init[Scope] { def Undefined(defining: Setting[_], referencedKey: ScopedKey[_]): Undefined = new Undefined(defining, referencedKey) def Uninitialized(validKeys: Seq[ScopedKey[_]], delegates: Scope => Seq[Scope], keys: Seq[Undefined], runtime: Boolean)(implicit display: Show[ScopedKey[_]]): Uninitialized = { - assert(!keys.isEmpty) + assert(keys.nonEmpty) val suffix = if (keys.length > 1) "s" else "" val prefix = if (runtime) "Runtime reference" else "Reference" val keysString = keys.map(u => showUndefined(u, validKeys, delegates)).mkString("\n\n ", "\n\n ", "") @@ -487,7 +487,7 @@ trait Init[Scope] { override def default(_id: => Long): DefaultSetting[T] = new DerivedSetting[T](sk, i, p, filter, trigger) with DefaultSetting[T] { val id = _id } override def toString = "derived " + super.toString } - // Only keep the first occurence of this setting and move it to the front so that it has lower precedence than non-defaults. + // Only keep the first occurrence of this setting and move it to the front so that it has lower precedence than non-defaults. // This is intended for internal sbt use only, where alternatives like Plugin.globalSettings are not available. private[Init] sealed trait DefaultSetting[T] extends Setting[T] { val id: Long diff --git a/util/collection/src/test/scala/SettingsTest.scala b/util/collection/src/test/scala/SettingsTest.scala index dbad035c6..d97b1056a 100644 --- a/util/collection/src/test/scala/SettingsTest.scala +++ b/util/collection/src/test/scala/SettingsTest.scala @@ -42,10 +42,10 @@ object SettingsTest extends Properties("settings") { { val genScopedKeys = { // We wan - // t to generate lists of keys that DO NOT inclue the "ch" key we use to check thigns. + // t to generate lists of keys that DO NOT inclue the "ch" key we use to check things. val attrKeys = mkAttrKeys[Int](nr).filter(_.forall(_.label != "ch")) attrKeys map (_ map (ak => ScopedKey(Scope(0), ak))) - }.label("scopedKeys").filter(!_.isEmpty) + }.label("scopedKeys").filter(_.nonEmpty) forAll(genScopedKeys) { scopedKeys => try { // Note; It's evil to grab last IF you haven't verified the set can't be empty. diff --git a/util/complete/src/main/scala/sbt/complete/Parser.scala b/util/complete/src/main/scala/sbt/complete/Parser.scala index 393501792..c52d16b91 100644 --- a/util/complete/src/main/scala/sbt/complete/Parser.scala +++ b/util/complete/src/main/scala/sbt/complete/Parser.scala @@ -187,7 +187,7 @@ object Parser extends ParserMain { @deprecated("This method is deprecated and will be removed in the next major version. Use the parser directly to check for invalid completions.", since = "0.13.2") def checkMatches(a: Parser[_], completions: Seq[String]) { val bad = completions.filter(apply(a)(_).resultEmpty.isFailure) - if (!bad.isEmpty) sys.error("Invalid example completions: " + bad.mkString("'", "', '", "'")) + if (bad.nonEmpty) sys.error("Invalid example completions: " + bad.mkString("'", "', '", "'")) } def tuple[A, B](a: Option[A], b: Option[B]): Option[(A, B)] = @@ -378,7 +378,7 @@ trait ParserMain { def unapply[A, B](t: (A, B)): Some[(A, B)] = Some(t) } - /** Parses input `str` using `parser`. If successful, the result is provided wrapped in `Right`. If unsuccesful, an error message is provided in `Left`.*/ + /** Parses input `str` using `parser`. If successful, the result is provided wrapped in `Right`. If unsuccessful, an error message is provided in `Left`.*/ def parse[T](str: String, parser: Parser[T]): Either[String, T] = Parser.result(parser, str).left.map { failures => val (msgs, pos) = failures() @@ -480,7 +480,7 @@ trait ParserMain { def matched(t: Parser[_], seen: Vector[Char] = Vector.empty, partial: Boolean = false): Parser[String] = t match { - case i: Invalid => if (partial && !seen.isEmpty) success(seen.mkString) else i + case i: Invalid => if (partial && seen.nonEmpty) success(seen.mkString) else i case _ => if (t.result.isEmpty) new MatchedString(t, seen, partial) @@ -634,7 +634,7 @@ private final class HetParser[A, B](a: Parser[A], b: Parser[B]) extends ValidPar override def toString = "(" + a + " || " + b + ")" } private final class ParserSeq[T](a: Seq[Parser[T]], errors: => Seq[String]) extends ValidParser[Seq[T]] { - assert(!a.isEmpty) + assert(a.nonEmpty) lazy val resultEmpty: Result[Seq[T]] = { val res = a.map(_.resultEmpty) diff --git a/util/logic/src/main/scala/sbt/logic/Logic.scala b/util/logic/src/main/scala/sbt/logic/Logic.scala index 72f2b2f64..856394251 100644 --- a/util/logic/src/main/scala/sbt/logic/Logic.scala +++ b/util/logic/src/main/scala/sbt/logic/Logic.scala @@ -277,7 +277,7 @@ object Logic { } /** Represents the set of atoms in the heads of clauses and in the bodies (formulas) of clauses. */ - final case class Atoms(val inHead: Set[Atom], val inFormula: Set[Atom]) { + final case class Atoms(inHead: Set[Atom], inFormula: Set[Atom]) { /** Concatenates this with `as`. */ def ++(as: Atoms): Atoms = Atoms(inHead ++ as.inHead, inFormula ++ as.inFormula) /** Atoms that cannot be true because they do not occur in a head. */ diff --git a/util/process/src/main/scala/sbt/Process.scala b/util/process/src/main/scala/sbt/Process.scala index 66b7e03c6..79435367d 100644 --- a/util/process/src/main/scala/sbt/Process.scala +++ b/util/process/src/main/scala/sbt/Process.scala @@ -34,7 +34,7 @@ object Process extends ProcessExtra { /** create ProcessBuilder with working dir set to File and extra environment variables */ def apply(command: Seq[String], cwd: File, extraEnv: (String, String)*): ProcessBuilder = apply(command, Some(cwd), extraEnv: _*) - /** create ProcessBuilder with working dir optionaly set to File and extra environment variables */ + /** create ProcessBuilder with working dir optionally set to File and extra environment variables */ def apply(command: String, cwd: Option[File], extraEnv: (String, String)*): ProcessBuilder = { apply(command.split("""\s+"""), cwd, extraEnv: _*) // not smart to use this on windows, because CommandParser uses \ to escape ". @@ -43,7 +43,7 @@ object Process extends ProcessExtra { case Right((cmd, args)) => apply(cmd :: args, cwd, extraEnv : _*) }*/ } - /** create ProcessBuilder with working dir optionaly set to File and extra environment variables */ + /** create ProcessBuilder with working dir optionally set to File and extra environment variables */ def apply(command: Seq[String], cwd: Option[File], extraEnv: (String, String)*): ProcessBuilder = { val jpb = new JProcessBuilder(command.toArray: _*) cwd.foreach(jpb directory _) @@ -63,7 +63,7 @@ object Process extends ProcessExtra { def cat(file: SourcePartialBuilder, files: SourcePartialBuilder*): ProcessBuilder = cat(file :: files.toList) def cat(files: Seq[SourcePartialBuilder]): ProcessBuilder = { - require(!files.isEmpty) + require(files.nonEmpty) files.map(_.cat).reduceLeft(_ #&& _) } } diff --git a/util/process/src/test/scala/TestedProcess.scala b/util/process/src/test/scala/TestedProcess.scala index 5daea8bab..f83207a07 100644 --- a/util/process/src/test/scala/TestedProcess.scala +++ b/util/process/src/test/scala/TestedProcess.scala @@ -16,7 +16,7 @@ object cat { catFiles(args.toList) System.exit(0) } catch { - case e => + case e: Throwable => e.printStackTrace() System.err.println("Error: " + e.toString) System.exit(1)