Intermittent problem compiling mixed java/scala project

Hi All.

Mostly I have had great results with mixed code - however, occasionally I will mess with some java code, and then an unrelated java class will stop compiling - as it is unable to find the scala class it depends on (not talking circular deps or anything fancy). Note that it won't show up with syntax errors (even the content assistance works correctly) but it just wont "make" when I try to build it, or run tests.

I use maven to build as well, and it is able to build correctly (even a clean build).

To correct - I usually comment out the offending bits, make, and then restore it and all is well.

Anyone else seen this?

0
6 comments
Avatar
Permanently deleted user

Hello, Michael.

At first, I would recommentd you to rebuild your project from scratch. Could you also provide a small testcase with same behavior to help us reproduce this problem?

With best reagrds,
Ilya

0
Avatar
Permanently deleted user

I Ilya - I am new to intelliJ (and loving it) so what would define a build from scratch? (more then just a full make - command-f9 etc?).

Yes if I can repo it reliably, I will zip it up and attach it to a JIRA case I think - just not happy I can reliably reproduce. If a full rebuild works, then thats probably fine for now.

Michael.

0
Avatar
Permanently deleted user

Michael,

By "rebuild from scratch" I meant just full rebuild. If problem relates to our compiler caches it might help. But, as I understood, this problem is foation, i.e. you cannot reproduced it by fixed sequence of steps?

With best regards,
Ilya

0
Avatar
Permanently deleted user

Hi Ilya. OK I can reproduce it - I have created an issue: http://www.jetbrains.net/jira/browse/SCL-541 with the attached project that shows it (I hope others are able to see this).
I did update to the latest scala plugin just this morning, and it is still happening.

Hope this sheds some light (note I can build fine with maven + scala plug in for it - so the code should be sound from scalac's point of view).

(also attached to the forum - didn't realise you could do that until I created the bug report).



Attachment(s):
scala.zip
0
Avatar
Permanently deleted user

Michael.

It seems, the problem is in order of compilation. By default, IDEA compiles Java files first, and only after that it compiles Scala contenct. To change this order just open Settings -> Compiler -> scala Compiler dialog and mark "Compile Scala files first" checkbox.

With best regrads,
Ilya

0
Avatar
Permanently deleted user

OK thanks that does it !

So should I close that issue off? I would probably request that it is scalac before java - from my understanding that is always the ideal way since 2.7.2 of scala (but I could be wrong).

0

Please sign in to leave a comment.