Getting lots of compile errors trying to build Kotlin plugin

TL;DR - Fresh sync from Kotlin master, EAP 15 + kotlin 0.13.1069, can't build "IDEA" target, what am I doing wrong?

Using EAP 15: IntelliJ IDEA (Community Edition) IC-142.4465.2 Build #IC-142.4465, built on September 1, 2015 JRE: 1.8.0_40-release-b92 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o

on Mac OS X Yosemite 10.10.5

Hello, I'm new to Kotlin plugin development. Just today, I grabbed latest from a fork of Kotlin master, and I've been following the github instrucitons.

Running:

ant -f update_dependencies.xml
ant -f build.xml

worked fine, but trying to set up plugins I hit a snag.

After opening the kotlin IDEA project, I added  

https://teamcity.jetbrains.com/guestAuth/repository/download/bt345/bootstrap.tcbuildtag/updatePlugins.xml

as an additional plugin repo, and it showed me options for kotlin-bare-plugin (which I could install) and kotlin-plugin (which did not have such an option).

On my main plugin page, it says I have kotlin 0.12.1218 installed, but on the “Browse Repositories” page, the plugin I can’t seem to select is 0.13.1069. I’m not sure why I can’t get the newer version to overwrite the older one (even when I temporarily unchecked the older version). The github instructions provide a teamcity download link to get a prebuilt plugin that way but I don’t seem to have an account, and that seems like a temporary solution anyway.

So finally, I’ve disabled my useful kotlin plugin and have only enabled the bare kotlin plugin. This seems to eliminate some compile errors but there are still quite a lot. Here’s an excerpt:

Information:Kotlin: Kotlin JPS plugin version 0.13.1069
Information:Kotlin: Using kotlin-home = /Users/davidherman/Library/Application Support/IdeaIC15/BareKotlin/kotlinc
Information:Kotlin: Kotlin Compiler version 0.13.1069
Information:9/5/15, 11:05 PM - Compilation completed with 49 errors and 1 warning in 12s 934ms
Warning:Kotlin: Circular dependencies are only partially supported. The following modules depend on each other: descriptors, deserialization. Kotlin will compile them, but some strange effect may happen
/Users/davidherman/Code/Kotlin/core/descriptors/src/org/jetbrains/kotlin/builtins/ReflectionTypes.kt
Error:(34, 49) Kotlin: Unresolved reference: lazy
/Users/davidherman/Code/Kotlin/core/descriptors/src/org/jetbrains/kotlin/descriptors/annotations/Annotations.kt
Error:(124, 54) Kotlin: Cannot choose among the following candidates without completing type inference:
public fun <T, R> kotlin.Sequence<org.jetbrains.kotlin.descriptors.annotations.Annotations>.flatMap(transform: (org.jetbrains.kotlin.descriptors.annotations.Annotations) -> kotlin.Sequence<???>): kotlin.Sequence<???> defined in kotlin
kotlin.deprecated public fun <T, R> kotlin.Stream<org.jetbrains.kotlin.descriptors.annotations.Annotations>.flatMap(transform: (org.jetbrains.kotlin.descriptors.annotations.Annotations) -> kotlin.Stream<???>): kotlin.Stream<???> defined in kotlin
Error:(124, 64) Kotlin: Unresolved reference: it
/Users/davidherman/Code/Kotlin/core/descriptors/src/org/jetbrains/kotlin/descriptors/impl/ModuleDescriptorImpl.kt
Error:(58, 74) Kotlin: Unresolved reference: lazy
/Users/davidherman/Code/Kotlin/core/descriptors/src/org/jetbrains/kotlin/renderer/DescriptorRendererImpl.kt
Error:(243, 13) Kotlin: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public fun <T : java.lang.Appendable> ???.append(vararg value: kotlin.CharSequence?): ??? defined in kotlin
public fun java.lang.StringBuilder.append(vararg value: kotlin.Any?): java.lang.StringBuilder defined in kotlin
public fun java.lang.StringBuilder.append(vararg value: kotlin.String?): java.lang.StringBuilder defined in kotlin
Error:(244, 50) Kotlin: Type mismatch: inferred type is org.jetbrains.kotlin.renderer.DescriptorRendererImpl but java.lang.StringBuilder was expected
Error:(245, 13) Kotlin: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public fun <T : java.lang.Appendable> ???.append(vararg value: kotlin.CharSequence?): ??? defined in kotlin
public fun java.lang.StringBuilder.append(vararg value: kotlin.Any?): java.lang.StringBuilder defined in kotlin
public fun java.lang.StringBuilder.append(vararg value: kotlin.String?): java.lang.StringBuilder defined in kotlin
Error:(278, 55) Kotlin: Type mismatch: inferred type is org.jetbrains.kotlin.renderer.DescriptorRendererImpl but java.lang.StringBuilder was expected
Error:(296, 29) Kotlin: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public fun <T : java.lang.Appendable> ???.append(vararg value: kotlin.CharSequence?): ??? defined in kotlin
public fun java.lang.StringBuilder.append(vararg value: kotlin.Any?): java.lang.StringBuilder defined in kotlin
public fun java.lang.StringBuilder.append(vararg value: kotlin.String?): java.lang.StringBuilder defined in kotlin
Error:(302, 21) Kotlin: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public fun <T : java.lang.Appendable> ???.append(vararg value: kotlin.CharSequence?): ??? defined in kotlin
public fun java.lang.StringBuilder.append(vararg value: kotlin.Any?): java.lang.StringBuilder defined in kotlin
public fun java.lang.StringBuilder.append(vararg value: kotlin.String?): java.lang.StringBuilder defined in kotlin
Error:(304, 17) Kotlin: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public fun <T : java.lang.Appendable> ???.append(vararg value: kotlin.CharSequence?): ??? defined in kotlin
public fun java.lang.StringBuilder.append(vararg value: kotlin.Any?): java.lang.StringBuilder defined in kotlin
public fun java.lang.StringBuilder.append(vararg value: kotlin.String?): java.lang.StringBuilder defined in kotlin
Error:(306, 21) Kotlin: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public fun <T : java.lang.Appendable> ???.append(vararg value: kotlin.CharSequence?): ??? defined in kotlin
public fun java.lang.StringBuilder.append(vararg value: kotlin.Any?): java.lang.StringBuilder defined in kotlin
public fun java.lang.StringBuilder.append(vararg value: kotlin.String?): java.lang.StringBuilder defined in kotlin
Error:(308, 17) Kotlin: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public fun <T : java.lang.Appendable> ???.append(vararg value: kotlin.CharSequence?): ??? defined in kotlin
public fun java.lang.StringBuilder.append(vararg value: kotlin.Any?): java.lang.StringBuilder defined in kotlin
public fun java.lang.StringBuilder.append(vararg value: kotlin.String?): java.lang.StringBuilder defined in kotlin
Error:(311, 13) Kotlin: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public fun <T : java.lang.Appendable> ???.append(vararg value: kotlin.CharSequence?): ??? defined in kotlin
public fun java.lang.StringBuilder.append(vararg value: kotlin.Any?): java.lang.StringBuilder defined in kotlin
public fun java.lang.StringBuilder.append(vararg value: kotlin.String?): java.lang.StringBuilder defined in kotlin
Error:(312, 101) Kotlin: Type mismatch: inferred type is org.jetbrains.kotlin.renderer.DescriptorRendererImpl but java.lang.StringBuilder was expected
Error:(313, 13) Kotlin: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public fun <T : java.lang.Appendable> ???.append(vararg value: kotlin.CharSequence?): ??? defined in kotlin
public fun java.lang.StringBuilder.append(vararg value: kotlin.Any?): java.lang.StringBuilder defined in kotlin
public fun java.lang.StringBuilder.append(vararg value: kotlin.String?): java.lang.StringBuilder defined in kotlin
Error:(314, 13) Kotlin: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public fun <T : java.lang.Appendable> ???.append(vararg value: kotlin.CharSequence?): ??? defined in kotlin
public fun java.lang.StringBuilder.append(vararg value: kotlin.Any?): java.lang.StringBuilder defined in kotlin
public fun java.lang.StringBuilder.append(vararg value: kotlin.String?): java.lang.StringBuilder defined in kotlin
Error:(316, 29) Kotlin: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public fun <T : java.lang.Appendable> ???.append(vararg value: kotlin.CharSequence?): ??? defined in kotlin
public fun java.lang.StringBuilder.append(vararg value: kotlin.Any?): java.lang.StringBuilder defined in kotlin
public fun java.lang.StringBuilder.append(vararg value: kotlin.String?): java.lang.StringBuilder defined in kotlin
Error:(352, 21) Kotlin: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public fun <T : java.lang.Appendable> ???.append(vararg value: kotlin.CharSequence?): ??? defined in kotlin
public fun java.lang.StringBuilder.append(vararg value: kotlin.Any?): java.lang.StringBuilder defined in kotlin
public fun java.lang.StringBuilder.append(vararg value: kotlin.String?): java.lang.StringBuilder defined in kotlin
Error:(373, 17) Kotlin: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public fun <T : java.lang.Appendable> ???.append(vararg value: kotlin.CharSequence?): ??? defined in kotlin
public fun java.lang.StringBuilder.append(vararg value: kotlin.Any?): java.lang.StringBuilder defined in kotlin
public fun java.lang.StringBuilder.append(vararg value: kotlin.String?): java.lang.StringBuilder defined in kotlin
Error:(375, 13) Kotlin: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public fun <T : java.lang.Appendable> ???.append(vararg value: kotlin.CharSequence?): ??? defined in kotlin
public fun java.lang.StringBuilder.append(vararg value: kotlin.Any?): java.lang.StringBuilder defined in kotlin
public fun java.lang.StringBuilder.append(vararg value: kotlin.String?): java.lang.StringBuilder defined in kotlin
Error:(377, 62) Kotlin: Type parameter bound for A in fun <T, A : java.lang.Appendable> kotlin.Iterable<T>.joinTo(buffer: A, separator: kotlin.String = …, prefix: kotlin.String = …, postfix: kotlin.String = …, limit: kotlin.Int = …, truncated: kotlin.String = …, transform: ((T) -> kotlin.String)? = …): A
is not satisfied: inferred type org.jetbrains.kotlin.renderer.DescriptorRendererImpl is not a subtype of java.lang.Appendable
Error:(469, 35) Kotlin: Type inference failed: Cannot infer type parameter D in fun <R : kotlin.Any!, D : kotlin.Any!> accept(visitor: org.jetbrains.kotlin.descriptors.DeclarationDescriptorVisitor<R!, D!>!, data: D!): R!
None of the following substitutions
(org.jetbrains.kotlin.descriptors.DeclarationDescriptorVisitor<kotlin.Unit!, java.lang.StringBuilder!>!,java.lang.StringBuilder!)
(org.jetbrains.kotlin.descriptors.DeclarationDescriptorVisitor<kotlin.Unit!, org.jetbrains.kotlin.renderer.DescriptorRendererImpl!>!,org.jetbrains.kotlin.renderer.DescriptorRendererImpl!)
can be applied to
(org.jetbrains.kotlin.renderer.DescriptorRendererImpl.RenderDeclarationDescriptorVisitor,org.jetbrains.kotlin.renderer.DescriptorRendererImpl)
Error:(472, 56) Kotlin: Type mismatch: inferred type is org.jetbrains.kotlin.renderer.DescriptorRendererImpl but java.lang.StringBuilder was expected
Error:(635, 93) Kotlin: Type mismatch: inferred type is org.jetbrains.kotlin.renderer.DescriptorRendererImpl but java.lang.StringBuilder was expected
/Users/davidherman/Code/Kotlin/core/descriptors/src/org/jetbrains/kotlin/renderer/RenderingUtils.kt
Error:(57, 17) Kotlin: Unresolved reference: length
Error:(58, 17) Kotlin: Unresolved reference: append
Error:(60, 13) Kotlin: Unresolved reference: append
/Users/davidherman/Code/Kotlin/core/descriptors/src/org/jetbrains/kotlin/resolve/calls/inference/CapturedTypeConstructor.kt
Error:(69, 9) Kotlin: This annotation is not applicable to target ‘expression’
/Users/davidherman/Code/Kotlin/core/descriptors/src/org/jetbrains/kotlin/resolve/calls/inference/ConstraintSystemImpl.kt
Error:(74, 68) Kotlin: Unresolved reference: lazy
/Users/davidherman/Code/Kotlin/core/descriptors/src/org/jetbrains/kotlin/resolve/isAnnotatedAsHidden.kt
Error:(23, 41) Kotlin: Overload resolution ambiguity:
public constructor FqName(org.jetbrains.annotations.NotNull fqName: kotlin.String) defined in org.jetbrains.kotlin.name.FqName
public constructor FqName(org.jetbrains.annotations.NotNull fqName: org.jetbrains.kotlin.name.FqNameUnsafe) defined in org.jetbrains.kotlin.name.FqName
Error:(23, 73) Kotlin: Unresolved reference: qualifiedName
/Users/davidherman/Code/Kotlin/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/StaticScopeForKotlinClass.kt
Error:(34, 56) Kotlin: Unresolved reference: lazy
/Users/davidherman/Code/Kotlin/core/descriptors/src/org/jetbrains/kotlin/resolve/scopes/SubstitutingScope.kt
Error:(35, 36) Kotlin: Unresolved reference: lazy
Error:(47, 9) Kotlin: This annotation is not applicable to target ‘expression’
/Users/davidherman/Code/Kotlin/core/descriptors/src/org/jetbrains/kotlin/types/StarProjectionImpl.kt
Error:(30, 35) Kotlin: Unresolved reference: lazy
/Users/davidherman/Code/Kotlin/core/descriptors/src/org/jetbrains/kotlin/types/dynamicTypes.kt
Error:(47, 9) Kotlin: This annotation is not applicable to target ‘expression’
/Users/davidherman/Code/Kotlin/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/AnnotationDeserializer.kt
Error:(147, 34) Kotlin: Unresolved reference: getByteType
Error:(148, 34) Kotlin: Unresolved reference: getCharType
Error:(149, 35) Kotlin: Unresolved reference: getShortType
Error:(150, 33) Kotlin: Unresolved reference: getIntType
Error:(151, 34) Kotlin: Unresolved reference: getLongType
Error:(152, 35) Kotlin: Unresolved reference: getFloatType
Error:(153, 36) Kotlin: Unresolved reference: getDoubleType
Error:(154, 37) Kotlin: Unresolved reference: getBooleanType
Error:(155, 36) Kotlin: Unresolved reference: getStringType

Thanks for any guidance, especially if it’s obvious to someone that I missed a step.
David

There was a problem with installation newer Kotlin plugins over the bundled one (IDEA-143794), the only workaround was to install it manually with "Install plugin from disk...".  Luckily, an update shoud be possible without any tricks starting from today bootstrap (0.13.1121). Note that you will need to update sorces and do "ant -f update_dependencies.xml" once again.

I’ve also checked that it’s possible to build current state with kotlin-bare-plugin 0.13.1121, but frankly it’s not an option if you are going to do any modification in the project. Bare Kotlin plugin contains only part responsible for building and it was meant to be used as backup option for the projects that have some isolated Kotlin modules, in case when when there’re troubles with the main plugin. But there’re too many Kotlin code in Kotlin project already, almost all code will be red without main plugin :slight_smile:

Please try to install a new bootstrap, I hope the problem will be solved.

Thank you very much, Nikolay. After installing 0.13.1121, everything is compiling now.