From 2ca03384ec4c6a4663c54f1401f476975109bd18 Mon Sep 17 00:00:00 2001 From: "Wesley W. Terpstra" Date: Fri, 8 Dec 2017 14:36:12 -0800 Subject: [PATCH] diplomacy: skip anonymous class names --- src/main/scala/diplomacy/LazyModule.scala | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/scala/diplomacy/LazyModule.scala b/src/main/scala/diplomacy/LazyModule.scala index fe0955e8..f70ff350 100644 --- a/src/main/scala/diplomacy/LazyModule.scala +++ b/src/main/scala/diplomacy/LazyModule.scala @@ -55,7 +55,12 @@ abstract class LazyModule()(implicit val p: Parameters) private def findValName = parent.flatMap(_.childNames.find(_._2 eq this)).map(_._1) - lazy val className = getClass.getName.split('.').last + private def findClassName(c: Class[_]): String = { + val n = c.getName.split('.').last + if (n.contains('$')) findClassName(c.getSuperclass) else n + } + + lazy val className = findClassName(getClass) lazy val valName = suggestedName.orElse(findValName) lazy val outerName = if (nodes.size != 1) None else nodes(0).gco.flatMap(_.lazyModule.valName)