Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Travis builds for 2.13.0 fail #298

Closed
mccartney opened this issue Mar 10, 2020 · 12 comments
Closed

Travis builds for 2.13.0 fail #298

mccartney opened this issue Mar 10, 2020 · 12 comments
Labels

Comments

@mccartney
Copy link
Collaborator

mccartney commented Mar 10, 2020

This is something to investigate for latest master:

Local behavior is the same.

Error message:

[info] com.sksamuel.scapegoat.FeedbackTest *** ABORTED ***

[info]   java.lang.NoSuchMethodError: scala.tools.nsc.reporters.StoreReporter.ERROR()Lscala/reflect/internal/Reporter$Severity;

[info]   at com.sksamuel.scapegoat.FeedbackTest.$anonfun$new$3(FeedbackTest.scala:30)

[info]   at org.scalatest.OutcomeOf.outcomeOf(OutcomeOf.scala:85)

[info]   at org.scalatest.OutcomeOf.outcomeOf$(OutcomeOf.scala:83)

[info]   at org.scalatest.OutcomeOf$.outcomeOf(OutcomeOf.scala:104)

[info]   at org.scalatest.Transformer.apply(Transformer.scala:22)

[info]   at org.scalatest.Transformer.apply(Transformer.scala:20)

[info]   at org.scalatest.freespec.AnyFreeSpecLike$$anon$1.apply(AnyFreeSpecLike.scala:406)

[info]   at org.scalatest.TestSuite.withFixture(TestSuite.scala:196)

[info]   at org.scalatest.TestSuite.withFixture$(TestSuite.scala:195)

[info]   at org.scalatest.freespec.AnyFreeSpec.withFixture(AnyFreeSpec.scala:1739)

[info]   ...

[error] java.lang.NoSuchMethodError: scala.tools.nsc.reporters.StoreReporter.ERROR()Lscala/reflect/internal/Reporter$Severity;

[error] 	at com.sksamuel.scapegoat.FeedbackTest.$anonfun$new$3(FeedbackTest.scala:30)

[error] 	at org.scalatest.OutcomeOf.outcomeOf(OutcomeOf.scala:85)

[error] 	at org.scalatest.OutcomeOf.outcomeOf$(OutcomeOf.scala:83)

[error] 	at org.scalatest.OutcomeOf$.outcomeOf(OutcomeOf.scala:104)

[error] 	at org.scalatest.Transformer.apply(Transformer.scala:22)

[error] 	at org.scalatest.Transformer.apply(Transformer.scala:20)

[error] 	at org.scalatest.freespec.AnyFreeSpecLike$$anon$1.apply(AnyFreeSpecLike.scala:406)

[error] 	at org.scalatest.TestSuite.withFixture(TestSuite.scala:196)

[error] 	at org.scalatest.TestSuite.withFixture$(TestSuite.scala:195)

[error] 	at org.scalatest.freespec.AnyFreeSpec.withFixture(AnyFreeSpec.scala:1739)

[error] 	at org.scalatest.freespec.AnyFreeSpecLike.invokeWithFixture$1(AnyFreeSpecLike.scala:404)

[error] 	at org.scalatest.freespec.AnyFreeSpecLike.$anonfun$runTest$1(AnyFreeSpecLike.scala:416)

[error] 	at org.scalatest.SuperEngine.runTestImpl(Engine.scala:306)

[error] 	at org.scalatest.freespec.AnyFreeSpecLike.runTest(AnyFreeSpecLike.scala:416)

[error] 	at org.scalatest.freespec.AnyFreeSpecLike.runTest$(AnyFreeSpecLike.scala:398)

[error] 	at com.sksamuel.scapegoat.FeedbackTest.org$scalatest$OneInstancePerTest$$super$runTest(FeedbackTest.scala:11)
@mccartney mccartney added the bug label Mar 10, 2020
@mccartney
Copy link
Collaborator Author

Other than removing 2.13.0 from the list of Scala versions in .travis.yml I have no clue.
I fail to understand the reason for the error message reported when browsing the source code of scala-reflect in 2.13.0

@avdv do you have any advice?

@avdv
Copy link
Contributor

avdv commented Mar 11, 2020

Hi @mccartney,

I could reproduce the problem locally.

The problem is coursier in combination with scalatest, which seems to depend on scala-reflect 2.13.1, which evicts the scala-refelect 2.13.0 with which the test code was compiled with:

sbt:scalac-scapegoat-plugin> Test/dependencyTree
[info] com.sksamuel.scapegoat:scalac-scapegoat-plugin_2.13.0:1.4.2-SNAPSHOT
[info]   +-commons-io:commons-io:2.6
[info]   +-joda-time:joda-time:2.10.5
[info]   +-org.joda:joda-convert:2.2.1
[info]   +-org.mockito:mockito-all:1.10.19
[info]   +-org.scala-lang.modules:scala-collection-compat_2.13:2.1.4
[info]   +-org.scala-lang.modules:scala-xml_2.13:1.2.0 [S]
[info]   +-org.scala-lang:scala-compiler:2.13.0 [S]
[info]   | +-jline:jline:2.14.6
[info]   | +-org.scala-lang:scala-reflect:2.13.0 (evicted by: 2.13.1)
[info]   | +-org.scala-lang:scala-reflect:2.13.1 [S]
[info]   | 
[info]   +-org.scalatest:scalatest_2.13:3.1.1 [S]
[info]   | +-org.scala-lang:scala-reflect:2.13.1 [S]
[info]   | +-org.scalactic:scalactic_2.13:3.1.1 [S]
[info]   |   +-org.scala-lang:scala-reflect:2.13.1 [S]

When disabling coursier for the build with useCoursier := false, the tests are green again. Dependency tree looks like this:

sbt:scalac-scapegoat-plugin> Test/dependencyTree
[info] com.sksamuel.scapegoat:scalac-scapegoat-plugin_2.13.0:1.4.2-SNAPSHOT
[info]   +-commons-io:commons-io:2.6
[info]   +-joda-time:joda-time:2.10.5
[info]   +-org.joda:joda-convert:2.2.1
[info]   +-org.mockito:mockito-all:1.10.19
[info]   +-org.scala-lang.modules:scala-collection-compat_2.13:2.1.4
[info]   +-org.scala-lang.modules:scala-xml_2.13:1.2.0
[info]   +-org.scala-lang:scala-compiler:2.13.0 [S]
[info]   | +-jline:jline:2.14.6
[info]   | +-org.scala-lang:scala-reflect:2.13.0 [S]
[info]   | 
[info]   +-org.scalatest:scalatest_2.13:3.1.1 [S]
[info]   | +-org.scala-lang.modules:scala-xml_2.13:1.2.0
[info]   | +-org.scala-lang:scala-reflect:2.13.0 [S]
[info]   | +-org.scalactic:scalactic_2.13:3.1.1 [S]
[info]   |   +-org.scala-lang:scala-reflect:2.13.0 [S]
[info]   |   
[info]   +-org.slf4j:slf4j-api:1.7.30

@mccartney
Copy link
Collaborator Author

Hm. Good finding!
So I am wondering what should we do:

  • downgrade to some previous minor version of Scalatest which doesn't depend on scala-reflect 3.1
  • skip testing for 2.13.0 (by removing 2.13.0 from .travis.yml) - that has been suggested elsewhere as we don't release for 2.13.0
  • else?

@avdv
Copy link
Contributor

avdv commented Mar 11, 2020

I would just disable coursier. There are still too many problems, IMO. That's the reason our team jumped back to SBT 1.2.8.

as we don't release for 2.13.0

Wait, what? Why not?

@avdv
Copy link
Contributor

avdv commented Mar 11, 2020

Maybe, another workaround would be to split source files into scala-2.12 and scala-2.13 versions and resolve this compiler warning:

[warn] /home/travis/build/sksamuel/scapegoat/src/main/scala/com/sksamuel/scapegoat/Feedback.scala:8:50: class Reporter in package reporters is deprecated (since 2.13.0): Use reflect.internal.Reporter

[warn] class Feedback(consoleOutput: Boolean, reporter: Reporter, sourcePrefix: String, minimalLevel: Level = Levels.Info) {

That interface might be stable between Scala 2.13.0 and 2.13.1...

@mccartney
Copy link
Collaborator Author

In #281 @mwz said:

I think since the artifacts are not published for 2.13, we're safe to remove it from the build.
But I guess he might have been wrong.
https://search.maven.org/search?q=g:com.sksamuel.scapegoat lists 2.13.0 as one of the artifacts we did publish for.

Ah. OK, so we have more options:

  • downgrade to some previous minor version of Scalatest which doesn't depend on scala-reflect 2.13.1
  • downgrade sbt to some previous version (e.g. 1.2.8)
  • disable courier (I fail to understand the consequences)
  • etc.

@mccartney
Copy link
Collaborator Author

mccartney commented Mar 11, 2020

split source files into scala-2.12 and scala-2.13

Do you mean to have a duplicate copy of the whole source code?

@mccartney
Copy link
Collaborator Author

mccartney commented Mar 11, 2020

That's only test code, so I am thinking we could consider doing something ugly like (pseudo-code):

val errorSeverity = try {
  // one.way.of.accesing.the.ERROR.constant
 Reporter.ERROR
} catch {
  // another.way.of.accesing.the.ERROR.constant
  somethingelse.ERROR
}

as long as it compiles statically.

@avdv
Copy link
Contributor

avdv commented Mar 11, 2020

Do you mean to have a duplicate copy of the whole source code?

No, you can separate single source files and spread them out into /src/main/scala-2.xx directories which will be automatically included by SBT according to the current scala version. That way you can overcome differences between Scala versions.

But, I think in this case it will not work, since the incompatiblity is between Scala 2.13.0 and 2.13.1 with coursier being the culprit of mixing up the dependencies.

val errorSeverity = try {
// one.way.of.accesing.the.ERROR.constant
Reporter.ERROR
} catch {
// another.way.of.accesing.the.ERROR.constant
somethingelse.ERROR
}

The problem is that it would not compile if you try a different way of accessing it, when at runtime it is all different. We could probably resort to reflection...

@avdv
Copy link
Contributor

avdv commented Mar 11, 2020

* disable coursier (I fail to understand the consequences)

That would just cause dependency resolution and fetching to be done like in SBT < 1.3.x.

@mwz
Copy link
Contributor

mwz commented Mar 11, 2020

In #281 @mwz said:

I think since the artifacts are not published for 2.13, we're safe to remove it from the build.

Sorry for the confusion @mccartney, I haven't really checked and for some reason I assumed it wasn't published for 2.13 🤔

It sounds sensible to disable coursier for now until this issue gets resolved. It would be worth reporting upstream. I've come across a few similar issues before, I'm sure there's already one tracking this :)

@avdv
Copy link
Contributor

avdv commented Mar 11, 2020

Also, there is this bug: coursier/coursier#1382 which causes test dependencies to be used for publishing. Which would probably mean that even if you could work around the problem in the test here, it would probably just fail at runtime for 2.13.0 everywhere else.

mccartney added a commit that referenced this issue Mar 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants