I'm running into a Kotlin/Intellij issue where Int...
# intellij
t
I'm running into a Kotlin/Intellij issue where IntelliJ compiles but the the editor shows import error on one particular library. (see screenshots in the thread) Details: I am working with an existing open source project with my son (https://github.com/HyperiumClient/Addon-Workspace) which is is for creating add-on to an Minecraft client 'Hyperium'. I have been teaching him Kolin, and so we are looking to convert the existing java code examples in the project to Kotlin. I updated the build.gradle file to successfully compile kotlin, and I can create a Kotlin main and run it successfully. I run the 'convert to kotlin' successfully, and I can successfully do a build (Note: I have build using IntelliJ internal, not gradle), but as seen in the screenshot in the thread, the converted file import line for cc.hyperium.commands.BaseCommand is in error, and yet the file itself compiles. Does anyone have suggestions on what might be going on and how to fix? I've added more details in the thread.
Here are my version details (Note that we've tried this on two different computers and saw the same problems) Kolin Plugin: 1.3.72-release-IJ2020.1-6 gradle kotlin version: 1.3.72 IntelliJ: IntelliJ IDEA 2020.2 (Ultimate Edition) Build #IU-202.6397.94, built on July 27, 2020 Runtime version: 11.0.7+10-b944.20 x86_64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. macOS 10.14.6 GC: ParNew, ConcurrentMarkSweep Memory: 3764M Cores: 12 Registry: documentation.show.toolbar=true, editor.full.width.scrollbar=true, ide.find.select.word.at.caret=true, debugger.watches.in.variables=false, ide.tooltip.initialDelay=993, ide.balloon.shadow.size=0 Non-Bundled Plugins: Alt n 8, BrowseWordAtCaret, PowerMouse, com.github.holgerbrandl.pasteimages/, org.mapstruct.intellij, com.jetbrains.plugins.ini4idea, com.intellij.plugins.watcher, detekt, krasa.IdeaIconPack, lermitage.intellij.battery.status, net.seesharpsoft.intellij.plugins.csv, com.ppolivka.plugin.gitcleaner, git-commit-message-plugin, mobi.hsz.idea.gitignore, AWSCloudFormation, com.atlassian.bitbucket.references, org.sonarlint.idea, org.jetbrains.kotlin, com.jetbrains.space, kotlintest-plugin-intellij, com.viartemev.requestmapper, org.spekframework, Pythonid, aws.toolkit, org.asciidoctor.intellij.asciidoc, org.jetbrains.plugins.go, com.jetbrains.edu, de.endrullis.idea.postfixtemplates
Screenshot of the error:
Here are my local updates to the repo gradle script to add kotlin support. Note that the gradle.properties gradle version is 4.10.3. I am unable to update to 5+ since some of the gradle plugins that the project uses are only supported on 4.x:
a
The problem is that 'com.github.HyperiumClientHyperiummaster-SNAPSHOT' is a fat jar, and Kotlin plugin has a bug with resolving references from them: https://youtrack.jetbrains.com/issue/KT-25709. Please try the workaround from https://youtrack.jetbrains.com/issue/KT-25709#focus=Comments-27-3728739.0-0 (you will have to depend on the local modified jar directly in build.gradle). Also consider asking the maintainer of Hyperium to release it as a regular jar.
t
Thanks @Alexey Belkov [JB]! That looks like it is likely to be the problem, and thanks for the suggestions. I'll have a look later today.