scala script problems after class rename

Hi,

I get problems with executing (simple) Scala scripts after the imported class is renamed. One of the scripts (script.scala) only has a println in it, the other (Test_totaliseer.scala) imports the class Totaliseer and uses a method (som) of it.
The configuration is that of a Scala Script with no tasks before launch.

Initially it works, but after I rename the class and I check that the refactoring in the visible code is done, I cannot execute the scripts anymore. Error "error running script; Scala script not found" as a red popup from the Run view.

I remove the configurations, restart the IDE, make new configurations and it still doesn't work. I reload another project, execute a script (no errors) and witch back to the original project. I execute the simple println script and that one runs.
Then I execute the one with the imported class and it reports this error

/home/chris/IdeaProjects/scala/test2/src/mypackage/Test_totaliseer.scala:1: error: not found: value mypackage
import mypackage.Totaliseer
       ^
/home/chris/IdeaProjects/scala/test2/src/mypackage/Test_totaliseer.scala:3: error: not found: type Totaliseer
val tot = new Totaliseer

Apperently there is some cache that still holds the old class name.

Update: I just noted that an Application configuration (Summer) is changed to a Scala Script configuration, pointing to the class I just renamed. I reinstall it as an Application and run it: error is "Exception in thread "main" java.lang.ClassNotFoundException" while it ran perfectly after I created this new project.

I created this whole new project from scratch because I have had these problems before. Every script has run without errors.
I run IDEA Ultimate 133.471 with Scala plugin 0.26.357.

I think this whole Scala thing is still a bit messy. Any suggestions??

Chris



Attachment(s):
Summer.scala.zip
ChecksumAccumulator.scala.zip
Totaliseer.scala.zip
Test_totaliseer.scala.zip
script.scala.zip
2 comments
Comment actions Permalink

Update 1: some logfile information from compile Totaliseer class (nothing in log when executing Scala Scripts)

I also removed the .idea directory and the .iml file from the project and created a new one on the same directory. Again, the same errors.

Update 2: I removed the scripts completely from the project and created them again. Errors are gone now.
Compiling the class Totaliseer.scala results in errors concerning the script Test_totaliseer.scala like this one:

expected class or object definition
val tot = new Totaliseer
^

and this one again:

/usr/lib/jvm/java-1.7.0-openjdk-i386/bin/java -Denv.classpath=\"%CLASSPATH%\" -Denv.emacs=\"%EMACS%\" -Didea.launcher.port=7535 -Didea.launcher.bin.path=/home/chris/idea-IU-133.193/bin -Dfile.encoding=UTF-8 -classpath /usr/lib/jvm/java-1.7.0-openjdk-i386/jre/lib/rhino.jar:/usr/lib/jvm/java-1.7.0-openjdk-i386/jre/lib/rt.jar:/usr/lib/jvm/java-1.7.0-openjdk-i386/jre/lib/compilefontconfig.jar:/usr/lib/jvm/java-1.7.0-openjdk-i386/jre/lib/jsse.jar:/usr/lib/jvm/java-1.7.0-openjdk-i386/jre/lib/resources.jar:/usr/lib/jvm/java-1.7.0-openjdk-i386/jre/lib/charsets.jar:/usr/lib/jvm/java-1.7.0-openjdk-i386/jre/lib/jce.jar:/usr/lib/jvm/java-1.7.0-openjdk-i386/jre/lib/javazic.jar:/usr/lib/jvm/java-1.7.0-openjdk-i386/jre/lib/management-agent.jar:/usr/lib/jvm/java-1.7.0-openjdk-i386/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-1.7.0-openjdk-i386/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-1.7.0-openjdk-i386/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-1.7.0-openjdk-i386/jre/lib/ext/pulse-java.jar:/usr/lib/jvm/java-1.7.0-openjdk-i386/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-1.7.0-openjdk-i386/jre/lib/ext/java-atk-wrapper.jar:/usr/lib/jvm/java-1.7.0-openjdk-i386/jre/lib/ext/dnsns.jar:/home/chris/IdeaProjects/scala/test2/out/production/test2:/home/chris/scala-2.10.3/lib/scala-library.jar:/home/chris/scala-2.10.3/lib/scala-swing.jar:/home/chris/scala-2.10.3/lib/scala-actors.jar:/home/chris/scala-2.10.3/lib/scala-compiler.jar:/home/chris/scala-2.10.3/lib/scala-reflect.jar:/home/chris/idea-IU-133.193/lib/idea_rt.jar com.intellij.rt.execution.application.AppMain scala.tools.nsc.MainGenericRunner -nocompdaemon -classpath /usr/lib/jvm/java-1.7.0-openjdk-i386/jre/lib/rhino.jar:/usr/lib/jvm/java-1.7.0-openjdk-i386/jre/lib/rt.jar:/usr/lib/jvm/java-1.7.0-openjdk-i386/jre/lib/compilefontconfig.jar:/usr/lib/jvm/java-1.7.0-openjdk-i386/jre/lib/jsse.jar:/usr/lib/jvm/java-1.7.0-openjdk-i386/jre/lib/resources.jar:/usr/lib/jvm/java-1.7.0-openjdk-i386/jre/lib/charsets.jar:/usr/lib/jvm/java-1.7.0-openjdk-i386/jre/lib/jce.jar:/usr/lib/jvm/java-1.7.0-openjdk-i386/jre/lib/javazic.jar:/usr/lib/jvm/java-1.7.0-openjdk-i386/jre/lib/management-agent.jar:/usr/lib/jvm/java-1.7.0-openjdk-i386/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-1.7.0-openjdk-i386/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-1.7.0-openjdk-i386/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-1.7.0-openjdk-i386/jre/lib/ext/pulse-java.jar:/usr/lib/jvm/java-1.7.0-openjdk-i386/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-1.7.0-openjdk-i386/jre/lib/ext/java-atk-wrapper.jar:/usr/lib/jvm/java-1.7.0-openjdk-i386/jre/lib/ext/dnsns.jar:/home/chris/IdeaProjects/scala/test2/out/production/test2:/home/chris/scala-2.10.3/lib/scala-library.jar:/home/chris/scala-2.10.3/lib/scala-swing.jar:/home/chris/scala-2.10.3/lib/scala-actors.jar /home/chris/IdeaProjects/scala/test2/src/mypackage/Test_totaliseer.scala
/home/chris/IdeaProjects/scala/test2/src/mypackage/Test_totaliseer.scala:1: error: object Totaliseer is not a member of package mypackage
import mypackage.Totaliseer
       ^
/home/chris/IdeaProjects/scala/test2/src/mypackage/Test_totaliseer.scala:7: error: not found: type Totaliseer
val tot = new Totaliseer
              ^



Attachment(s):
build_idea.log.zip
0
Comment actions Permalink

Currenlty Scala compiler can't filter out scala scripts, because of same file extension, and we don't have Scala parser in our compiler implementation. That's why if you want scripts, you have to put them outside of source roots (then highlighting will not be usable). Or you can use Scala worksheet (we will rework it soon to be much faster).

We probably need to rework scripts with current compiler implementations, but I don't know how yet.

Best regards,
Alexander Podkhalyuzin.

0

Please sign in to leave a comment.