Don't use Java >= 7 Exception constructor

This commit is contained in:
Alexandre Archambault 2017-04-21 14:06:32 +02:00
parent 85dcc9d539
commit 00443c3a46
2 changed files with 25 additions and 5 deletions

View File

@ -4,7 +4,9 @@ final class ResolutionException(
val error: ResolutionError
) extends Exception(
error.message,
error.cause.orNull,
true,
false // don't keep stack trace around (improves readability from the SBT console)
)
error.cause.orNull
) {
// not using the 4-arg Exception constructor, only available with Java >= 7
setStackTrace(Array()) // don't keep stack trace around (improves readability from the SBT console)
}

View File

@ -110,7 +110,8 @@ testLauncherJava6() {
}
testSbtCoursierJava6() {
sbt ++${SCALA_VERSION} publishLocal
sbt ++${SCALA_VERSION} coreJVM/publishLocal cache/publishLocal sbt-coursier/publishLocal
git clone https://github.com/alexarchambault/scalacheck-shapeless.git
cd scalacheck-shapeless
cd project
@ -126,6 +127,23 @@ testSbtCoursierJava6() {
openjdk:6-jre \
/bin/bash -c "cd /root/project && /root/bin/sbt update"
cd ..
# ensuring resolution error doesn't throw NoSuchMethodError
mkdir -p foo/project
cd foo
echo 'libraryDependencies += "foo" % "bar" % "1.0"' >> build.sbt
echo 'addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-SNAPSHOT")' >> project/plugins.sbt
echo 'sbt.version=0.13.15' >> project/build.properties
docker run -it --rm \
-v $HOME/.ivy2/local:/root/.ivy2/local \
-v $(pwd):/root/project \
-v $(pwd)/../bin:/root/bin \
-e CI=true \
openjdk:6-jre \
/bin/bash -c "cd /root/project && /root/bin/sbt update || true" | tee -a output
grep "coursier.ResolutionException: Encountered 1 error" output
echo "Ok, found ResolutionException in output"
cd ..
}
clean_plugin_sbt() {