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

REPL :require command with directory crashes the interpreter #9405

Closed
scabug opened this issue Jul 17, 2015 · 2 comments
Closed

REPL :require command with directory crashes the interpreter #9405

scabug opened this issue Jul 17, 2015 · 2 comments
Labels
Milestone

Comments

@scabug
Copy link

scabug commented Jul 17, 2015

user@debian:~/projects/test$ scala
Welcome to Scala version 2.11.7 (OpenJDK 64-Bit Server VM, Java 1.7.0_79).
Type in expressions to have them evaluated.
Type :help for more information.

scala> :require application.jar
Added '/home/user/projects/test/application.jar' to classpath.

scala> :quit
user@debian:~/projects/test$ mkdir tmp
user@debian:~/projects/test$ cd tmp
user@debian:~/projects/test/tmp$ jar xf ../application.jar
user@debian:~/projects/test/tmp$ cd ..
user@debian:~/projects/test$ scala
Welcome to Scala version 2.11.7 (OpenJDK 64-Bit Server VM, Java 1.7.0_79).
Type in expressions to have them evaluated.
Type :help for more information.

scala> :require tmp
java.lang.AssertionError: assertion failed: 
  
     while compiling: <console>
        during phase: globalPhase=terminal, enteringPhase=parser
     library version: version 2.11.7
    compiler version: version 2.11.7
  reconstructed args: 

  last tree to typer: TypeTree(class Byte)
       tree position: line 6 of <console>
            tree tpe: Byte
              symbol: (final abstract) class Byte in package scala
   symbol definition: final abstract class Byte extends AnyVal (a ClassSymbol)
      symbol package: scala
       symbol owners: class Byte
           call site: object $eval in package $line2 in package $line2

<Cannot read source file>
	at scala.tools.nsc.Global$$anonfun$scala$tools$nsc$Global$$mergeNewEntries$2$$anonfun$14.apply(Global.scala:997)
	at scala.tools.nsc.Global$$anonfun$scala$tools$nsc$Global$$mergeNewEntries$2.apply(Global.scala:995)
	at scala.tools.nsc.Global$$anonfun$scala$tools$nsc$Global$$mergeNewEntries$2.apply(Global.scala:993)
	at scala.collection.Iterator$class.foreach(Iterator.scala:742)
	at scala.collection.AbstractIterator.foreach(Iterator.scala:1194)
	at scala.collection.IterableLike$class.foreach(IterableLike.scala:72)
	at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
	at scala.tools.nsc.Global.scala$tools$nsc$Global$$mergeNewEntries(Global.scala:993)
	at scala.tools.nsc.Global.invalidateClassPathEntries(Global.scala:934)
	at scala.tools.nsc.Global.extendCompilerClassPath(Global.scala:867)
	at scala.tools.nsc.interpreter.IMain.addUrlsToClassPath(IMain.scala:258)
	at scala.tools.nsc.interpreter.ILoop.require(ILoop.scala:654)
	at scala.tools.nsc.interpreter.ILoop$$anonfun$standardCommands$13.apply(ILoop.scala:221)
	at scala.tools.nsc.interpreter.ILoop$$anonfun$standardCommands$13.apply(ILoop.scala:221)
	at scala.tools.nsc.interpreter.LoopCommands$LineCmd.apply(LoopCommands.scala:62)
	at scala.tools.nsc.interpreter.ILoop.colonCommand(ILoop.scala:701)
	at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:692)
	at scala.tools.nsc.interpreter.ILoop.processLine(ILoop.scala:404)
	at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:424)
	at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply$mcZ$sp(ILoop.scala:925)
	at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:911)
	at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:911)
	at scala.reflect.internal.util.ScalaClassLoader$.savingContextLoader(ScalaClassLoader.scala:97)
	at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:911)
	at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:74)
	at scala.tools.nsc.MainGenericRunner.run$1(MainGenericRunner.scala:87)
	at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:98)
	at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:103)
	at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)

That entry seems to have slain the compiler.  Shall I replay
your session? I can re-run each line except the last one.
[y/n]
Abandoning crashed session.

scala> :quit
@scabug
Copy link
Author

scabug commented Jul 17, 2015

Imported From: https://issues.scala-lang.org/browse/SI-9405?orig=1
Reporter: @rjolly
Affected Versions: 2.11.7

@som-snytt
Copy link

➜  snips cat MyC.scala

package myp

class MyC
➜  snips scalac -d mine.jar MyC.scala
➜  snips scala
Welcome to Scala 2.13.3 (OpenJDK 64-Bit Server VM, Java 14.0.1).
Type in expressions for evaluation. Or try :help.

scala> :require mine.jar
Added '/Users/andrew/snips/mine.jar' to classpath.

scala> new myp.MyC
val res0: myp.MyC = myp.MyC@2152ab30

scala> 
:quit
➜  snips mkdir mine
➜  snips cd mine ; jar xf ../mine.jar ; cd ..
~/snips/mine
➜  snips scala
Welcome to Scala 2.13.3 (OpenJDK 64-Bit Server VM, Java 14.0.1).
Type in expressions for evaluation. Or try :help.

scala> :require mine
Added '/Users/andrew/snips/mine' to classpath.

scala> new myp.MyC
val res0: myp.MyC = myp.MyC@60a19573

scala> 

Confirmed broken in 2.11, progressed in 2.12.

@SethTisue SethTisue modified the milestones: Backlog, 2.12.13, 2.12.0 Oct 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants