Skip to content

Commit

Permalink
Include default match statement to CaseClassCodec macro
Browse files Browse the repository at this point in the history
Also add compile warnings to the build.

JAVA-4319
  • Loading branch information
jakehschwartz authored and rozza committed Feb 8, 2022
1 parent e557fc4 commit 178a0d4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ private[codecs] object CaseClassCodec {
val instanceValue = value.asInstanceOf[${classType}]
..${writeClassValues(fields, ignoredFields(classType))}"""
}.toSeq
}
} :+ cq"""_ => throw new BsonInvalidOperationException("Unexpected class type: " + className)"""
q"""
writer.writeStartDocument()
this.writeClassFieldName(writer, className, encoderContext)
Expand Down
9 changes: 9 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,15 @@ configure(scalaProjects) {

tasks.withType(ScalaCompile) {
scalaCompileOptions.deprecation = false
if(scalaVersion.startsWith("2.13")) {
scalaCompileOptions.additionalParameters = [
"-feature",
"-unchecked",
"-language:reflectiveCalls",
"-Wconf:cat=deprecation:ws,any:e",
"-Xlint:strict-unsealed-patmat"
]
}
}

tasks.withType(GenerateModuleMetadata) {
Expand Down

0 comments on commit 178a0d4

Please sign in to comment.