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
Cannot compile java.lang.{Throwable,CloneNotSupportedException,InterruptedException} anymore #8367
Comments
Imported From: https://issues.scala-lang.org/browse/SI-8367?orig=1
|
@adriaanm said:
BTW, finding this commit is easy with git bisect and our own tooling (https://github.com/retronym/libscala, https://github.com/adriaanm/binfu/blob/master/scalac-head): ~/ $ RUNNER=scalac scala-hash v2.11.0-M8 /Users/adriaan/Desktop/Bugs/t8367.scala
~/ $ RUNNER=scalac scala-hash v2.11.0-RC1 /Users/adriaan/Desktop/Bugs/t8367.scala
/Users/adriaan/Desktop/Bugs/t8367.scala:3: error: self constructor arguments cannot reference unconstructed `this`
class Throwable(s: String, private var e: Throwable) extends Object with java.io.Serializable {
^
/Users/adriaan/Desktop/Bugs/t8367.scala:62: error: self constructor arguments cannot reference unconstructed `this`
class CloneNotSupportedException(s: String) extends Exception(s) {
^
/Users/adriaan/Desktop/Bugs/t8367.scala:66: error: self constructor arguments cannot reference unconstructed `this`
class InterruptedException(s: String) extends Exception(s) {
^
three errors found
[ master $%> ] scala/ $ g bisect start
[ master $%|BISECTING> ] scala/ $ g bisect good v2.11.0-M8
[ master $%|BISECTING> ] scala/ $ g bisect bad v2.11.0-RC1
[ (ed4ae1d359...) $%|BISECTING ] scala/ $ g bisect run scalac-head /Users/adriaan/Desktop/Bugs/t8367.scala
[...]
51b16e421ddd4e6c7e90ba945addf39ffcb4fa41 is the first bad commit
commit 51b16e421ddd4e6c7e90ba945addf39ffcb4fa41
Author: Eugene Burmako <xeno.by@gmail.com>
Date: Tue Jan 28 11:29:28 2014 +0300
SI-8192 adds ClassSymbol.isPrimaryConstructor
|
@adriaanm said: |
@adriaanm said: package java.lang
// SI-8367 shows something is wrong with primaryConstructor and it was made worse with the fix for SI-8192
// perhaps primaryConstructor should not return NoSymbol when isJavaDefined
// or, perhaps isJavaDefined should be refined (the package definition above is pretty sneaky)
// also, why does this only happen for a (scala-defined!) class with this special name?
// (there are a couple of others: CloneNotSupportedException,InterruptedException)
class Throwable
// class CloneNotSupportedException
// class InterruptedException yields RUNNER=scalac scala-hash v2.11.0-RC1 /Users/adriaan/Desktop/Bugs/t8367.scala -Xprint:typer
/Users/adriaan/Desktop/Bugs/t8367.scala:10: error: self constructor arguments cannot reference unconstructed `this`
// class InterruptedException
^
[[syntax trees at end of typer]] // t8367.scala
package java.lang {
class Throwable extends scala.AnyRef {
def <init>(): Throwable = {
Throwable.super.<init>();
()
}
}
}
one error found wait, what? my comment has a type error!? |
@xeno-by said: |
@adriaanm said: |
@adriaanm said: |
@adriaanm said: |
@gkossakowski said:
libscala has |
@xeno-by said: |
@retronym said:
Regarding "why does this only happen for a (scala-defined!) class with this special name?", I believe this is because the compiler forces loading of those symbols from the Java class-files during typechecking, e.g. with: // TreeInfo.scala
private def isSimpleThrowable(tp: Type): Boolean = tp match {
case TypeRef(pre, sym, args) =>
(pre == NoPrefix || pre.widen.typeSymbol.isStatic) &&
(sym isNonBottomSubClass ThrowableClass) && /* bq */ !sym.isTrait
case _ =>
false
} |
@retronym said: |
@sjrd said: |
@adriaanm said: |
Scala 2.11.0-RC1 exhibits absurd errors while compiling classes named java.lang.Throwable, java.lang.CloneNotSupportedException and java.lang.InterruptedException (yes, these 3, all others work fine). It used to be compilable in 2.10 and until 2.11.0-M8.
The following source "minimizes" the problem, but with enough meat to show that other classes of exceptions do work. Keeping only either of the three broken classes still produces the error.
Compiling the following with Scala 2.11.0-RC1 (just Scala, no need to have the Scala.js plugin to break it):
produces the following 3 absurd errors:
It worked fine with 2.11.0-M8.
If you want to reproduce in the context of Scala.js, you can clone the branch scala-2.11.0-RC1 in my fork:
https://github.com/sjrd/scala-js/tree/scala-2.11.0-RC1
and in sbt:
I want to stress that this is a blocker for Scala.js. I just can't build Scala.js for RC1.
The text was updated successfully, but these errors were encountered: