com-lihaoyi / acyclic

Acyclic is a Scala compiler plugin to let you prohibit circular dependencies between files
MIT License
250 stars 34 forks source link

Acyclic throws exception when compiling with IDEA incremental compiler #11

Open s-nel opened 8 years ago

s-nel commented 8 years ago

Periodically after saving a single file and attempting to run tests in IDEA, I get the following exception from Acyclic. Exception goes away if I do a complete rebuild. Exception is not thrown when compiling with SBT.

Error:scalac: Error: key not found: /foo/bar.scala
java.util.NoSuchElementException: key not found: /foo/bar.scala
    at scala.collection.MapLike$class.default(MapLike.scala:228)
    at scala.collection.AbstractMap.default(Map.scala:59)
    at scala.collection.MapLike$class.apply(MapLike.scala:141)
    at scala.collection.AbstractMap.apply(Map.scala:59)
    at acyclic.plugin.PluginPhase$$anon$1$$anonfun$6$$anonfun$apply$8.apply(PluginPhase.scala:84)
    at acyclic.plugin.PluginPhase$$anon$1$$anonfun$6$$anonfun$apply$8.apply(PluginPhase.scala:84)
    at scala.collection.TraversableLike$$anonfun$groupBy$1.apply(TraversableLike.scala:321)
    at scala.collection.TraversableLike$$anonfun$groupBy$1.apply(TraversableLike.scala:320)
    at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)
    at scala.collection.mutable.ArrayBuffer.foreach(ArrayBuffer.scala:48)
    at scala.collection.TraversableLike$class.groupBy(TraversableLike.scala:320)
    at scala.collection.AbstractTraversable.groupBy(Traversable.scala:104)
    at acyclic.plugin.PluginPhase$$anon$1$$anonfun$6.apply(PluginPhase.scala:84)
    at acyclic.plugin.PluginPhase$$anon$1$$anonfun$6.apply(PluginPhase.scala:71)
    at scala.collection.immutable.Stream$$anonfun$map$1.apply(Stream.scala:418)
    at scala.collection.immutable.Stream$$anonfun$map$1.apply(Stream.scala:418)
    at scala.collection.immutable.Stream$Cons.tail(Stream.scala:1233)
    at scala.collection.immutable.Stream$Cons.tail(Stream.scala:1223)
    at scala.collection.immutable.Stream$$anonfun$map$1.apply(Stream.scala:418)
    at scala.collection.immutable.Stream$$anonfun$map$1.apply(Stream.scala:418)
    at scala.collection.immutable.Stream$Cons.tail(Stream.scala:1233)
    at scala.collection.immutable.Stream$Cons.tail(Stream.scala:1223)
    at scala.collection.immutable.Stream.foreach(Stream.scala:595)
    at scala.collection.TraversableOnce$class.toMap(TraversableOnce.scala:316)
    at scala.collection.AbstractTraversable.toMap(Traversable.scala:104)
    at acyclic.plugin.PluginPhase$$anon$1.run(PluginPhase.scala:89)
    at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1501)
    at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1486)
    at scala.tools.nsc.Global$Run.compileSources(Global.scala:1481)
    at scala.tools.nsc.Global$Run.compile(Global.scala:1582)
    at xsbt.CachedCompiler0.run(CompilerInterface.scala:115)
    at xsbt.CachedCompiler0.run(CompilerInterface.scala:94)
    at xsbt.CompilerInterface.run(CompilerInterface.scala:22)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:101)
    at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:47)
    at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:41)
    at org.jetbrains.jps.incremental.scala.local.IdeaIncrementalCompiler.compile(IdeaIncrementalCompiler.scala:29)
    at org.jetbrains.jps.incremental.scala.local.LocalServer.compile(LocalServer.scala:26)
    at org.jetbrains.jps.incremental.scala.remote.Main$.make(Main.scala:67)
    at org.jetbrains.jps.incremental.scala.remote.Main$.nailMain(Main.scala:24)
    at org.jetbrains.jps.incremental.scala.remote.Main.nailMain(Main.scala)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.martiansoftware.nailgun.NGSession.run(NGSession.java:319)
seanmcl commented 8 years ago

I hit this as well. It makes acyclic unusable because it occurs on every compilation after the first one after an sbt clean.

vuspenskiy commented 8 years ago

+1

ninadingole commented 6 years ago

+1 Same happening with Intellij IDE 2018 EAP

Error:scalac: Error: key not found: Repository.scala
java.util.NoSuchElementException: key not found: Repository.scala
    at scala.collection.MapLike$class.default(MapLike.scala:228)
    at scala.collection.AbstractMap.default(Map.scala:59)
    at scala.collection.MapLike$class.apply(MapLike.scala:141)
    at scala.collection.AbstractMap.apply(Map.scala:59)
    at acyclic.plugin.PluginPhase$$anon$1$$anonfun$8$$anonfun$apply$10.apply(PluginPhase.scala:95)
    at acyclic.plugin.PluginPhase$$anon$1$$anonfun$8$$anonfun$apply$10.apply(PluginPhase.scala:95)
    at scala.collection.TraversableLike$$anonfun$groupBy$1.apply(TraversableLike.scala:321)
    at scala.collection.TraversableLike$$anonfun$groupBy$1.apply(TraversableLike.scala:320)
    at scala.collection.mutable.ResizableArray$class.foreach(ResizableArray.scala:59)

Any workaround for the issue ?