Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Weird javadoc error (with jdk12) for OSGi version annotation

With the change from Java 11 to Java 12, we now see a weird error when generating Javadoc on package-info files containing OSGi version annotations.

The source code is:

@Version("1.3.0")
package org.apache.jackrabbit.oak.commons;

import org.osgi.annotation.versioning.Version;

The error is:

[ERROR] C:\projects\apache\oak\trunk\oak-commons\src\main\java\org\apache\jackrabbit\oak\commons\package-info.java:17: error: unknown tag: Version
[ERROR] @Version("1.3.0")
[ERROR] ^

(See details and context)

Is this a regression in Java 12, or is there something wrong in the way the annotations are used, or how Javadoc is invoked (through maven)?

like image 243
Julian Reschke Avatar asked Oct 15 '25 18:10

Julian Reschke


1 Answers

Probably a Javadoc bug, because Javadoc considers the Java Annotation as a Javadoc Tag.

Workaround 1: disable this Javadoc tag

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>3.1.0</version>
                <configuration>                        
                    <tags>
                        <tag>
                            <name>Version</name>                            
                            <placement>X</placement>                            
                        </tag>
                    </tags>
                </configuration>
            </plugin>

Workaround 2: add an empty Javadoc block in front of every annotation

/** */@Version("1.3.0")
package org.apache.jackrabbit.oak.commons;
like image 158
Marcos Zolnowski Avatar answered Oct 17 '25 08:10

Marcos Zolnowski