Scala Compiler doesn't compile in ScalaIDE - scala

I'm trying to develop on the Scala compiler project with the help of ScalaIDE. I followed this guide to set up the development environment. When I now try to build the mentioned projects, the reflect project won't get built. Instead, I get the following error via the console output:
uncaught exception during compilation: scala.reflect.internal.MissingRequirementError reflect Unknown Scala Problem
Having tried the provided ANT script of the project via the console, everything seems to work fine.
Does anyone know if I'm missing a hidden compiler flag, dependency or something like this?
Thanks!

With the IDE for Scala 2.10 you can only build the 2.10.x branch of the Scala compiler. If you want to work on master, you need to install a 2.11-based version of the IDE. We don't publicise IDE for 2.11 nightlies yet, but they are available at:
http://download.scala-ide.org/nightly/scala-ide-master-2.11.0-SNAPSHOT/

Related

Run Scala Dotty project using Intellij IDE

I created a basic Scala Dotty project using Dotty template and import the project to IntelliJ IDE.
Everything works fine when I use the sbt command line.
When I try to build or run it inside IntelliJ IDE, I got following errors:
Error:scalac: Multiple 'scala-library*.jar' files (scala-library-0.9.0-RC1.jar, scala-library-2.12.6.jar) in Scala compiler classpath in Scala SDK sbt: ch.epfl.lamp:dotty-library_0.9:0.9.0-RC1:jar
Any ideas how to solve this?
IDE support for Dotty
Currently, the only IDE we officially support is Visual Studio Code.
Anyway when you import a project to IntelliJ IDEA check "use sbt shell". At least for me after that a test project compiles and runs with Ctrl+Shift+F10.
It's possible that not everything will work. For example Dotty macros don't but if I compile and run manually then they do.

Scala compiler other than 2.12 not working in Eclipse

I just set up a Scala project in Eclipse (Oxygen 4.7.3a, on Ubuntu 18.04) with the Scala-IDE plugin (4.7.0.v-2_12-201709291352-71a28d0) with a simple HelloWorld object. If I set "Properties -> Scala Compiler" to 2.12 everything works as expected: the project compiles and runs. But if I choose any other version (for instance, "Latest 2.10 bundle (dynamic)" I get prompted to do a full rebuild (as expected) but when I go to "Project -> Build" nothing happens. If I have errors in my code, the editor underlines them, but they won't show in "Problems". If I try to run it I get a class not found error.
I get the feeling that it is not actually compiling. Any ideas on what I need to configure differently?
I finally solved it by removing openjdk-11 and installing openjdk-8. After doing that and reinstalling Eclipse and Scala-IDE everything works fine.
It would have been helpful having some feedback from Eclipse regarding what was not working. I figured it out because I tried to build with SBT and the error lead to this SO question: Failed to initialize compiler: object java.lang.Object in compiler mirror not found
I tried the update-alternatives option (also changing the Java path in eclipse.ini) but then I got the "object java.lang.Object in compiler mirror not found" error in Eclipse problems. Since I didn't need openjdk-11 anyway I simply switched to openjdk-8.

`Cannot find symbol` in IntelliJ 14

I have use the IntelliJ Scala plugin before, in 13 and 13.1. I upgraded to 14, and it doesn't work anymore for my SBT project.
For all Scala standard lib stuff, I see errors like "Cannot find symbol scala.Option".
at scala project, compiler error - Cannot resolve symbol List? says I need to have the Scala facet for my module. I looked in facets, and Scala wasn't an option.
I've uninstalled IntelliJ and the Scala plugin and my settings and the projects files multiple times, but still happens.
How do I fix this?
the new scala plugin for intellij 14 removed the facet and replaced it with Scala SDK library, see blog
for sbt project, I guess the best bet is to re-create your project by:
File -> open -> select the build.sbt of your project in popup -> delete existing project and import
I had a similar issue when a Java module calls an Scala object. The issue was from the wrong setup in Source Folders; the Scala source was in src/main/scala/..., but in the Project Structure, the Source Folders were setup as src by default. When I changed it as src/main/scala, the Java module can find the Scala object correctly.
I fixed this by using the nightly builds of the Scala plugin.
The fixes have now been incorporated into the stable versions.
In my case i just had to reload the IDE...

Intellij IDEA 13: Error compiling sbt component

I have a Maven Scala project created with archetype:
archetypeGroupId=org.scala-tools.archetypes
archetypeArtifactId=scala-archetype-simple
version=1.3
I'm getting this when trying to run a simple main method:
Error compiling sbt component 'compiler-interface-2.8.0.final-51.0'
The Maven build works fine though... I'm new to Scala so this is probably some simple problem.
The good people over at JetBrains had a solution:
Looks like this plugin is quite old and generates pom with an old
scala version. Try 2.10.0
Meant to post this sooner but I forgot about this question.

Scala plugin for IntelliJ IDEA 10 not detecting simple errors?

I know I must be missing something, but can't figure out what. When I create a scala project, following the scala-plugin instructions, not a single syntax error is detected. For example:
object MyApp {
val aNumber: Int = "hello"
}
does not detect any error. If I right-click and ask it to compile, then I get the expected type mismatch error from the scala compiler. This is just a silly example, no syntax errors are being flagged. For regular Java projects it works fine, so it must be scala specific.
I have a clean install of IDEA 10 CE on a OSX 10.6 and Scala 2.8.1 final. I have set up the jdk in the project settings as well as the scala home when creating the project. I have the latest version of the plugin (12/2010).
Any hint on what I'm missing?
You have to enable error highlighting. Turn on Settings/Code Style/Scala/Other settings/Enable experimental error highlighting
Works here too (IntelliJ 10.0.1, Scala 2.8.1, OpenJDK, Ubuntu 10.10 64bit).
If you want more type checking you can also tick "Enable experimental error highlighting (possibly shows many wrong red code)" in the Settings, but this shouldn't make a difference in your case, although it works perfectly in my case for a large code base.
In project structure > modules > [your project name] > dependencies tab, do you have scala-compiler-[some version] listed?
See the Exploring the Project Structure here
intelliJ IDEA 10.0.1 + scala 2.8.1 on Ubuntu 10.10 64bit.
It shows a type mismatch error
For 2019.1 CE on Mac OS:
Preferences | Build, Execution, Deployment | Compiler | Scala Compiler
Checked the option:
Features->Experimental Features