-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Cut dependencies on future modules #5830
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
Conversation
The remaining test failures look like this:
The osgi tests all pass if this access to --- a/src/reflect/scala/reflect/internal/SymbolTable.scala
+++ b/src/reflect/scala/reflect/internal/SymbolTable.scala
@@ -138,7 +138,8 @@ abstract class SymbolTable extends macros.Universe
/** Dump each symbol to stdout after shutdown.
*/
- final val traceSymbolActivity = System.getProperty("scalac.debug.syms") != null
+ final val traceSymbolActivity = sys.props contains "scalac.debug.syms"
object traceSymbols extends {
val global: SymbolTable.this.type = SymbolTable.this
} with util.TraceSymbolActivity |
I'm looking into this one, I think I'm getting somewhere. |
Thanks! Re: osgi, does this have something to do with osgi enforcing boundaries and somehow the dependency on scala.sys was inferred and not explicitly specified? |
No, I don't think it has to do with osgi itself, but with the classloader type used in runtime reflection. It seems to be specific to package objects. I'll figure it out I think. |
Na klar! |
Finally figured it out... Your thorough work removed each and every dependency from scala-reflect to
|
Now this is really weird: the $ cat Test.scala
object Test {
def main(args: Array[String]) {
new Thread(new Runnable {
def run = { Thread.sleep(1000); println("hi") }
}).start
}
}
$ scalac12 Test.scala
$ time scala12 Test.scala
hi
/Users/luc/scala/scala-2.12/bin/scala Test.scala 0.77s user 0.09s system 42% cpu 2.042 total
$ time ../build/quick/bin/scala Test
../build/quick/bin/scala Test 0.68s user 0.13s system 103% cpu 0.780 total
$ [edit]: not so weird after all, see comment below: #5830 (review) |
@@ -101,5 +101,5 @@ class MainGenericRunner { | |||
} | |||
|
|||
object MainGenericRunner extends MainGenericRunner { | |||
def main(args: Array[String]): Unit = if (!process(args)) sys.exit(1) | |||
def main(args: Array[String]): Unit = System.exit(if (process(args)) 0 else 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This changes behavior.. if process
is true, we should not call exit
. Otherwise this will kill the application without waiting for spawned non-daemon threads to finish. https://github.com/scala/scala/blob/v2.12.1/test/files/run/lazy-concurrent.scala is an example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ouch! My bad :-/
Green now! |
I'll squash some of the smaller commits into one to make them fewer. |
Since we no longer want to depend on `sys.error`, the compiler also shouldn't generate calls to it. This also fixes the OSGI tests. The failure was interesting: once there were no more refernces to `scala.sys` left in scala-reflect, the dependency on that package disappeared from scala-reflect.jar's MANIFEST.MF. When instantiating scala.reflect.runtime.universe through an osgi classloader, `getPackageObject("scala.sys")` in definitions failed becasue the package could not be found through that classloader.
`scala.concurrent`, `scala.Console`, `scala.compat._`, `sys.runtime`, `sys.addShutdownHook`, `sys.allThreads`, `sys.env`. Also fixes a test reducing references to static modules (Console, Predef) delays initialization of object `NoStackTrace`. In `t2318`, this may now happen *after* the security manager is installed. Therefore the security manager needs to allow reading the system property `scala.control.noTraceSuppression`
Use `throw new RuntimeException` (or a subclass) instead.
In scala/scala#5830, the definition of `Sys_error` was removed from `Definitions.scala`. This commit reintroduces it in our own codebase, as a quickfix to scala-js#2880. This will need to be revisited as part of scala-js#2876 not use `sys.error` at all, but that is less urgent.
In scala/scala#5830, the definition of `Sys_error` was removed from `Definitions.scala`. This commit reintroduces it in our own codebase, as a quickfix to scala-js#2880. This will need to be revisited as part of scala-js#2876 not use `sys.error` at all, but that is less urgent.
In scala/scala#5830, the definition of `Sys_error` was removed from `Definitions.scala`. This commit reintroduces it in our own codebase, as a quickfix to scala-js#2880. This will need to be revisited as part of scala-js#2876 not use `sys.error` at all, but that is less urgent.
Re-submission of #5677