Overload resolution ambiguity: File.kt vs FileKt.class

Answered

My exact error is:

Overload resolution ambiguity. All these functions match.
public fun isEven(permutation: List<Int>): Boolean defined in games.gameOfFifteen in file GameOfFifteenHelperKt.class
public fun isEven(permutation: List<Int>): Boolean defined in games.gameOfFifteen in file GameOfFifteenHelper.kt

I'm getting a similar error for the GameOfFifteen file:
Conflicting overloads: public fun newGameOfFifteen(initializer: GameOfFifteenInitializer = ...): Game defined in games.gameOfFifteen in file GameOfFifteen.kt, public fun newGameOfFifteen(initializer: GameOfFifteenInitializer): Game defined in games.gameOfFifteen in file GameOfFifteenKt.class

This started recently and I'm not sure why.  I couldn't find any help for file.kt ... fileKt.class on line.

I'm stuck.  Any help would be appreciated.

Steve S.

IDE info:
IntelliJ IDEA 2019.2.3 (Community Edition)
Build #IC-192.6817.14, built on September 23, 2019
Runtime version: 11.0.4+10-b304.69 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 4.15.0-64-generic
GC: ParNew, ConcurrentMarkSweep
Memory: 939M
Cores: 6
Registry:
Non-Bundled Plugins: org.jetbrains.kotlin, com.jetbrains.edu

Build.log:
2019-10-01 11:33:22,225 [ 469243] INFO - .incremental.IncProjectBuilder - Building project; isRebuild:false; isMake:false parallel compilation:false
2019-10-01 11:33:22,226 [ 469244] INFO - kotlin.jps.build.KotlinBuilder - is Kotlin incremental compilation enabled for JVM: true
2019-10-01 11:33:22,226 [ 469244] INFO - kotlin.jps.build.KotlinBuilder - is Kotlin incremental compilation enabled for JS: true
2019-10-01 11:33:22,228 [ 469246] INFO - kotlin.jps.build.KotlinBuilder - is Kotlin compiler daemon enabled: true
2019-10-01 11:33:22,228 [ 469246] INFO - kotlin.jps.build.KotlinBuilder - Label in local history: build started 37d32b5c
2019-10-01 11:33:22,260 [ 469278] INFO - .incremental.IncProjectBuilder - Cleaned output directories in 2 ms
2019-10-01 11:33:22,671 [ 469689] INFO - kotlin.jps.build.KotlinBuilder - KotlinTargetsIndex created in 367 ms
2019-10-01 11:33:22,681 [ 469699] INFO - kotlin.jps.build.KotlinBuilder - Total Kotlin global compile context initialization time: 378 ms
2019-10-01 11:33:23,156 [ 470174] INFO - kotlin.jps.build.KotlinBuilder - Compiled successfully
2019-10-01 11:33:23,268 [ 470286] INFO - brains.jps.incremental.Builder - Dependency analysis found 1 affected files
2019-10-01 11:33:23,542 [ 470560] INFO - kotlin.jps.build.KotlinBuilder - Compiled successfully
2019-10-01 11:33:23,562 [ 470580] INFO - brains.jps.incremental.Builder - Dependency analysis found 1 affected files
2019-10-01 11:33:23,570 [ 470588] INFO - rains.jps.cmdline.BuildSession - Build duration: Builder 'Kotlin Builder' took 688 ms; 2 sources processed (344 ms per file)
2019-10-01 11:33:23,570 [ 470588] INFO - rains.jps.cmdline.BuildSession - Build duration: Builder 'Resource Compiler' took 2 ms; 1 sources processed (2 ms per file)
2019-10-01 11:33:24,164 [ 0] INFO - etbrains.jps.cmdline.BuildMain - ==================================================
2019-10-01 11:33:24,164 [ 0] INFO - etbrains.jps.cmdline.BuildMain - Build process started. Classpath: /home/sjs/idea-IC-191.7479.19/plugins/java/lib/jps-launcher.jar:/usr/lib/jvm/java-1.11.0-openjdk-amd64/lib/classes.zip
2019-10-01 11:33:24,330 [ 166] INFO - etbrains.jps.cmdline.BuildMain - Connection to IDE established in 146 ms
2019-10-01 11:33:24,387 [ 223] INFO - #com.intellij.jna.JnaLoader - JNA library (64-bit) loaded in 55 ms
2019-10-01 11:33:24,440 [ 276] INFO - jps.cmdline.JpsModelLoaderImpl - Loading model: project path = /home/sjs/dev/coursera/GameBoard, global options path = /home/sjs/.IdeaIC2019.2/config/options
2019-10-01 11:33:24,782 [ 618] INFO - jps.cmdline.JpsModelLoaderImpl - Model loaded in 342 ms
2019-10-01 11:33:24,782 [ 618] INFO - jps.cmdline.JpsModelLoaderImpl - Project has 1 modules, 1 libraries
2019-10-01 11:33:24,875 [ 711] INFO - ellij.util.io.PagedFileStorage - lower=100; upper=500; buffer=10; max=680
2019-10-01 11:33:24,934 [ 770] INFO - etbrains.jps.cmdline.BuildMain - Pre-loaded process ready in 770 ms

0
3 comments

Please use https://discuss.kotlinlang.org/ for any questions related to Kotlin.

0

Actually, this seems to be Intellij rather than Kotlin.  I just rebuilt by renaming the old directory, creating a new project in the old directory and copying the kotlin files from the old project to the new and rebuilding.  Everything so far is working ok.  Easiest would be to just ignore this and move on -- but I seem to have screwed up the environment and would like to know how to fix it.

Steve S.

0

Hi Steve,

I ran into a very similar problem, it seems to have been caused by Intellij including files from the gradle "/build" folder to the class path. Marking the build folder as "excluded" fixed the problem for me. (right-click build folder -> Mark Directory as -> Excluded)

Cheers,

Jan

0

Please sign in to leave a comment.