Problem with Scala compiler in mixed modules (Java & Scala)
When I'm compiling my mixed modules with maven2 it works perfectly.
But when I'm trying to compile my SomeFile.scala class with internal IDEA compiler (Scala compiler in this case), i'm receiving error like this one:
Information:Compilation completed with 31 errors and 0 warnings
Information:31 errors
Information:0 warnings
Error:Scalac internal error: class java.lang.reflect.InvocationTargetException [sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method), sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39), sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25), java.lang.reflect.Method.invoke(Method.java:597), org.jetbrains.plugins.scala.compiler.rt.ScalacRunner.main(ScalacRunner.java:74)][scala.tools.nsc.util.CharArrayReader.next(CharArrayReader.scala:78), scala.tools.nsc.javac.JavaScanners$JavaScanner.fetchToken(JavaScanners.scala:617), scala.tools.nsc.javac.JavaScanners$JavaScanner.nextToken(JavaScanners.scala:313), scala.tools.nsc.javac.JavaParsers$JavaParser.accept(JavaParsers.scala:199), scala.tools.nsc.javac.JavaParsers$JavaParser.methodBody(JavaParsers.scala:488), scala.tools.nsc.javac.JavaParsers$JavaParser.termDecl(JavaParsers.scala:529), scala.tools.nsc.javac.JavaParsers$JavaParser.memberDecl(JavaParsers.scala:614), scala.tools.nsc.javac.JavaParsers$JavaParser.typeBodyDecls(JavaParsers.scala:735), scala.tools.nsc.javac.JavaParsers$JavaParser.typeBody(JavaParsers.scala:717), scala.tools.nsc.javac.JavaParsers$JavaParser.classDecl(JavaParsers.scala:689), scala.tools.nsc.javac.JavaParsers$JavaParser.typeDecl(JavaParsers.scala:834), scala.tools.nsc.javac.JavaParsers$JavaParser.compilationUnit(JavaParsers.scala:862), scala.tools.nsc.javac.JavaParsers$JavaParser.parse(JavaParsers.scala:46), scala.tools.nsc.ast.parser.SyntaxAnalyzer$ParserPhase.apply(SyntaxAnalyzer.scala:24), scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:267), scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:246), scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:246), scala.Iterator$class.foreach(Iterator.scala:414), scala.collection.mutable.ListBuffer$$anon$1.foreach(ListBuffer.scala:266), scala.tools.nsc.Global$GlobalPhase.run(Global.scala:246), scala.tools.nsc.Global$Run.compileSources(Global.scala:574), scala.tools.nsc.Global$Run.compile(Global.scala:667), scala.tools.nsc.Main$.process(Main.scala:73), scala.tools.nsc.Main$.main(Main.scala:87), scala.tools.nsc.Main.main(Main.scala), sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method), sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39), sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25), java.lang.reflect.Method.invoke(Method.java:597), org.jetbrains.plugins.scala.compiler.rt.ScalacRunner.main(ScalacRunner.java:74)]
Error:sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Error:sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
Error:sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
Error:java.lang.reflect.Method.invoke(Method.java:597)
Error:org.jetbrains.plugins.scala.compiler.rt.ScalacRunner.main(ScalacRunner.java:74)
Error:Caused by java.lang.ArrayIndexOutOfBoundsException: 907
Error:scala.tools.nsc.util.CharArrayReader.next(CharArrayReader.scala:78)
Error:scala.tools.nsc.javac.JavaScanners$JavaScanner.fetchToken(JavaScanners.scala:617)
Error:scala.tools.nsc.javac.JavaScanners$JavaScanner.nextToken(JavaScanners.scala:313)
Error:scala.tools.nsc.javac.JavaParsers$JavaParser.accept(JavaParsers.scala:199)
Error:scala.tools.nsc.javac.JavaParsers$JavaParser.methodBody(JavaParsers.scala:488)
Error:scala.tools.nsc.javac.JavaParsers$JavaParser.termDecl(JavaParsers.scala:529)
Error:scala.tools.nsc.javac.JavaParsers$JavaParser.memberDecl(JavaParsers.scala:614)
Error:scala.tools.nsc.javac.JavaParsers$JavaParser.typeBodyDecls(JavaParsers.scala:735)
Error:scala.tools.nsc.javac.JavaParsers$JavaParser.typeBody(JavaParsers.scala:717)
Error:scala.tools.nsc.javac.JavaParsers$JavaParser.classDecl(JavaParsers.scala:689)
Error:scala.tools.nsc.javac.JavaParsers$JavaParser.typeDecl(JavaParsers.scala:834)
Error:scala.tools.nsc.javac.JavaParsers$JavaParser.compilationUnit(JavaParsers.scala:862)
Error:scala.tools.nsc.javac.JavaParsers$JavaParser.parse(JavaParsers.scala:46)
Error:scala.tools.nsc.ast.parser.SyntaxAnalyzer$ParserPhase.apply(SyntaxAnalyzer.scala:24)
Error:scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:267)
Error:scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:246)
Error:scala.Iterator$class.foreach(Iterator.scala:414)
Error:scala.collection.mutable.ListBuffer$$anon$1.foreach(ListBuffer.scala:266)
Error:scala.tools.nsc.Global$GlobalPhase.run(Global.scala:246)
Error:scala.tools.nsc.Global$Run.compileSources(Global.scala:574)
Error:scala.tools.nsc.Global$Run.compile(Global.scala:667)
Error:scala.tools.nsc.Main$.process(Main.scala:73)
Error:scala.tools.nsc.Main$.main(Main.scala:87)
Error:scala.tools.nsc.Main.main(Main.scala)
Please sign in to leave a comment.
This is compiler exception: (I mean that nothing related to scala plugin)
So questions: Is there same compiler version when you use IDEA or maven?
Is scala compiler compiles both Java and Scala classes, when you use maven (if you haven't recursive relations then it's possible)?
Best regards,
Alexander Podkhalyuzin.
It's native IDEA compiler, executed by keystroke: cmd - shift - F9
Yes. It's the same version which I used with maven. Scala compiler shouldn't compile java classes.
Then try following setting make unchecked (to exlude java files form compilation): Settings -> Compiler -> Scala Compiler -> Compile Scala files first
I hope that it helps.
Best regards,
Alexander Podkhalyuzin.
Nope. I've already tried this one. Same behaviour.
Ok, seems that it's our compiler bug. With this box checked IDEA should exlude java files from compilation, so this joint scala/java compiler bug can't produce such problems.
I added issue to check it: http://youtrack.jetbrains.net/issue/SCL-1558
Best regards,
Alexander Podkhalyuzin.