This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Compiler NPE with import Ordering.Implicits._

2 replies
Naftoli Gugenheim
Joined: 2008-12-17,
User offline. Last seen 42 years 45 weeks ago.
Has anyone seen import Ordering.Implicits._ cause a compile-time NullPointerException? I'm using sbt (0.11.2) and even last doesn't show a stack trace; all that I see is:
[debug]         /home/naftoli/dev/chavrusa/ivr/src/main/scala/chavrusa/ivr/AgiMain.scala java.lang.NullPointerException[error] {file:/home/naftoli/dev/chavrusa/}chavrusa-ivr/compile:compile: java.lang.NullPointerException[error] Total time: 1 s, completed Dec 14, 2011 8:05:57 PM
Specifying the implicit methods by name (even both) eliminated it, but with the underscore I got an NPE even when the code using it was commented out. Here's the immediately surrounding code:


    var done = false    concurrent.ops spawn {      val cal = Calendar.getInstance
      while (!done) {        val startTime = System.currentTimeMillis()         cal.setTimeInMillis(startTime)        println("Current time is "+cal.toString)        Util.nextWeekday(cal)        import Ordering.Implicits._        /*val (hr, min) = (cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE)) match {           case tuple if tuple <= (14, 0) || tuple >= (21, 0) => (14, 0) // before lunch or after supper -> lunchtime          case tuple if tuple >= (14, 30) && tuple <= (20, 0) => (20, 0) // between lunch and supper -> suppertime           case tuple => tuple        }        cal.set(Calendar.HOUR_OF_DAY, hr)        cal.set(Calendar.MINUTE, min)*/        val nextTime = cal.getTimeInMillis()         println("Waiting until "+cal.toString)        Iterator continually System.currentTimeMillis takeWhile (_ < nextTime) foreach { t => Thread.sleep((nextTime - t) / 2) }        println("Finished waiting at "+cal.toString)         sched.run        Thread.sleep(60000 - (System.currentTimeMillis - startTime))      }    }
Jason Zaugg
Joined: 2009-05-18,
User offline. Last seen 38 weeks 5 days ago.
Re: Compiler NPE with import Ordering.Implicits._
On Thu, Dec 15, 2011 at 11:11 AM, Naftoli Gugenheim <naftoligug@gmail.com> wrote:
Has anyone seen import Ordering.Implicits._ cause a compile-time NullPointerException? I'm using sbt (0.11.2) and even last doesn't show a stack trace; all that I see is:
[debug]         /home/naftoli/dev/chavrusa/ivr/src/main/scala/chavrusa/ivr/AgiMain.scala java.lang.NullPointerException[error] {file:/home/naftoli/dev/chavrusa/}chavrusa-ivr/compile:compile: java.lang.NullPointerException[error] Total time: 1 s, completed Dec 14, 2011 8:05:57 PM

Did you try `last compile`? I would be surprised if you don't see the full compiler stack trace.
-jason 
Naftoli Gugenheim
Joined: 2008-12-17,
User offline. Last seen 42 years 45 weeks ago.
Re: Compiler NPE with import Ordering.Implicits._
Nope!
> ~compile[info] Compiling 1 Scala source to /home/naftoli/dev/chavrusa/ivr/target/scala-2.9.1/classes...[error] {file:/home/naftoli/dev/chavrusa/}chavrusa-ivr/compile:compile: java.lang.NullPointerException [error] Total time: 2 s, completed Dec 14, 2011 8:20:51 PM1. Waiting for source changes... (press enter to interrupt)
> last comcommands         compile          compile-inputs   compile-order    compile:         compilers > last como{invalid input}> last compilechavrusa-common/compile:compile[debug] [debug] Initial source changes: [debug]         removed:Set() [debug]         added: Set()[debug]         modified: Set()[debug] Removed products: Set()[debug] Modified external sources: Set()[debug] Modified binary dependencies: Set() [debug] Initial directly invalidated sources: Set()[debug] [debug] Sources indirectly invalidated by:[debug]         product: Set()[debug]         binary dep: Set() [debug]         external source: Set()[debug] Initially invalidated: Set(){file:/home/naftoli/dev/scheduler/}default-1da6c9/compile:compile[debug] [debug] Initial source changes:  [debug]         removed:Set()[debug]         added: Set()[debug]         modified: Set()[debug] Removed products: Set()[debug] Modified external sources: Set()[debug] Modified binary dependencies: Set() [debug] Initial directly invalidated sources: Set()[debug] [debug] Sources indirectly invalidated by:[debug]         product: Set()[debug]         binary dep: Set() [debug]         external source: Set()[debug] Initially invalidated: Set()chavrusa-ivr/compile:compile[debug] [debug] Initial source changes: [debug]         removed:Set() [debug]         added: Set()[debug]         modified: Set(/home/naftoli/dev/chavrusa/ivr/src/main/scala/chavrusa/ivr/AgiMain.scala)[debug] Removed products: Set()[debug] Modified external sources: Set() [debug] Modified binary dependencies: Set()[debug] Initial directly invalidated sources: Set(/home/naftoli/dev/chavrusa/ivr/src/main/scala/chavrusa/ivr/AgiMain.scala)[debug] [debug] Sources indirectly invalidated by: [debug]         product: Set()[debug]         binary dep: Set()[debug]         external source: Set()[debug] Initially invalidated: Set(/home/naftoli/dev/chavrusa/ivr/src/main/scala/chavrusa/ivr/AgiMain.scala) [info] Compiling 1 Scala source to /home/naftoli/dev/chavrusa/ivr/target/scala-2.9.1/classes...[debug] Interfacing (CompilerInterface) with Scala compiler version 2.9.1.final[debug] Calling Scala compiler with arguments  (CompilerInterface): [debug]         -deprecation[debug]         -d[debug]         /home/naftoli/dev/chavrusa/ivr/target/scala-2.9.1/classes[debug]         -bootclasspath[debug]         /usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/resources.jar:/usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/rt.jar:/usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/jsse.jar:/usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/jce.jar:/usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/charsets.jar:/usr/lib/jvm/java-6-sun-1.6.0.26/jre/lib/modules/jdk.boot.jar:/usr/lib/jvm/java-6-sun-1.6.0.26/jre/classes:/home/naftoli/dev/jrebel/jrebel.jar:/home/naftoli/.sbt/boot/scala-2.9.1/lib/scala-library.jar [debug]         -classpath[debug]         /home/naftoli/dev/chavrusa/ivr/target/scala-2.9.1/classes:/home/naftoli/dev/chavrusa/common/target/scala-2.9.1/classes:/home/naftoli/dev/scheduler/target/scala-2.9.1/classes:/home/naftoli/.ivy2/cache/net.liftweb/lift-mapper_2.9.1/jars/lift-mapper_2.9.1-2.4-SNAPSHOT.jar:/home/naftoli/.ivy2/cache/net.liftweb/lift-db_2.9.1/jars/lift-db_2.9.1-2.4-SNAPSHOT.jar:/home/naftoli/.ivy2/cache/net.liftweb/lift-util_2.9.1/jars/lift-util_2.9.1-2.4-SNAPSHOT.jar:/home/naftoli/.ivy2/cache/joda-time/joda-time/jars/joda-time-1.6.2.jar:/home/naftoli/.ivy2/cache/javax.mail/mail/jars/mail-1.4.4.jar:/home/naftoli/.ivy2/cache/javax.activation/activation/jars/activation-1.1.jar:/home/naftoli/.ivy2/cache/commons-codec/commons-codec/jars/commons-codec-1.4.jar:/home/naftoli/.ivy2/cache/nu.validator.htmlparser/htmlparser/jars/htmlparser-1.2.1.jar:/home/naftoli/.ivy2/cache/net.liftweb/lift-actor_2.9.1/jars/lift-actor_2.9.1-2.4-SNAPSHOT.jar:/home/naftoli/.ivy2/cache/net.liftweb/lift-common_2.9.1/jars/lift-common_2.9.1-2.4-SNAPSHOT.jar:/home/naftoli/.ivy2/cache/org.slf4j/slf4j-api/jars/slf4j-api-1.6.1.jar:/home/naftoli/.ivy2/cache/net.liftweb/lift-json_2.9.1/jars/lift-json_2.9.1-2.4-SNAPSHOT.jar:/home/naftoli/.ivy2/cache/com.thoughtworks.paranamer/paranamer/jars/paranamer-2.3.jar:/home/naftoli/.ivy2/cache/org.scala-lang/scalap/jars/scalap-2.9.1.jar:/home/naftoli/.sbt/boot/scala-2.9.1/lib/scala-compiler.jar:/home/naftoli/.ivy2/cache/net.liftweb/lift-proto_2.9.1/jars/lift-proto_2.9.1-2.4-SNAPSHOT.jar:/home/naftoli/.ivy2/cache/net.liftweb/lift-webkit_2.9.1/jars/lift-webkit_2.9.1-2.4-SNAPSHOT.jar:/home/naftoli/.ivy2/cache/commons-fileupload/commons-fileupload/jars/commons-fileupload-1.2.2.jar:/home/naftoli/.ivy2/cache/com.h2database/h2/jars/h2-1.2.147.jar:/home/naftoli/.ivy2/cache/org.apache.derby/derby/jars/derby-10.7.1.1.jar:/home/naftoli/.ivy2/cache/log4j/log4j/bundles/log4j-1.2.16.jar:/home/naftoli/.ivy2/cache/org.slf4j/slf4j-log4j12/jars/slf4j-log4j12-1.6.1.jar:/home/naftoli/.ivy2/cache/org.scalatest/scalatest_2.9.1/jars/scalatest_2.9.1-1.6.1.jar:/home/naftoli/.ivy2/cache/org.freeswitch.esl.client/org.freeswitch.esl.client/jars/org.freeswitch.esl.client-0.9.2.jar:/home/naftoli/.ivy2/cache/org.jboss.netty/netty/bundles/netty-3.2.1.Final.jar:/home/naftoli/.ivy2/cache/org.asteriskjava/asterisk-java/jars/asterisk-java-1.0.0.CI-SNAPSHOT.jar [debug]         /home/naftoli/dev/chavrusa/ivr/src/main/scala/chavrusa/ivr/AgiMain.scalajava.lang.NullPointerException[error] {file:/home/naftoli/dev/chavrusa/}chavrusa-ivr/compile:compile: java.lang.NullPointerException

On Wed, Dec 14, 2011 at 8:15 PM, Jason Zaugg <jzaugg@gmail.com> wrote:
On Thu, Dec 15, 2011 at 11:11 AM, Naftoli Gugenheim <naftoligug@gmail.com> wrote:
Has anyone seen import Ordering.Implicits._ cause a compile-time NullPointerException? I'm using sbt (0.11.2) and even last doesn't show a stack trace; all that I see is:
[debug]         /home/naftoli/dev/chavrusa/ivr/src/main/scala/chavrusa/ivr/AgiMain.scala java.lang.NullPointerException[error] {file:/home/naftoli/dev/chavrusa/}chavrusa-ivr/compile:compile: java.lang.NullPointerException[error] Total time: 1 s, completed Dec 14, 2011 8:05:57 PM

Did you try `last compile`? I would be surprised if you don't see the full compiler stack trace.
-jason 

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland