Caleb Bassham
Caleb Bassham

Reputation: 1933

Kotlin dependency not behaving like Kotlin

I have a Kotlin dependency that I wrote and am now trying to use it in a separate project. When I add it to the other project variables declared like val hits = 0 can not be referenced by using the variable hits but by using getHits() which would make sense if I was using java in the second project but I am not. In other Kotlin projects I have worked on in the past this was not an issue and the only thing that I can think of that is different in the build is that I have set transitive = false on the gradle dependency because that was causing another issue. Anyway I am confused on what this would be caused by and appreciate any help, thanks!

Upvotes: 0

Views: 62

Answers (1)

Caleb Bassham
Caleb Bassham

Reputation: 1933

In the Intellij decompiler is was considering a class that I know was written in Kotlin a java class so I tried to change some things. The problem was one of two things:

  1. I was using the maven plugin for gradle.

  2. I had both a compileKotlin and a compileJava when I was only using Kotlin.

I belive that the problem was caused by the former because I have used both compileKotlin and compileJava fine together before but I had never used the maven plugin but I added it because something else was complaining that it needed it.

Upvotes: 1

Related Questions