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

backend crash if a file references both None and None$.MODULE$ #8105

Closed
scabug opened this issue Dec 27, 2013 · 13 comments
Closed

backend crash if a file references both None and None$.MODULE$ #8105

scabug opened this issue Dec 27, 2013 · 13 comments

Comments

@scabug
Copy link

scabug commented Dec 27, 2013

I'm trying to migrate from scala 2.9.3 to 2.10.3 and some of my test classes make the scala compiler crash.

I've got aConstantType(value = Constant(IllegalArgumentException)) with the following message (see the full stack trace and the maven dependencies in the attached file):

how can getCommonSuperclass() do its job if different class symbols get the same bytecode-level internal name: scala/None$
at scala.tools.nsc.backend.jvm.GenASM$JBuilder.javaName(GenASM.scala:547)

@scabug
Copy link
Author

scabug commented Dec 27, 2013

Imported From: https://issues.scala-lang.org/browse/SI-8105?orig=1
Reporter: David Bouyssie (crumbpicker)
Affected Versions: 2.10.3
Attachments:

@scabug
Copy link
Author

scabug commented Jan 2, 2014

@retronym said (edited on Jan 2, 2014 8:25:50 PM UTC):
I believe that you can workaround the problem with --Ytarget:jvm-1.5-fjbg. /cc Miguel Garcia

@scabug
Copy link
Author

scabug commented Jan 2, 2014

@magarciaEPFL said:
Just to make sure the bug is about GenASM proper (as opposed to xsbt.CachedCompiler0 or sbt.inc.IncrementalCompile$ etc) I'd compile the project just with scalac

@scabug
Copy link
Author

scabug commented Jan 3, 2014

@retronym said (edited on Jan 3, 2014 6:54:50 AM UTC):
He is compiling with Maven which uses a vanilla scalac.

@scabug
Copy link
Author

scabug commented Jan 8, 2014

David Bouyssie (crumbpicker) said:
@jason: thank you, your tip solved my problem. You saved me ;-)

However I don't understand why I have to set this flag. Is there an other workaround ?

@scabug
Copy link
Author

scabug commented Jan 8, 2014

@retronym said (edited on Jan 8, 2014 5:52:38 PM UTC):
In Scala 2.10, we introduced a new implementation of our bytecode emitter, based on the ASM library. It is enabled by default. But, as an insurance against bugs like this one, we left the old one ("FJBG") in under a flag.

In 2.11, we've removed the the FJBG backend, which means that is imperative that we understand the problem you've reported and make sure it is fixed before the release of 2.11.0.

Can you share the code (privately, if needed, I'm at jason.zaugg@typesafe.com) that triggers the bug?

@scabug
Copy link
Author

scabug commented Jan 8, 2014

@retronym said:
It would also be great if you could attached the output of mvn dependency:tree. A wild guess is that you've got two versions of scala-library.jar on the classpath.

@scabug
Copy link
Author

scabug commented Jan 8, 2014

David Bouyssie (crumbpicker) said:
Ok thanks for these details.

My code base on this project is big. So I think I'll try to create a smaller project with the pieces of code at the origin of this issue.

@scabug
Copy link
Author

scabug commented Jan 8, 2014

David Bouyssie (crumbpicker) said:
Below is the dependency tree for this project.
I set the scalaVersion property of the scala-maven-plugin to 2.10.3 to be sure but I still have this issue.
If i set the :jvm-1.5-fjbg flag I have no more issue of this kind but I have another issue which seems to be related to #7002
However I think this is another discussion.

[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ Proline-DAL ---
[INFO] fr.proline:Proline-DAL:jar:0.1.3-SNAPSHOT
[INFO] +- fr.proline.util:ProFI-Commons-Scala:jar:0.0.7-SNAPSHOT:compile
[INFO] | +- org.slf4j:slf4j-api:jar:1.7.5:compile
[INFO] | - com.fasterxml.jackson.module:jackson-module-scala_2.10:jar:2.3.0:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.3.0:compile
[INFO] | +- com.thoughtworks.paranamer:paranamer:jar:2.3:compile
[INFO] | +- com.google.code.findbugs:jsr305:jar:2.0.1:compile
[INFO] | - com.google.guava:guava:jar:13.0.1:compile
[INFO] +- fr.proline:Proline-OM:jar:0.1.3-SNAPSHOT:compile
[INFO] | +- org.apache.commons:commons-lang3:jar:3.1:compile
[INFO] | - biojava:biojava:jar:1.7:compile
[INFO] | +- biojava:bytecode:jar:1.0:compile
[INFO] | +- commons-dbcp:commons-dbcp:jar:1.1:compile
[INFO] | | +- javax.sql:jdbc-stdext:jar:2.0:compile
[INFO] | | +- xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] | | - xerces:xercesImpl:jar:2.0.2:compile
[INFO] | - commons-pool:commons-pool:jar:1.1:compile
[INFO] +- fr.proline:Proline-ORM:jar:0.1.3-SNAPSHOT:compile
[INFO] | +- org.hibernate:hibernate-entitymanager:jar:4.2.7.SP1:compile
[INFO] | | +- org.jboss.logging:jboss-logging:jar:3.1.0.GA:compile
[INFO] | | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | | +- org.javassist:javassist:jar:3.18.1-GA:compile
[INFO] | | +- org.hibernate:hibernate-core:jar:4.2.7.SP1:compile
[INFO] | | | - antlr:antlr:jar:2.7.7:compile
[INFO] | | +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:jar:1.0.1.Final:compile
[INFO] | | +- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Final:compile
[INFO] | | - org.hibernate.common:hibernate-commons-annotations:jar:4.0.2.Final:compile
[INFO] | +- com.h2database:h2:jar:1.3.174:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-core:jar:2.3.0:compile
[INFO] | - com.fasterxml.jackson.core:jackson-databind:jar:2.3.0:compile
[INFO] +- fr.proline:Proline-Databases:jar:0.1.3-SNAPSHOT:compile
[INFO] | +- com.googlecode.flyway:flyway-core:jar:2.2.1:compile
[INFO] | - org.slf4j:jcl-over-slf4j:jar:1.7.5:compile
[INFO] +- org.scala-lang:scala-library:jar:2.10.3:compile
[INFO] +- com.typesafe:scalalogging-slf4j_2.10:jar:1.0.1:compile
[INFO] +- postgresql:postgresql:jar:9.1-901-1.jdbc4:compile
[INFO] +- org.xerial:sqlite-jdbc:jar:3.7.2:runtime
[INFO] +- joda-time:joda-time:jar:2.3:compile
[INFO] +- org.joda:joda-convert:jar:1.5:compile
[INFO] +- com.github.jponge:lzma-java:jar:1.2:compile
[INFO] +- org.tukaani:xz:jar:1.1:compile
[INFO] +- org.xerial.snappy:snappy-java:jar:1.0.4.1:compile
[INFO] +- org.scala-tools.testing:specs_2.10:jar:1.6.9:test
[INFO] +- org.scalatest:scalatest_2.10:jar:1.9.2:test
[INFO] +- fr.proline:Proline-OM:test-jar:tests:0.1.3-SNAPSHOT:test
[INFO] +- fr.proline:Proline-Databases:test-jar:tests:0.1.3-SNAPSHOT:test
[INFO] +- org.dbunit:dbunit:jar:2.4.9:test
[INFO] | - commons-collections:commons-collections:jar:3.2.1:compile
[INFO] +- fr.proline.util:ProFI-Commons-Java:jar:0.0.5:compile
[INFO] +- junit:junit:jar:4.11:test
[INFO] | - org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- ch.qos.logback:logback-core:jar:1.0.13:test
[INFO] - ch.qos.logback:logback-classic:jar:1.0.13:test
[INFO] ------------------------------------------------------------------------

@scabug
Copy link
Author

scabug commented Jan 8, 2014

David Bouyssie (crumbpicker) said:
Finally I think that both issues are not unrelated as you can see there:
#7002
http://stackoverflow.com/questions/16560775/scala-issue-in-eclipse-error-while-loading-javax-jws-soap

Targeting the 1.5 JVM may enabled the issue #7002. So I think I'm stuck...

@scabug
Copy link
Author

scabug commented Jan 8, 2014

David Bouyssie (crumbpicker) said:
Ok removing the Jackson annotation JsonInclude solved this new issue but now the scala compiler crash is back...

@scabug
Copy link
Author

scabug commented Jan 8, 2014

@retronym said:
This bug minimized to:

class Crash {
  None; None$.MODULE$
}

This crashes under GenASM in 2.10.x and 2.11.x. It's not a high-priority to fix. I sort of wish that the second form didn't typecheck; should it?

@scabug
Copy link
Author

scabug commented Jan 25, 2016

@SethTisue said:
Let's retest once 2.12.0-M4 is out.

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

2 participants