Weird compilation issues

I have been having this issue when compiling my Kotlin project, when I compile a jar and then try to use it in another Kotlin project all variables such as val hit = 30 can only be referenced with getHits(). In other projects I have never found this to be an issue. With the Intellij decompiler the decompiled Kotlin classes come up as Java classes which I never remembering happening in the past. I am compiling with Gradle 4.9. I have no clue what the problem is and after hours of trying to fix it I am so tired of spending all this time on something stupid like this. If anyone knows what is happening some explanation would be much appreciated, thanks!