kotlin getparameters function not working

Viewed 1553

I get constantly:

java.lang.IllegalStateException: Resource not found in classpath: kotlin/coroutines/coroutines.kotlin_builtins

while I try to get parameters of any object as pointet in example below:

::flagDbInfo.parameters

I've added following dependencies to my maven:

<dependency>
    <groupId>org.jetbrains.kotlinx</groupId>
    <artifactId>kotlinx-coroutines-core</artifactId>
    <version>0.30.2</version>
</dependency>

<dependency>
    <groupId>org.jetbrains.kotlin</groupId>
    <artifactId>kotlin-reflect</artifactId>
    <version>1.3.0</version>
</dependency>
2 Answers

Since you are using version 1.3.0 I would recommend the following dependency

    <dependency>
        <groupId>org.jetbrains.kotlin</groupId>
        <artifactId>kotlin-reflect</artifactId>
        <version>1.3.0</version>
    </dependency>
    <dependency>
        <groupId>org.jetbrains.kotlin</groupId>
        <artifactId>kotlin-stdlib</artifactId>
        <version>1.3.0</version>
    </dependency>

Got the same error, working on a Spring Boot app, with IntelliJ 2019.1, kotlin 1.3.30. The following configuration (in pom.xml) fixed it:

<dependencies>
... (your other dependencies)
    <dependency>
        <groupId>org.jetbrains.kotlin</groupId>
        <artifactId>kotlin-stdlib</artifactId>
        <version>1.3.30</version>
    </dependency>
    <dependency>
        <groupId>org.jetbrains.kotlin</groupId>
        <artifactId>kotlin-reflect</artifactId>
        <version>1.3.30</version>
    </dependency>
</dependencies>
...
<plugins>
...
<plugin>
            <artifactId>kotlin-maven-plugin</artifactId>
            <groupId>org.jetbrains.kotlin</groupId>
            <version>1.3.30</version>
            <configuration>
                <args>
                    <arg>-Xjsr305=strict</arg>
                </args>
                <jvmTarget>1.8</jvmTarget>
            </configuration>
            <executions>
                <execution>
                    <id>compile</id>
                    <phase>compile</phase>
                    <goals> <goal>compile</goal> </goals>
                    <configuration>
                        <sourceDirs>
                            <source>src/main/java</source>
                            <source>src/main/kotlin</source>
                        </sourceDirs>
                    </configuration>
                </execution>
                <execution>
                    <id>test-compile</id>
                    <phase>test-compile</phase>
                    <goals> <goal>test-compile</goal> </goals>
                </execution>
            </executions>
        </plugin>
...
</plugins>

Also, I originally had the kotlin-stdlib-jdk8 artifact as a dependency as well, but if the kotlin-stdlib artifact is included, the jdk8 one is not needed. See https://kotlinlang.org/docs/reference/whatsnew12.html#kotlin-standard-library-artifacts-and-split-packages for more details.

Related