Aladdin - Scala Bugtracking
[#767] project: compiler priority: low category: bug
submitter assigned to status date submitted
Nikolay Martin fixed 2006-10-06 11:27:26.0
subject [contrib #218] nullpointer exception
code
abstract class AbsCell {
    type T = Node
    val init: T
    private var value: T = init
    def get: T = value
    def set (x: T): unit = { value = x }
    
    class Node {
        val foo = 1
    }
}

object inner {
    def main(args: Array[String]): Unit = {
        val cell = new AbsCell { val init = new Node() }
        cell.set(new cell.type#T()) // nullpointer exception
    }
}
what happened
Exception in thread "main" java.lang.NullPointerException
        at scala.tools.nsc.transform.Erasure$Eraser.adaptMember(Erasure.scala:310)
        at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:367)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1777)
        at scala.tools.nsc.typechecker.Typers$Typer.typedArg(Typers.scala:1036)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$53.apply(Typers.scala:1068)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$53.apply(Typers.scala:1067)
        at scala.List$.map2(List.scala:265)
        at scala.tools.nsc.typechecker.Typers$Typer.typedApply(Typers.scala:1067)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:1650)
        at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:367)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1777)
        at scala.tools.nsc.typechecker.Typers$Typer.typedBlock(Typers.scala:896)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:1479)
        at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:367)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1777)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1810)
        at scala.tools.nsc.typechecker.Typers$Typer.transformedOrTyped(Typers.scala:1844)
        at scala.tools.nsc.typechecker.Typers$Typer.typedDefDef(Typers.scala:837)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:1455)
        at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:367)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1777)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1804)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$48.apply(Typers.scala:1012)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$48.apply(Typers.scala:1001)
        at scala.List$.loop$0(List.scala:232)
        at scala.List$.mapConserve(List.scala:249)
        at scala.List$.loop$0(List.scala:236)
        at scala.List$.mapConserve(List.scala:249)
        at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:1001)
        at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:708)
        at scala.tools.nsc.typechecker.Typers$Typer.typedClassDef(Typers.scala:636)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:1446)
        at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:367)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1777)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1804)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$48.apply(Typers.scala:1012)
        at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$48.apply(Typers.scala:1001)
        at scala.List$.loop$0(List.scala:232)
        at scala.List$.mapConserve(List.scala:249)
        at scala.List$.loop$0(List.scala:236)
        at scala.List$.mapConserve(List.scala:249)
        at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:1001)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:1442)
        at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:367)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1777)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:1804)
        at scala.tools.nsc.transform.Erasure$ErasureTransformer$$anonfun$21.apply(Erasure.scala:652)
        at scala.tools.nsc.transform.Erasure$ErasureTransformer$$anonfun$21.apply(Erasure.scala:649)
        at scala.tools.nsc.symtab.SymbolTable.atPhase(SymbolTable.scala:71)
        at scala.tools.nsc.transform.Erasure$ErasureTransformer.transform(Erasure.scala:649)
        at scala.tools.nsc.ast.Trees$Transformer.transformUnit(Trees.scala:1059)
        at scala.tools.nsc.transform.Transform$Phase.apply(Transform.scala:26)
        at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:220)
        at scala.tools.nsc.Global$GlobalPhase$$anonfun$1.apply(Global.scala:209)
        at scala.tools.nsc.Global$GlobalPhase$$anonfun$1.apply(Global.scala:209)
        at scala.Iterator$class.foreach(Iterator.scala:304)
        at scala.collection.mutable.ListBuffer$$anon$0.foreach(ListBuffer.scala:216)
        at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:209)
        at scala.tools.nsc.Global$Run.compileSources(Global.scala:471)
        at scala.tools.nsc.Global$Run.compile(Global.scala:535)
        at scala.tools.nsc.Main$.process(Main.scala:76)
        at scala.tools.nsc.Main$.main(Main.scala:98)
        at scala.tools.nsc.Main.main(Main.scala)
what expected no crash
[back to overview]
Changes of this bug report
Nikolay  edited on  2006-10-06 11:28:11.0
Transferred from the contributions and assigned to Martin
Martin  edited on  2006-10-06 16:50:02.0