Can't compile scala plugin project?

I followed the instructions on this page  (http://confluence.jetbrains.com/display/SCA/Setting+up+Scala+plugin+project+in+IntelliJ+IDEA) except copying the intellij installation to IDEA13SDK instead of NikaSDK or LedaSDK. It seems to almost work, but when I try building it, I get a whole bunch of erros (small sample shown below).

This is done using scala 2.10.1 on the Oracle JDK 7 on Windows. Does the plugin need a different version of something to build properly?

class JList takes type parameters
  var list: JList = null
            ^
class JList takes type parameters
  def setList(l: JList) {
                 ^
class DefaultListModel takes type parameters
      val model: DefaultListModel = new DefaultListModel
                 ^
class JList takes type parameters
      val list: JList = new JList(model)
                ^
class DefaultListModel takes type parameters
          val model: DefaultListModel = new DefaultListModel
                     ^
class JList takes type parameters
          val list: JList = new JList(model)
                    ^
type mismatch;
found   : com.intellij.ide.util.FQNameCellRenderer
required: javax.swing.ListCellRenderer[_ >: Object]
Note: E <: Any (and com.intellij.ide.util.FQNameCellRenderer <: javax.swing.ListCellRenderer[E]), but Java-defined trait ListCellRenderer is invariant in type E.
You may wish to investigate a wildcard type such as `_ <: Any`. (SLS 3.2.10)
      list.setCellRenderer(new FQNameCellRenderer())
                           ^
type mismatch;
found   : x$2.type (with underlying type String)
required: Nothing
      patternList.foreach(listModel.add(listModel.size, _))
                                                        ^
overloaded method value createDecorator with alternatives:
  (javax.swing.JList[_])com.intellij.ui.ToolbarDecorator <and>
  (javax.swing.JTree)com.intellij.ui.ToolbarDecorator <and>
  (javax.swing.JTable)com.intellij.ui.ToolbarDecorator
cannot be applied to (com.intellij.ui.components.JBList)
      val panel = ToolbarDecorator.createDecorator(patternJBList).setAddAction(new AnActionButtonRunnable {
                                   ^

5 comments

Do you have only compilation errors or IDE shows red code as well? What type of compilation do you use (i.e. external, FSC)?

0

Only compilation errors; the IDE does not show any red code. This is with neither the FSC or external compiler I think, just the normal one.

Looking at the errors, they seemed related to me using having Java 7 installed instead of Java 6, but I'm not sure. I tried installing Java 6 and setting the project JDK to use that, but the errors still popped up.

0

This is expected with JDK7, for now you have to use JDK6. Scala code is not compatible with both JDK 6 and JDK 7, however IDEA 13 will be on JDK 7 soon. Then we will update plugin sources for JDK 7 too.

Best regards,
Aleksandr Podkhaliuzin.

0

I just tried with the IntelliJ community 12.1.4 edition (both to copy into the plugin directory as well as to open the whole project) and set the project SDK and "internal java platform" both to Java 6. I'm still getting these errors; presumably Java7 is still being used somewhere, but for the life of me I can't find anywhere else that I could flip from Java 1.7 to 1.6. Any ideas?

EDIT: all the "Module SDK"s are also 1.6
EDIT #2: It seems that the version of IntelliJ that I downloaded and installed is running using Java 7. Perhaps it was compiled using Java 7, which is what's resulting in bytecode that's incompatible with the Scala Plugin?

0

Yes, I think you are right that IntelliJ version was compiled with JDK 1.7.
As I know IntelliJ will migrate to JRE 1.7 very soon, then we will do it as well in the nearest future.

Best regards,
Alexander Podkhalyuzin.

0

Please sign in to leave a comment.