Skip to content

Compiled java annotations with enum parameters are reported as scaladoc errors #4301

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
scabug opened this issue Feb 26, 2011 · 2 comments
Closed

Comments

@scabug
Copy link

scabug commented Feb 26, 2011

The following file compiles nicely with scalac, but makes scaladoc complain about an error (tested with Scala 2.8.1 and the 2011-02-24 nightly):

package org.example

// A randomly chosen Java annotation with corresponding enum:
import java.lang.annotation.{Retention, RetentionPolicy}

// The enum used as a constant in this annotation will be make
// scaladoc signal an error.
@Retention(value=RetentionPolicy.SOURCE)
object Dummy {}

The scaladoc output says that it found one error:

$$ scaladoc Dummy.scala 
Dummy.scala:8: error: annotation argument needs to be a constant; found: RetentionPolicy.SOURCE
@Retention(value=RetentionPolicy.SOURCE)
                                 ^
model contains 0 documentable templates
one error found

As the annotation+enum used here is part of the JDK, and not something I've whipped together myself, I don't think this is a duplicate of bug #2764 (especially considering comments 30 and 31 in that bug).

@scabug
Copy link
Author

scabug commented Feb 26, 2011

Imported From: https://issues.scala-lang.org/browse/SI-4301?orig=1
Reporter: Harald Meland (haraldme)

@scabug
Copy link
Author

scabug commented Mar 31, 2011

@paulp said:
(In r24642) Modified some typer logic to allow annotation arguments for constants
which don't have the form Literal(_). The current logic seems to be
avoided most of the time, but scaladoc breaks when it runs into it.
This closes #4301. I can't figure out from the ticket what the deal
is with #2764 and what is presently happening, but it seems like this
patch could only improve the situation. Review by rytz.

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

1 participant