Skip to content

Instantly share code, notes, and snippets.

@lhohan
Created November 7, 2017 19:46
Show Gist options
  • Save lhohan/c7e8096c3486c6d810283d4753049c4a to your computer and use it in GitHub Desktop.
Save lhohan/c7e8096c3486c6d810283d4753049c4a to your computer and use it in GitHub Desktop.
// does not compile:
scalaVersion := "2.12.4"
// does compile:
//scalaVersion := "2.12.3"
import a.Handler
import a.Handler.CONST
class HandlerImpl extends Handler {
def doSomethingWithConst: String = {
CONST
}
}
package a;
public abstract class Handler {
protected static final String CONST = "abc123";
}
$ java -version
java version "1.8.0_102"
Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)
$ sbt
[info] Loading project definition from /Users/hho/dev/scala_2.12.4_bug/project
[info] Loading settings from build.sbt ...
[info] Set current project to scala_2-12-4_bug (in build file:/Users/hho/dev/scala_2.12.4_bug/)
[info] sbt server started at 127.0.0.1:4307
sbt> show scalaVersion
[info] 2.12.4
sbt> ;clean;compile
[success] Total time: 0 s, completed Nov 7, 2017 8:18:10 PM
[info] Updating {file:/Users/hho/dev/scala_2.12.4_bug/}scala_2-12-4_bug...
[info] Done updating.
[info] Compiling 1 Scala source and 1 Java source to /Users/hho/dev/scala_2.12.4_bug/target/scala-2.12/classes ...
[error] /Users/hho/dev/scala_2.12.4_bug/src/main/scala/HandlerImpl.scala:7:5: not found: value CONST
[error] CONST
[error] ^
[error] one error found
[error] (compile:compileIncremental) Compilation failed
[error] Total time: 3 s, completed Nov 7, 2017 8:18:13 PM
sbt> set scalaVersion := "2.12.3"
[info] Defining *:scalaVersion
[info] The new value will be used by *:allDependencies, *:crossScalaVersions and 14 others.
[info] Run `last` for details.
[info] Reapplying settings...
[info] Set current project to scala_2-12-4_bug (in build file:/Users/hho/dev/scala_2.12.4_bug/)
sbt> show scalaVersion
[info] 2.12.3
sbt> ;clean;compile
[success] Total time: 0 s, completed Nov 7, 2017 8:18:29 PM
[info] Updating {file:/Users/hho/dev/scala_2.12.4_bug/}scala_2-12-4_bug...
[info] Done updating.
[info] Compiling 1 Scala source and 1 Java source to /Users/hho/dev/scala_2.12.4_bug/target/scala-2.12/classes ...
[info] Done compiling.
[success] Total time: 2 s, completed Nov 7, 2017 8:18:31 PM
sbt>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment