aboutsummaryrefslogtreecommitdiff
path: root/src/main/scala/firrtl/annotations/Annotation.scala
diff options
context:
space:
mode:
authorChick Markley2021-11-12 12:29:48 -0800
committerGitHub2021-11-12 20:29:48 +0000
commitc6093cbcd4f2eb8acd44f3b9d4e7146448de172f (patch)
tree2a4fbac4a669f901dc4bb26e7f1c8acf0741e557 /src/main/scala/firrtl/annotations/Annotation.scala
parent03af969ad33631f53b69370705328bf4ada3ed64 (diff)
Let firrtl based applications run despite loading unknown annotations (#2387)
An application like barstools may contain a main that loads an annotations file containing annotation classes that are not on it's classpath. This change allows unknown annotations to be preserved by wrapping them in a UnrecognizedAnnotation. If annotations are then output to a file, they will be unwrapped during serialization This feature can be enabled via an AllowUnrecognizedAnnotations annotation Co-authored-by: chick <chick.markley@sifive.com> Co-authored-by: Jack Koenig <koenig@sifive.com>
Diffstat (limited to 'src/main/scala/firrtl/annotations/Annotation.scala')
-rw-r--r--src/main/scala/firrtl/annotations/Annotation.scala3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/main/scala/firrtl/annotations/Annotation.scala b/src/main/scala/firrtl/annotations/Annotation.scala
index f4d6ee55..c6145c86 100644
--- a/src/main/scala/firrtl/annotations/Annotation.scala
+++ b/src/main/scala/firrtl/annotations/Annotation.scala
@@ -4,6 +4,7 @@ package firrtl
package annotations
import firrtl.options.StageUtils
+import org.json4s.JValue
import scala.collection.Traversable
@@ -165,3 +166,5 @@ object Annotation
case class DeletedAnnotation(xFormName: String, anno: Annotation) extends NoTargetAnnotation {
override def serialize: String = s"""DELETED by $xFormName\n${anno.serialize}"""
}
+
+case class UnrecognizedAnnotation(underlying: JValue) extends NoTargetAnnotation