Skip to content

compile:doc results in compilation error for static inner classes in java #10419

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
NAJ10 opened this issue Jul 20, 2017 · 2 comments
Closed

Comments

@NAJ10
Copy link

NAJ10 commented Jul 20, 2017

ReproduceScalaDoc.zip

When "sbt compile:doc" is run on the attached mixed Java/Scala sbt project (unzip ReproduceScalaDoc.zip) the following error is seen

[error] /home/user/Development/repository/ReproduceScalaDoc/src/main/java/example/Trade.java:13: not found: type Identifier
[error]     public Trade(Identifier id) {
[error]                  ^
[info] No documentation generated with unsuccessful compiler run

sbt compile produces no error.

This is seen with Scala versions 2.12.0, 2.12.1 and 2.12.2. The problem does not occur on Scala 2.11.11.

This example has been distilled from our applications very large code base which is a mixture of Scala and Java. The application is the product of over 15 years work. The problem was found in the course of migrating from Scala 2.11 to Scala 2.12.

It seems like static inner classes are not being handled correctly. A similar/identical problem occurs when enums are nested inside a Java class.

@SethTisue
Copy link
Member

SethTisue commented Jul 20, 2017

workaround: you can restore the 2.11 behavior with scalacOptions in (Compile, doc) += "-no-java-comments" (as per the 2.12.0 release notes)

@lrytz
Copy link
Member

lrytz commented Jul 20, 2017

This is a duplicate of #9111, it works if you use specify the outer name when referencing class Trade

    public Trade(Trade.Identifier id) {

@lrytz lrytz marked this as a duplicate of #9111 Jul 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants