Help to understand deprecation messages

Can someone help me understand these warning messages?

I’m converting a project from scala 2.12 to 2.13. In IntelliJ I get some deprecation messages which I don’t understand.

I don’t find any additional detail about which deprecated feature I’ve used.
There doesn’t seem to be any line number indicated.

What is the -deprecation flag? is that to allow me to used a deprecated feature or is it to force the compiler to emit an error on deprecated features?

It says I can add the -deprecation flag, but it doesn’t say what I need to add the flag to or where to add it.

I’m not sure whether this is the same issue or a different one, but I tried to run sbt test from the shell prompt. I get the following output, full of errors and warnings.

[marcello:~/Repos/earthmap/globe] jnewton% sbt test
[info] Loading global plugins from /Users/jnewton/.sbt/1.0/plugins
[info] Loading project definition from /Users/jnewton/Repos/earthmap/globe/project
[info] Loading settings for project globe from build.sbt ...
[info] Set current project to globe (in build file:/Users/jnewton/Repos/earthmap/globe/)
[info] Compiling 11 Scala sources to /Users/jnewton/Repos/earthmap/globe/target/scala-2.13/classes ...
[info] Non-compiled module 'compiler-bridge_2.13' for Scala 2.13.3. Compiling...
[info]   Compilation completed in 6.456s.
[warn] /Users/jnewton/Repos/earthmap/globe/src/main/scala/globe/Geo.scala:61:7: match may not be exhaustive.
[warn] It would fail on the following input: Nil
[warn]       points match {
[warn]       ^
[warn] 1 deprecation
[warn] 2 deprecations (since 2.13.3)
[warn] 3 deprecations in total; re-run with -deprecation for details
[warn] four warnings found
[info] Done compiling.
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.protobuf.UnsafeUtil (file:/Users/jnewton/.sbt/boot/scala-2.12.7/org.scala-sbt/sbt/1.2.8/protobuf-java-3.3.1.jar) to field java.nio.Buffer.address
WARNING: Please consider reporting this to the maintainers of com.google.protobuf.UnsafeUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[info] Compiling 1 Scala source to /Users/jnewton/Repos/earthmap/globe/target/scala-2.13/test-classes ...
[error] /Users/jnewton/Repos/earthmap/globe/src/test/scala/EarthMapTest.scala:23:8: object FunSuite is not a member of package org.scalatest
[error] did you mean funsuite?
[error] import org.scalatest.FunSuite
[error]        ^
[error] /Users/jnewton/Repos/earthmap/globe/src/test/scala/EarthMapTest.scala:26:28: not found: type FunSuite
[error] class EarthMapTest extends FunSuite {
[error]                            ^
[error] /Users/jnewton/Repos/earthmap/globe/src/test/scala/EarthMapTest.scala:27:3: not found: value test
[error]   test("earthMap 26") {
[error]   ^
[error] /Users/jnewton/Repos/earthmap/globe/src/test/scala/EarthMapTest.scala:30:3: not found: value test
[error]   test("earthMap 27") {
[error]   ^
[error] /Users/jnewton/Repos/earthmap/globe/src/test/scala/EarthMapTest.scala:33:3: not found: value test
[error]   test("population") {
[error]   ^
[error] /Users/jnewton/Repos/earthmap/globe/src/test/scala/EarthMapTest.scala:36:3: not found: value test
[error]   test("EarthMap 42 output") {
[error]   ^
[error] /Users/jnewton/Repos/earthmap/globe/src/test/scala/EarthMapTest.scala:40:3: not found: value test
[error]   test("EarthMap 46 clipped output") {
[error]   ^
[error] /Users/jnewton/Repos/earthmap/globe/src/test/scala/EarthMapTest.scala:45:3: not found: value test
[error]   test("some cities 50") {
[error]   ^
[error] /Users/jnewton/Repos/earthmap/globe/src/test/scala/EarthMapTest.scala:56:3: not found: value test
[error]   test("polar routes") {
[error]   ^
[error] /Users/jnewton/Repos/earthmap/globe/src/test/scala/EarthMapTest.scala:69:3: not found: value test
[error]   test("progressive north") {
[error]   ^
[error] /Users/jnewton/Repos/earthmap/globe/src/test/scala/EarthMapTest.scala:80:3: not found: value test
[error]   test("projection a"){
[error]   ^
[error] /Users/jnewton/Repos/earthmap/globe/src/test/scala/EarthMapTest.scala:92:3: not found: value test
[error]   test("grids"){
[error]   ^
[error] /Users/jnewton/Repos/earthmap/globe/src/test/scala/EarthMapTest.scala:105:3: not found: value test
[error]   test("borders"){
[error]   ^
[error] /Users/jnewton/Repos/earthmap/globe/src/test/scala/EarthMapTest.scala:118:3: not found: value test
[error]   test("projection") {
[error]   ^
[error] 14 errors found
[error] (Test / compileIncremental) Compilation failed
[error] Total time: 11 s, completed Jun 29, 2020, 11:02:55 AM
[marcello:~/Repos/earthmap/globe] jnewton% 

I tied removing my ~/.sbt and ~/.ivy*/cache directories and re-running sbt test. It downloaded lots of things afresh, and I no longer see the deprecation warnings. I only see the errors related to

[error] /Users/jnewton/Repos/earthmap/globe/src/test/scala/EarthMapTest.scala:23:8: object FunSuite is not a member of package org.scalatest
[error] did you mean funsuite?
[error] import org.scalatest.FunSuite
[error]        ^
[error] /Users/jnewton/Repos/earthmap/globe/src/test/scala/EarthMapTest.scala:26:28: not found: type FunSuite
[error] class EarthMapTest extends FunSuite {
[error]                            ^

Here are some answers: https://stackoverflow.com/questions/9578521/how-to-re-run-with-deprecation-for-details-in-sbt

In short, they involve the usage of scalacOptions in SBT build definition.

1 Like