"Referring to non-existent method org.scalatest.Matchers.convertToAnyShouldWrapper" after upgrading scalatest to 3.1.4 - scala

I've scala and scalajs project and it is in github for reference.
Initially I've scalatest version 3.0.3 and scalacheck version 1.13.5. The command sbt clean test is working fine.
I've updated scalatest version to 3.1.4 and scalacheck version 1.14.3.
After this updated scala project tests are working fine but scalajs tests are not.
The error I'm getting is
[info] Fast optimizing /Users/rajkumar.natarajan/Documents/Coding/misc/sjs-test-error/core/js/target/scala-2.12/reftree-test-fastopt.js
[error] Referring to non-existent method org.scalatestplus.scalacheck.ScalaCheckConfiguration.$$init$()scala.Unit
[error] called from generic.RefTreeSpec.()
[error] called from generic.RefTreeSpec.()
[error] called from core module analyzer
[error] Referring to non-existent method org.scalatestplus.scalacheck.ScalaCheckDrivenPropertyChecks.$$init$()scala.Unit
[error] called from generic.RefTreeSpec.()
[error] called from generic.RefTreeSpec.()
[error] called from core module analyzer
[error] There were linking errors
[error] (coreJS / Test / fastOptJS) There were linking errors
[error] Total time: 31 s, completed Jun 9, 2021, 5:54:57 PM
The changes are in this commit.
I tried to figure out but I'm novice in scalajs. Is there anything extra I need to do to work correctly?

In your diff, at https://github.com/rajcspsg/sjs-test-error/commit/bb3f00cc542b29998af271530dccae9b73f2ad00#diff-5634c415cd8c8504fdb973a3ed092300b43c4b8fc1e184f7249eb29a55511f91R33, you have a dependency on
"org.scalatestplus" %% "scalacheck-1-14" % "3.1.3.0" % Test
which uses %%. This is a dependency on a JVM artifact, which brings the JVM version of its own dependencies. You end up with two versions of ScalaTest on your classpath: one for the JVM and one for JS. With bad luck, the one for the JVM gets selected, and therefore shadows the one for JS. This results in the linking errors that you get.
You can fix this by using %%% instead of %% in that dependency, assuming that that library is available for Scala.js. If it isn't, you'll have to find a way not to need that dependency at all.

Related

error while loading <root>, Error accessing .ivy2/cache/org.apache.spark/spark-core_2.11/jars/spark-core_2.11-1.4.0.jar

While following an example to deploy an application in Spark, I keep getting the error below while "compile" in sbt.
[info] Updating {file:/home/sankalp/Desktop/spark/SVMexample/}svmexample...
[info] Resolving com.sun.jersey.jersey-test-framework#jersey-test-framework-grizzl[info] Resolving jline#jline;2.12.1 ...
[info] Done updating.
[info] Compiling 1 Scala source to /home/sankalp/Desktop/spark/SVMexample/target/scala-2.11/classes...
[error] error while loading <root>, Error accessing /home/sankalp/.ivy2/cache/org.apache.spark/spark-core_2.11/jars/spark-core_2.11-1.4.0.jar
[trace] Stack trace suppressed: run last compile:compileIncremental for the full output.
[error] (compile:compileIncremental) scala.reflect.internal.MissingRequirementError: object java.lang.Object in compiler mirror not found.
[error] Total time: 21 s, completed Aug 16, 2015 2:36:53 AM
Can anyone help?
Thanks,
I am no expert, but in my case it helped editing:
project/Versions.scala -> val Spark = "1.4.0" -> "1.4.1".
Although it is actually a mystery to me why it did help :).
EDIT:
On the second thought i've noticed by accident, that the file spark-core_2.11-1.4.0.jar was broken (each time it was downloaded by sbt).
It also helped to replacing .jar with valid one from:
http://mvnrepository.com/artifact/org.apache.spark/spark-core_2.11/1.4.0
I suppose it is somehow connected with spark-cassandra-connector build system or repo from which file is downloaded.
Maybe we should file an issue.
EDIT2:
i found out, that broken .jar comes from (at least in my case):
https://jcenter.bintray.com/org/apache/spark/spark-core_2.11/1.4.0/spark-core_2.11-1.4.0.jar
you can see its origin in: .ivy2/cache/org.apache.spark/spark-core_2.11/ivydata-1.4.0.properties
i did not manage to find out why it comes from jcenter (https://bintray.com/bintray/jcenter). maybe it is somehow connected with adding bintray repo to my linux mint or new version of sbt or datastax uses bintray. i will probably investigate later.
The previous suggestions seemed very specific to a particular use case. My solution is inefficient, brute force, but was effective:
Reinstall IntelliJ completely

how to get more debugging for sbt compile error? "MethodHandle not found"

Attempting to sbt compile a branch of my project ENSIME (experiment if you're interested) under Java 6 is giving a bizarre compiler warning:
[info] Compiling 48 Scala sources to /home/fommil/Projects/ensime-server/target/scala-2.11/classes...
[error] Class java.lang.invoke.MethodHandle not found - continuing with a stub.
[error] two errors found
[error] (compile:compile) Compilation failed
[error] Total time: 18 s, completed 03-Sep-2014 22:57:44
It works under Java 7.
Calling last reveals nothing more than the classpath of the compile (this would be equivalent to setting --debug level).
I've removed all the plugins from the project, and the problem still shows.
If I remove all my code - leaving just the build system and dependencies - with some stub scala entry points then there is no problem.
However, I can't exactly bisect my source code file because then it doesn't compile.
When the code is compiled, a grep (including binaries) of MethodHandle doesn't give any hits (although there is a jdk8 file in the tests resources, it is not relevant because the problem appears if it is removed).
It is only one (big) patch that has caused the problem (the previous commit compiles ok).
How can I debug this further in sbt? it doesn't want to give any more info
is this a known problem, or can anyone make an informed guess what is going on?
It turns out that this was caused by pulling in Lucene, which requires Java 7.
A bit of an epic message fail from sbt: there doesn't appear to be any way to get it to output anything sensible.

Compiling my first DSL in Delite

I am trying to follow the tutorial on compiling a simple DSL using Delite+LMS. I compiled LMS and Delite succesfully. Now, following this tutorial closely: http://stanford-ppl.github.io/Delite/myfirstdsl.html I run into problems when I try to build my profiling dsl. It seems that the compiler cannot find the delite-collection classes:
felix#felix-UX32VD:~/Documents/phd/delite/Delite$ sbt compile
Loading /home/felix/sbt/bin/sbt-launch-lib.bash
[info] Loading project definition from /home/felix/Documents/phd/delite/Delite/project
[info] Set current project to delite (in build file:/home/felix/Documents/phd/delite/Delite/)
[info] Compiling 5 Scala sources to /home/felix/Documents/phd/delite/Delite/dsls/profiling/target/scala-2.10/classes...
[error] /home/felix/Documents/phd/delite/Delite/dsls/profiling/src/example/profiling/Profile.scala:7: object DeliteCollection is not a member of package ppl.delite.framework.datastruct.scala
[error] import ppl.delite.framework.datastruct.scala.DeliteCollection
[error] ^
[error] /home/felix/Documents/phd/delite/Delite/dsls/profiling/src/example/profiling/Profile.scala:69: not found: type ScalaGenProfileArrayOps
[error] with ScalaGenDeliteOps with ScalaGenProfileOps with ScalaGenProfileArrayOps
[error]
^
Does someone have some insights to what I'm doing wrong?
From SBT manual:
Library dependencies can be added in two ways:
unmanaged dependencies are jars dropped into the lib directory
managed dependencies are configured in the build definition and downloaded
automatically from repositories (through Apache Ivy, exactly like Maven)
In any case, adding code inside a framework project is a bad idea, because you will have to change the build process (for example, adding an extra module). In addition, you might have to recompile all the code of the framework and this would be very slow.
The right way to make your code depending on a framework is:
Reference the library as a managed dependency available in some kind of repository (best solution).
Copy the jar inside the lib folder of your project and add it as an unmanaged dependency.
Since apparently Delite is not available on any Ivy repo, the best approach is to clone the Git repo and publish it locally. See http://www.scala-sbt.org/release/docs/Detailed-Topics/Publishing.html
Publishing Locally
The publishLocal command will publish to the local
Ivy repository. By default, this is in ${user.home}/.ivy2/local. Other
projects on the same machine can then list the project as a
dependency. For example, if the SBT project you are publishing has
configuration parameters like:
name := 'My Project'
organization := 'org.me'
version :=
'0.1-SNAPSHOT'
Then another project can depend on it:
libraryDependencies += "org.me" %% "my-project" % "0.1-SNAPSHOT"

playframework 2.2.0 scala mockito test

I am currently trying to use Mockclasses in play framework for testing.
I have implemented everything like written in the Documentation. Unfortunately the compiler says:
[error] bad symbolic reference. A signature in MockitoStubs.class refers to term stubbing
[error] in package org.mockito which is not available.
[error] It may be completely missing from the current classpath, or the version on
[error] the classpath might be incompatible with the version used when compiling MockitoStubs.class.
I found some other people which are running play on a mac and have the same error but i could not find any solution.
Does anyone have a solution for this problem? Is it a problem with the mac jdk maybe?
I just installed the new OS X 10.9 Version which included a xCode Update and SDK Updates(I guess Java got updated too). Anyways the error does not occur anymore so it probably was a problem with the jdk...
Mockito is an optional dependency (like most Play2 dependencies). Excerpt from my Build.scala:
"org.mockito" % "mockito-all" % "1.9.5"

Can't compile GWT project with GWTQuery in Eclipse

I'm trying to start using GWTQuery in a GWT project.
I've created sample GWT project in Eclipse
Added gwtquery-1.3.2.jar
into war/WEB-INF/lib
Edited Myproject.gwt.xml (added <inherits name='com.google.gwt.query.Query'/>)
When I compile the project it writes a lot of deffered errors but at the end it comes with:
Scanning for additional dependencies: jar:file:/C:/eclipseBacklog/Backlog/war/WEB-INF/lib/gwtquery-1.3.2.jar!/com/google/gwt/query/client/GQuery.java
Computing all possible rebind results for 'com.google.gwt.query.client.GQuery'
Rebinding com.google.gwt.query.client.GQuery
Checking rule <replace-with class='com.google.gwt.query.client.impl.SelectorEngineNativeIE8'/>
[ERROR] Errors in 'jar:file:/C:/eclipseBacklog/Backlog/war/WEB-INF/lib/gwtquery-1.3.2.jar!/com/google/gwt/query/client/Properties.java'
[ERROR] Line 20: The import com.google.gwt.core.shared cannot be resolved
[ERROR] Line 39: GWT cannot be resolved
[ERROR] Unable to find type 'com.google.gwt.query.client.GQuery'
[ERROR] Hint: Previous compiler errors may have made this type unavailable
[ERROR] Hint: Check the inheritance chain from your module; it may not be inheriting a required module or a module may not be adding its source path entries properly
[ERROR] Errors in 'jar:file:/C:/eclipseBacklog/Backlog/war/WEB-INF/lib/gwtquery-1.3.2.jar!/com/google/gwt/query/client/GQuery.java'
[ERROR] Line 1483: Failed to resolve 'com.google.gwt.query.client.GQuery' via deferred binding
What I'm doing wrong?
Check your version of gwt, you have to update to GWT-2.5.x. because this artifact of gquery has a undesired dependency of it. There are two GWT.java classes in 2.5, and gquery is depending of the new com.google.gwt.core.shared by mistake.
Open an issue at the gwtquery site becasuse this release should work with older gwt version as well.
You could also change the gquery version to 1.3.1 or 1.4.0-SNAPSHOT
Update: I've just deprecated version 1.3.2, and released 1.3.3 which compiles with previous gwt versions