-
Notifications
You must be signed in to change notification settings - Fork 1.1k
AbstractMethodError using Scala 2 http4s library/withDottyCompat #10827
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
Labels
Milestone
Comments
Thanks for reporting. A small reproducer is: // build.sbt
scalaVersion := "3.0.0-M3"
libraryDependencies += ("org.http4s" %% "http4s-dsl" % "0.21.13").withDottyCompat(scalaVersion.value) // Main.scala
import org.http4s.dsl.Http4sDsl
trait F[x]
object Test {
def main(args: Array[String]): Unit = {
val dsl = new Http4sDsl[F] {}
}
} sbt> run
[info] compiling 1 Scala source to /tmp/i10827/target/scala-3.0.0-M3/classes ...
[info] done compiling
[info] running Test
[error] (run-main-0) java.lang.AbstractMethodError: Method Test$$anon$1.org$http4s$dsl$impl$Methods$_setter_$GET_$eq(Lorg/http4s/Method$Semantics$Safe;)V is abstract
[error] java.lang.AbstractMethodError: Method Test$$anon$1.org$http4s$dsl$impl$Methods$_setter_$GET_$eq(Lorg/http4s/Method$Semantics$Safe;)V is abstract
[error] at Test$$anon$1.org$http4s$dsl$impl$Methods$_setter_$GET_$eq(Main.scala)
[error] at org.http4s.dsl.impl.Methods.$init$(Methods.scala:12)
[error] at Test$$anon$1.<init>(Main.scala:7)
[error] at Test$.main(Main.scala:7)
[error] at Test.main(Main.scala)
[error] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error] at java.lang.reflect.Method.invoke(Method.java:498) I'm working on minimizing to a standalone example. |
Standalone example: First, a library compiled with Scala 2: // build.sbt
scalaVersion := "2.13.4"
organization := "test.http4s"
name := "i10827"
version := "0.1.0-SNAPSHOT" // Lib.scala
package test.http4s
class Method(name: String)
object Method {
trait Safe
trait PermitsBody extends Method
type SafeMethodWithBody = Method with Safe with PermitsBody
val GET: SafeMethodWithBody = new Method("GET") with Safe with PermitsBody
}
trait Methods {
val GET: Method.GET.type = Method.GET
} Then a test program consuming the library with Scala 3: // build.sbt
scalaVersion := "3.0.0-M3"
libraryDependencies += ("test.http4s" %% "i10827" % "0.1.0-SNAPSHOT").withDottyCompat(scalaVersion.value) // Main.scala
import test.http4s.Methods
object Test {
def main(args: Array[String]): Unit = {
val m = new Methods {}
}
}
The generated bytecode (from 3.0.0-M3):
compared to 2.13.4:
See also #4619 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
I'm trying to create a small service using http4s (0.21) on Scala 3, using
withDottyCompat
Using 3.0.0-M3 (same results with M2), [email protected]
A very much stripped down version is available here: https://github.com/rparree/http4s-dotty
When running i'm getting the following error:
See full stacktrace here: https://gist.github.com/rparree/e19d5ff29c885160c17c18ac5bdc017b#file-rte
After posting this on the http4s gitter channel, @rossabaker suggested that this could potentially be a
withDottyCompat
related problem.The text was updated successfully, but these errors were encountered: