Skip to content

Commit

Permalink
make registration regex more universal (#181)
Browse files Browse the repository at this point in the history
* make registration regex more universal

* misspell fix
  • Loading branch information
LukaszKontowski authored Jul 5, 2022
1 parent 196ab12 commit 657f29d
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,17 @@ object Register {
//noinspection LanguageFeature
def REGISTRATION_REGEX: String = macro regexImpl

private val circeRegex = """org\.virtuslab\.ash\.circe\.Registration\[.*\]"""
/**
* `circeRegex` is the preferred typeRegexPattern for Circe Akka Serializer usage. It contains leading
* and trailing `.*` - so that it matches both single Registration and multiple Registrations in a collection.
* It is used by the codec-registration-checker-plugin to collect properly registered codecs.
*
* As codec-registration-checker-plugin searches for `circeRegex` occurrences in the generated AST - and detects
* proper registrations if detected type contains the regex - there might be some rare corner cases, where
* something like `Option[Register[User_Defined_Type]]` is in the AST and codec-registration-checker-plugin would
* still treat it as proper registration. However, such situations have not been encountered in real usages.
*/
private val circeRegex = """.*org\.virtuslab\.ash\.circe\.Registration\[.*\].*"""

def regexImpl(c: blackbox.Context): c.Expr[String] = {
import c.universe._
Expand Down

0 comments on commit 657f29d

Please sign in to comment.