scala / bug

Scala 2 bug reports only. Please, no questions — proper bug reports only.
https://scala-lang.org
232 stars 21 forks source link

Complier crash with mixed Java/Scala - Scala class implementing Java interface #946

Closed scabug closed 13 years ago

scabug commented 16 years ago

Simple example ...

JInterface.java,

public interface JInterface {
  public void foo();
}

SClass.scala,

class SClass extends JInterface {
  override def foo() = println("foo")
}

When compiled together with 2.7.1.r15121-b20080521010055,

miles@frege:java-scala$$ scalac JInterface.java SClass.scala
[`public'][`interface'][id(JInterface)][`{'][`public'][`void'][id(foo)][`('][`)'][;][`}'][eof][eof][eof]Exception in thread "main" java.util.NoSuchElementException: head of empty list
        at scala.Nil$$.head(List.scala:1346)
        at scala.Nil$$.head(List.scala:1343)
        at scala.tools.nsc.typechecker.Typers$$Typer.parentTypes(Typers.scala:883)
        at scala.tools.nsc.typechecker.Namers$$Namer.templateSig(Namers.scala:532)
        at scala.tools.nsc.typechecker.Namers$$Namer.classSig(Namers.scala:557)
        at scala.tools.nsc.typechecker.Namers$$Namer.typeSig(Namers.scala:824)
        at scala.tools.nsc.typechecker.Namers$$Namer$$$$anonfun$$typeCompleter$$1.apply(Namers.scala:409)
        at scala.tools.nsc.typechecker.Namers$$Namer$$$$anonfun$$typeCompleter$$1.apply(Namers.scala:407)
        at scala.tools.nsc.typechecker.Namers$$$$anon$$1.complete(Namers.scala:1009)
        at scala.tools.nsc.symtab.Symbols$$Symbol.info(Symbols.scala:508)
        at scala.tools.nsc.symtab.Symbols$$Symbol.initialize(Symbols.scala:622)
        at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:2993)
        at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3274)
        at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3311)
        at scala.tools.nsc.typechecker.Typers$$Typer.typedStat$$1(Typers.scala:1548)
        at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$19.apply(Typers.scala:1593)
        at scala.tools.nsc.typechecker.Typers$$Typer$$$$anonfun$$19.apply(Typers.scala:1593)
        at scala.List$$.loop$$1(List.scala:293)
        at scala.List$$.mapConserve(List.scala:310)
        at scala.tools.nsc.typechecker.Typers$$Typer.typedStats(Typers.scala:1593)
        at scala.tools.nsc.typechecker.Typers$$Typer.typed1(Typers.scala:2999)
        at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3274)
        at scala.tools.nsc.typechecker.Typers$$Typer.typed(Typers.scala:3311)
        at scala.tools.nsc.typechecker.Analyzer$$typerFactory$$$$anon$$2.apply(Analyzer.scala:40)
        at scala.tools.nsc.Global$$GlobalPhase.applyPhase(Global.scala:262)
        at scala.tools.nsc.Global$$GlobalPhase$$$$anonfun$$run$$1.apply(Global.scala:243)
        at scala.tools.nsc.Global$$GlobalPhase$$$$anonfun$$run$$1.apply(Global.scala:243)
        at scala.Iterator$$class.foreach(Iterator.scala:395)
        at scala.collection.mutable.ListBuffer$$$$anon$$1.foreach(ListBuffer.scala:266)
        at scala.tools.nsc.Global$$GlobalPhase.run(Global.scala:243)
        at scala.tools.nsc.Global$$Run.compileSources(Global.scala:562)
        at scala.tools.nsc.Global$$Run.compile(Global.scala:647)
        at scala.tools.nsc.Main$$.process(Main.scala:84)
        at scala.tools.nsc.Main$$.main(Main.scala:98)
        at scala.tools.nsc.Main.main(Main.scala)
scabug commented 16 years ago

Imported From: https://issues.scala-lang.org/browse/SI-946?orig=1 Reporter: @milessabin

scabug commented 16 years ago

@dragos said: Works in r15169.