Skip to content

Commit

Permalink
Workaround bug in Scala runtime reflection on JDK 9
Browse files Browse the repository at this point in the history
The underlying bug is tracked as scala/scala-dev#304
and blocks our SBT starting on JDK 9.

This commit avoids using the empty package in our build definition.

After this change, I needed to manually clean the class files from the
build definition as follows, which might indicate a bug in SBT.

   $ sbt ...
   /Users/jz/code/scala-java9-ci/build.sbt:0: warning: imported `BuildSettings' is permanently hidden by definition of object BuildSettings
   import ..., _root_.scala.build.BuildSettings, ...
   ^C

   % rm -rf project/target/scala-2.10/sbt-0.13/classes/

   % sbt # okay second time
  • Loading branch information
retronym committed Feb 16, 2017
1 parent fe2d9a4 commit 96e8e97
Show file tree
Hide file tree
Showing 13 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
* - to modularize the Scala compiler or library further
*/

import scala.build._
import VersionUtil._

// Scala dependencies:
Expand Down
2 changes: 2 additions & 0 deletions project/BuildSettings.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package scala.build

import sbt._

/** This object defines keys that should be visible with an unqualified name in all .sbt files and the command line */
Expand Down
2 changes: 2 additions & 0 deletions project/GenerateAnyVals.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package scala.build

/** Code generation of the AnyVal types and their companions. */
trait GenerateAnyValReps {
self: GenerateAnyVals =>
Expand Down
2 changes: 2 additions & 0 deletions project/JarJar.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package scala.build

import org.pantsbuild.jarjar
import org.pantsbuild.jarjar._
import org.pantsbuild.jarjar.util._
Expand Down
2 changes: 2 additions & 0 deletions project/MiMa.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package scala.build

// It would be nice to use sbt-mima-plugin here, but the plugin is missing
// at least two features we need:
// * ability to run MiMa twice, swapping `curr` and `prev`, to detect
Expand Down
2 changes: 2 additions & 0 deletions project/Osgi.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package scala.build

import aQute.bnd.osgi.Builder
import aQute.bnd.osgi.Constants._
import java.util.Properties
Expand Down
2 changes: 2 additions & 0 deletions project/ParserUtil.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package scala.build

import sbt._
import sbt.complete.Parser._
import sbt.complete.Parsers._
Expand Down
2 changes: 2 additions & 0 deletions project/PartestUtil.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package scala.build

import sbt._
import sbt.complete._, Parser._, Parsers._

Expand Down
2 changes: 2 additions & 0 deletions project/Quiet.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package scala.build

import sbt._
import Keys._

Expand Down
2 changes: 2 additions & 0 deletions project/ScalaOptionParser.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package scala.build

import ParserUtil._
import sbt._
import sbt.complete.Parser._
Expand Down
2 changes: 2 additions & 0 deletions project/ScalaTool.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package scala.build

import sbt._
import org.apache.commons.lang3.SystemUtils
import org.apache.commons.lang3.StringUtils.replaceEach
Expand Down
2 changes: 2 additions & 0 deletions project/ScriptCommands.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package scala.build

import sbt._
import Keys._
import BuildSettings.autoImport._
Expand Down
2 changes: 2 additions & 0 deletions project/VersionUtil.scala
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package scala.build

import sbt._
import Keys._
import java.util.Properties
Expand Down

0 comments on commit 96e8e97

Please sign in to comment.