scala-ide / scala-worksheet

A Scala IDE plugin for a multi-line REPL (called worksheet)
96 stars 24 forks source link

NPE running worksheet #178

Open skyluc opened 10 years ago

skyluc commented 10 years ago

(Reported in assembla #1002052)

This line produces an NPE:

2014-02-17 10:23:24,580 ERROR [org.eclipse.jface.text.reconciler.MonoReconciler] - System.err - Exception in thread "org.eclipse.jface.text.reconciler.MonoReconciler"
2014-02-17 10:23:24,580 ERROR [org.eclipse.jface.text.reconciler.MonoReconciler] - System.err - java.lang.NullPointerException
2014-02-17 10:23:24,581 ERROR [org.eclipse.jface.text.reconciler.MonoReconciler] - System.err - at org.scalaide.worksheet.ScriptCompilationUnit.scalaProject$lzycompute(ScriptCompilationUnit.scala:33)
2014-02-17 10:23:24,581 ERROR [org.eclipse.jface.text.reconciler.MonoReconciler] - System.err - at org.scalaide.worksheet.ScriptCompilationUnit.scalaProject(ScriptCompilationUnit.scala:33)
2014-02-17 10:23:24,581 ERROR [org.eclipse.jface.text.reconciler.MonoReconciler] - System.err - at org.scalaide.worksheet.ScriptCompilationUnit.reconcile(ScriptCompilationUnit.scala:71)
2014-02-17 10:23:24,581 ERROR [org.eclipse.jface.text.reconciler.MonoReconciler] - System.err - at org.scalaide.worksheet.reconciler.ScalaReconcilingStrategy.reconcile(ScalaReconcilingStrategy.scala:31)
2014-02-17 10:23:24,581 ERROR [org.eclipse.jface.text.reconciler.MonoReconciler] - System.err - at org.eclipse.jface.text.reconciler.MonoReconciler.process(MonoReconciler.java:77)
2014-02-17 10:23:24,581 ERROR [org.eclipse.jface.text.reconciler.MonoReconciler] - System.err - at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:206)
2014-02-17 10:23:25,119 ERROR [ForkJoinPool-1-worker-13] - System.err - WorksheetManager <actor>: caught java.lang.NullPointerException
2014-02-17 10:23:25,120 ERROR [ForkJoinPool-1-worker-13] - System.err - java.lang.NullPointerException
2014-02-17 10:23:25,120 ERROR [ForkJoinPool-1-worker-13] - System.err - at org.scalaide.worksheet.ScriptCompilationUnit.scalaProject$lzycompute(ScriptCompilationUnit.scala:33)
2014-02-17 10:23:25,120 ERROR [ForkJoinPool-1-worker-13] - System.err - at org.scalaide.worksheet.ScriptCompilationUnit.scalaProject(ScriptCompilationUnit.scala:33)
2014-02-17 10:23:25,120 ERROR [ForkJoinPool-1-worker-13] - System.err - at org.scalaide.worksheet.runtime.WorksheetsManager.org$scalaide$worksheet$runtime$WorksheetsManager$$obtainEvaluator(WorksheetsManager.scala:59)
2014-02-17 10:23:25,120 ERROR [ForkJoinPool-1-worker-13] - System.err - at org.scalaide.worksheet.runtime.WorksheetsManager$$anonfun$act$1$$anonfun$apply$1.applyOrElse(WorksheetsManager.scala:31)
2014-02-17 10:23:25,120 ERROR [ForkJoinPool-1-worker-13] - System.err - at scala.runtime.AbstractPartialFunction$mcVL$sp.apply$mcVL$sp(AbstractPartialFunction.scala:33)
2014-02-17 10:23:25,120 ERROR [ForkJoinPool-1-worker-13] - System.err - at scala.runtime.AbstractPartialFunction$mcVL$sp.apply(AbstractPartialFunction.scala:33)
2014-02-17 10:23:25,120 ERROR [ForkJoinPool-1-worker-13] - System.err - at scala.runtime.AbstractPartialFunction$mcVL$sp.apply(AbstractPartialFunction.scala:25)
2014-02-17 10:23:25,120 ERROR [ForkJoinPool-1-worker-13] - System.err - at scala.actors.ReactorTask.run(ReactorTask.scala:31)
2014-02-17 10:23:25,120 ERROR [ForkJoinPool-1-worker-13] - System.err - at scala.actors.ReactorTask.compute(ReactorTask.scala:63)
2014-02-17 10:23:25,120 ERROR [ForkJoinPool-1-worker-13] - System.err - at scala.concurrent.forkjoin.RecursiveAction.exec(RecursiveAction.java:160)
2014-02-17 10:23:25,120 ERROR [ForkJoinPool-1-worker-13] - System.err - at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
2014-02-17 10:23:25,120 ERROR [ForkJoinPool-1-worker-13] - System.err - at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
2014-02-17 10:23:25,120 ERROR [ForkJoinPool-1-worker-13] - System.err - at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
2014-02-17 10:23:25,120 ERROR [ForkJoinPool-1-worker-13] - System.err - at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
skyluc commented 10 years ago

Looking at the code, it has a few ways it can throw a NoSuchElementException, but not so much NPE.

I tried with a non-workspace file, but found a different problem #179.

mrksmb commented 10 years ago

Luc,

Thanks for looking into this. I could not find anything unusual with this worksheet or product. The worksheet is located in a simple Scala project.

The only difference I noticed is that .scala files have a J icon in front of them in the Kepler Eclipse that has the problem, while my older Helios Eclipse has an S icon in front of .scala files. Both worksheets have the proper Eclipse icon in front of them and open in the Scala Script editor properly. In the Kepler preferences the Scala source code type hangs directly under the Java type. I tried to change that, but could not find out how. Uninstalling all Scala IDE components and reinstalling them did not help.

Maybe this gives you a hint.

Thanks, Markus

skyluc commented 10 years ago

Hmm. It sounds like Scala IDE is not correctly installed.

Can you check in the 'Setup Diagnostics' (`Scala > Run Setup Diagnostics' from the Scala perspective), the check box in the first block (JDT Weaving) is set and grayed out? Also, which flavor of Eclipse and other plugins are you using? It is possible that it is caused by some bad interaction.

mrksmb commented 10 years ago

That is really interesting. I had run the diagnostics a couple times before, but when I ran it now and tested the spreadsheet again right after, the inline comments got added properly, like in the Helios IDE.

I am using a regular Eclipse:

Eclipse Standard/SDK Version: Kepler Service Release 1 Build id: 20130919-0819

with Scala, PHP, and Java development tools added.

So I guess for me the issue is fixed now and the NullPointerException does not occur in the log file anymore.

skyluc commented 10 years ago

I tried to reproduce your environment to reproduce the problem, but no luck.

When you have some time, it would great if you could create a second install of Eclipse, install the worksheet, and see if it works out-of-the-box.