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
java.lang.ClassFormatError: Duplicate method name&signature in class file #7120
Comments
Imported From: https://issues.scala-lang.org/browse/SI-7120?orig=1 |
@retronym said:
|
@retronym said: But it's possible that this just lifted the lid on some existing problem in erasure; I'm trying to track down why final override def applyOrElse(x1: Object, default: Function1): Object = {
final override <bridge> def applyOrElse(x: Object, default: Function1): Object = $anonfun.this.applyOrElse(x.$asInstanceOf[Container](), default) |
@retronym said (edited on Feb 13, 2013 4:08:12 PM UTC): I think this will fix it: https://github.com/retronym/scala/compare/ticket/7120 Checking for collateral damage: https://scala-webapps.epfl.ch/jenkins/job/scala-checkin-manual/799/console We can't fix this for 2.10.x as changing the erased types risks binary compatibility breakages for ourselves, and downstream libraries that are themselves trying to offer binary compatibility guarantees. If that build goes well, I'll submit a PR against master. |
@retronym said: |
Ben Hutchison (ben_hutchison) said:
|
@adriaanm said: // derived from a real-world Slick app (support #3035)
// running Test should not throw a java.lang.ClassFormatError: Duplicate method name&signature in class file Test$$anonfun$1
// workaround: uncomment type arg to list below
class AbstractTable[T] { type TableElementType }
class Table[T] extends AbstractTable[T] { type TableElementType = T }
class Query[E, U]
class TableQuery[E <: AbstractTable[_]] extends Query[E, E#TableElementType]
object Test extends App {
object MyTable extends TableQuery[Table[Long]]
def list[R](q: Query[_, R]): List[R] = Nil
list/*[Long]*/(MyTable) collect { case x => x }
} |
@adriaanm said: |
After migrating from 2.9.2 to 2.10 my team has encountered a runtime
ClassFormatError
, which I've managed to reduce to a simple single-file reproduction case which involves a type parameter, type alias and a partial function. The sample is reproduced here (full code as a gist):The generated class file for Derived.defect clearly has duplicate method signatures:
Fortunately this can be worked around by qualifying the derived method with a full return type:
The text was updated successfully, but these errors were encountered: