[SPARK-33854][BUILD] Use ListBuffer instead of Stack in SparkBuild.scala
### What changes were proposed in this pull request? This PR aims to use ListBuffer instead of Stack in SparkBuild.scala to remove deprecation warning. ### Why are the changes needed? Stack is deprecated in Scala 2.12.0. ```scala % build/sbt compile ... [warn] /Users/william/spark/project/SparkBuild.scala:1112:25: class Stack in package mutable is deprecated (since 2.12.0): Stack is an inelegant and potentially poorly-performing wrapper around List. Use a List assigned to a var instead. [warn] val stack = new Stack[File]() ``` ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Manual. Closes #30860 from williamhyun/SPARK-33854. Authored-by: William Hyun <williamhyun3@gmail.com> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
This commit is contained in:
parent
70da86a085
commit
2b6ef5606b
|
@ -23,7 +23,7 @@ import java.util.Locale
|
|||
import scala.io.Source
|
||||
import scala.util.Properties
|
||||
import scala.collection.JavaConverters._
|
||||
import scala.collection.mutable.Stack
|
||||
import scala.collection.mutable.ListBuffer
|
||||
|
||||
import sbt._
|
||||
import sbt.Classpaths.publishTask
|
||||
|
@ -1109,14 +1109,14 @@ object TestSettings {
|
|||
// Because File.mkdirs() can fail if multiple callers are trying to create the same
|
||||
// parent directory, this code tries to create parents one at a time, and avoids
|
||||
// failures when the directories have been created by somebody else.
|
||||
val stack = new Stack[File]()
|
||||
val stack = new ListBuffer[File]()
|
||||
while (!dir.isDirectory()) {
|
||||
stack.push(dir)
|
||||
stack.prepend(dir)
|
||||
dir = dir.getParentFile()
|
||||
}
|
||||
|
||||
while (stack.nonEmpty) {
|
||||
val d = stack.pop()
|
||||
val d = stack.remove(0)
|
||||
require(d.mkdir() || d.isDirectory(), s"Failed to create directory $d")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue