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

ClassFormatError when accessing an outer val from a Trait and an implementing Object #10036

Closed
scabug opened this issue Nov 8, 2016 · 2 comments

Comments

@scabug
Copy link

scabug commented Nov 8, 2016

The reference to outer is contained multiple times in the classfile of O

object Testcase {
  def main(args: Array[String]): Unit = {

    val outer = 4
    trait T {
      def a = outer
    }
    object O extends T {
      def b = outer
    }

    println(O)
  }

}

java.lang.ClassFormatError: Duplicate field name&signature in class file Testcase$O$2$

> javap -p Testcase\$O\$2\$
Compiled from "Testcase.scala"
public class Testcase$O$2$ implements Testcase$T$1 {
  private final int outer$1;
  private final int outer$1;
  public void Testcase$T$1$_setter_$outer$1_$eq(int);
  public int outer$1();
  public int a();
  public int b();
  public Testcase$O$2$(int);
}

seems related to
#8984
#7645
#5252
#8895
at least they all produce similar errors.

Interestingly, the non minimized version of this in our codebase only manifests itself with Scala 2.12.0.

@scabug
Copy link
Author

scabug commented Nov 8, 2016

Imported From: https://issues.scala-lang.org/browse/SI-10036?orig=1
Reporter: Ragnar (ragnar)
Affected Versions: 2.10.6, 2.11.8, 2.12.0, 2.12.1
See #5252, #7645, #8984, #8895

@scabug
Copy link
Author

scabug commented Nov 11, 2016

@SethTisue said:
It's difficult to be sure unless/until a thorough investigation takes place, but suggest I we close this as a duplicate of #5252. (It's worthwhile to have the additional test case, though.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant