Skip to content
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

false positive "you must write the annotation class in Java" warning in "sbt doc" #10134

Closed
scabug opened this issue Jan 3, 2017 · 6 comments

Comments

@scabug
Copy link

scabug commented Jan 3, 2017

A.scala

object A

Row.java

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;

@Retention(RetentionPolicy.RUNTIME)
public @interface Row {
  String value() default "";
}

build.sbt

scalaVersion := "2.12.1"

execute "sbt doc"

[warn] Row.java:5: Implementation restriction: subclassing Classfile does not
[warn] make your annotation visible at runtime.  If that is what
[warn] you want, you must write the annotation class in Java.
[warn] public @interface Row {
[warn]                   ^
model contains 3 documentable templates
[warn] one warning found
[info] Main Scala API documentation successful.
@scabug
Copy link
Author

scabug commented Jan 3, 2017

Imported From: https://issues.scala-lang.org/browse/SI-10134?orig=1
Reporter: kenji yoshida
Affected Versions: 2.12.1
See #6991

@KarelCemus
Copy link

Affects also Scala 2.12.3

@SethTisue SethTisue added this to the Backlog milestone Sep 11, 2017
@missingfaktor
Copy link

Is there a workaround for this bug?

@eed3si9n
Copy link
Member

This seems to have been fixed in Scala 2.12.9.

sbt:hello> ++2.12.8!
[info] Forcing Scala version to 2.12.8 on all projects.
[info] Reapplying settings...
[info] Set current project to hello (in build file:/private/tmp/hello/)
sbt:hello> clean
[success] Total time: 0 s, completed Jun 14, 2020 1:13:18 AM
sbt:hello> doc
[info] Main Scala API documentation to /private/tmp/hello/target/scala-2.12/api...
[warn] /private/tmp/hello/Row.java:5:19: Implementation restriction: subclassing Classfile does not
[warn] make your annotation visible at runtime.  If that is what
[warn] you want, you must write the annotation class in Java.
[warn] public @interface Row {
[warn]                   ^
model contains 4 documentable templates
[warn] one warning found
[info] Main Scala API documentation successful.
[success] Total time: 3 s, completed Jun 14, 2020 1:13:24 AM
sbt:hello> ++2.12.9!
[info] Forcing Scala version to 2.12.9 on all projects.
[info] Reapplying settings...
[info] Set current project to hello (in build file:/private/tmp/hello/)
sbt:hello> clean
[success] Total time: 0 s, completed Jun 14, 2020 1:13:29 AM
sbt:hello> doc
[info] Main Scala API documentation to /private/tmp/hello/target/scala-2.12/api...
[info] Non-compiled module 'compiler-bridge_2.12' for Scala 2.12.9. Compiling...
[info]   Compilation completed in 9.998s.
model contains 4 documentable templates
[info] Main Scala API documentation successful.

I can't tell which of the changes in https://github.com/scala/scala/releases/tag/v2.12.9 had the intentional or unintentional effect of fixing this, but I'd vote to close it.

@lrytz
Copy link
Member

lrytz commented Jun 15, 2020

👍

Any volunteer for a regression test PR? I hope the infrastructure is in place to do scaladoc tests with mixed Java/Scala sources.

@SethTisue SethTisue modified the milestones: Backlog, 2.12.12 Jun 15, 2020
@retronym retronym modified the milestones: 2.12.12, 2.12.13 Jul 1, 2020
seratch added a commit to seratch/scala that referenced this issue Oct 18, 2020
@xuwei-k xuwei-k added the has PR label Oct 18, 2020
seratch added a commit to seratch/scala that referenced this issue Oct 18, 2020
@dwijnand dwijnand modified the milestones: 2.12.13, Backlog Oct 20, 2020
@SethTisue
Copy link
Member

there doesn't appear to be any such infrastructure. see remarks on scala/scala#9250 . closing since it doesn't seem worth adding infrastructure over

@SethTisue SethTisue modified the milestones: Backlog, 2.12.9 Dec 4, 2020
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

9 participants