From 184cac8ebc23aaa912d760649f80484d3adbb2b2 Mon Sep 17 00:00:00 2001 From: Eugene Vigdorchik Date: Mon, 15 Apr 2013 13:07:04 +0400 Subject: SI-7367 scaladoc crash on constructing the model for annotations. Scaladoc only checks primary constructor when building annotation model. Here we instead find the constructor matching the annotation's symbol. Also change TreeFactory.makeTree to return TreeEntity rather than Option[TreeEntity] and force the caller check for EmptyTree. --- test/scaladoc/run/SI-7367.check | 1 + test/scaladoc/run/SI-7367.scala | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100755 test/scaladoc/run/SI-7367.check create mode 100755 test/scaladoc/run/SI-7367.scala (limited to 'test/scaladoc') diff --git a/test/scaladoc/run/SI-7367.check b/test/scaladoc/run/SI-7367.check new file mode 100755 index 0000000000..3925a0d464 --- /dev/null +++ b/test/scaladoc/run/SI-7367.check @@ -0,0 +1 @@ +Done. \ No newline at end of file diff --git a/test/scaladoc/run/SI-7367.scala b/test/scaladoc/run/SI-7367.scala new file mode 100755 index 0000000000..6e5a317932 --- /dev/null +++ b/test/scaladoc/run/SI-7367.scala @@ -0,0 +1,25 @@ +import scala.tools.nsc.doc.model._ +import scala.tools.partest.ScaladocModelTest + +object Test extends ScaladocModelTest { + override def code = """ + class annot() extends annotation.StaticAnnotation { + def this(a: Any) = this() + } + + @annot(0) + class B + """ + + def scaladocSettings = "" + + def testModel(root: Package) = { + import access._ + val annotations = root._class("B").annotations + assert(annotations.size == 1) + assert(annotations(0).annotationClass == root._class("annot")) + val args = annotations(0).arguments + assert(args.size == 1) + assert(args(0).value.expression == "0") + } +} -- cgit v1.2.3