Skip to content

Commit 5573281

Browse files
committed
Account for existence of scala's ClassfileAnnotation.
Apparently this thing is not real well tested, as the scaladoc code was written as if it does not exist.
1 parent a854529 commit 5573281

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

src/compiler/scala/tools/nsc/doc/model/ModelFactory.scala

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -842,24 +842,28 @@ class ModelFactory(val global: Global, val settings: doc.Settings) {
842842
lazy val annotationClass =
843843
makeTemplate(annot.symbol)
844844
val arguments = { // lazy
845-
def noParams = annot.args map { _ => None }
845+
def annotArgs = annot.args match {
846+
case Nil => annot.assocs collect { case (_, LiteralAnnotArg(const)) => Literal(const) }
847+
case xs => xs
848+
}
849+
def noParams = annotArgs map (_ => None)
850+
846851
val params: List[Option[ValueParam]] = annotationClass match {
847852
case aClass: DocTemplateEntity with Class =>
848853
(aClass.primaryConstructor map { _.valueParams.head }) match {
849854
case Some(vps) => vps map { Some(_) }
850-
case None => noParams
855+
case _ => noParams
851856
}
852857
case _ => noParams
853858
}
854-
assert(params.length == annot.args.length)
855-
(params zip annot.args) flatMap { case (param, arg) =>
856-
makeTree(arg) match {
857-
case Some(tree) =>
858-
Some(new ValueArgument {
859-
def parameter = param
860-
def value = tree
861-
})
862-
case None => None
859+
assert(params.length == annotArgs.length, (params, annotArgs))
860+
861+
params zip annotArgs flatMap { case (param, arg) =>
862+
makeTree(arg) map { tree =>
863+
new ValueArgument {
864+
def parameter = param
865+
def value = tree
866+
}
863867
}
864868
}
865869
}

0 commit comments

Comments
 (0)