Skip to content

Generation fails when generic cllass in annotation #2509

@caalador

Description

@caalador

Describe the bug
When having an annotation that takes a class value and the class is generic the mvn dokka:javadoc command fails with the exception:

[ERROR] Failed to execute goal org.jetbrains.dokka:dokka-maven-plugin:1.6.21:javadoc (default-cli) on project kotlin-maven-example: A type incompatibility occurred while executing org.jetbrains.dokka:dokka-maven-plugin:1.6.21:javadoc: class com.intellij.psi.impl.source.PsiImmediateClassType cannot be cast to class com.intellij.psi.impl.source.PsiClassReferenceType (com.intellij.psi.impl.source.PsiImmediateClassType and com.intellij.psi.impl.source.PsiClassReferenceType are in unnamed module of loader java.net.URLClassLoader @6cd15072)
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.jetbrains.dokka:dokka-maven-plugin:1.6.21
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/.../.m2/repository/org/jetbrains/dokka/dokka-maven-plugin/1.6.21/dokka-maven-plugin-1.6.21.jar
[ERROR] urls[1] = file:/C:/.../.m2/repository/org/jetbrains/dokka/dokka-core/1.6.21/dokka-core-1.6.21.jar
...
[ERROR] urls[39] = file:/C:/.../.m2/repository/org/jetbrains/annotations/13.0/annotations-13.0.jar
[ERROR] urls[40] = file:/C:/.../.m2/repository/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.6.21/kotlin-stdlib-jdk7-1.6.21.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------

Expected behaviour
Generation succeeds no matter what type of class is in the annotation.

Screenshots
If applicable, add screenshots to help explain your problem

To Reproduce
Have the Java classes:

package com.example;

// Generation succeeds if the generics is dropped
public class Breaking<Y> { 
}
package com.example;

public @interface TestAnnotate {

    Class<?> value();
}
package com.example;

@TestAnnotate(Breaking.class)
public class TestGeneric {
    
}

execute mvn compile dokka:javadoc

Dokka configuration

            <plugin>
                <groupId>org.jetbrains.dokka</groupId>
                <artifactId>dokka-maven-plugin</artifactId>
                <version>${dokka.version}</version>
                <executions>
                    <execution>
                        <phase>pre-site</phase>
                        <goals>
                            <goal>dokka</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <jdkVersion>${maven.compiler.source}</jdkVersion>
                    <sourceDirectories>
                        <sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
                    </sourceDirectories>
                </configuration>
            </plugin>

Installation

  • Operating system: Windows/Linux
  • Build tool: Maven
  • Dokka version: 1.6.21

Are you willing to provide a PR?
No time to get into the workings of a new project at the moment.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions