Skip to content

Commit

Permalink
Fix compilation warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
danslapman committed Mar 10, 2024
1 parent ea92b1b commit b236035
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package ru.tinkoff.tcb.bson.derivation

import derevo.derive
import org.mongodb.scala.bson.BsonDocument
import org.scalacheck.Arbitrary
import org.scalacheck.Gen
Expand All @@ -10,17 +9,8 @@ import org.scalatest.matchers.should.Matchers
import org.scalatestplus.scalacheck.Checkers

import ru.tinkoff.tcb.bson.*
import ru.tinkoff.tcb.bson.annotation.BsonDiscriminator

class DerivedCodecsSuite extends AnyFunSuite with Checkers with Matchers with TryValues {

// Stolen from http://github.com/travisbrown/circe
@derive(bsonDecoder, bsonEncoder) @BsonDiscriminator("case", _.reverse)
sealed trait RecursiveAdtExample
final case class BaseAdtExample(a: String) extends RecursiveAdtExample
final case class NestedAdtExample(r: RecursiveAdtExample) extends RecursiveAdtExample
object RecursiveAdtExample

private def atDepth(depth: Int): Gen[RecursiveAdtExample] =
if (depth < 3)
Gen.oneOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import java.time.Year

import derevo.derive

import ru.tinkoff.tcb.bson.annotation.BsonDiscriminator
import ru.tinkoff.tcb.bson.annotation.BsonKey

@derive(bsonDecoder, bsonEncoder)
Expand Down Expand Up @@ -35,3 +36,10 @@ final case class TestEntityWithDefaults(
linkId: Option[Int],
checks: Seq[TestCheck] = Seq()
)

// Stolen from http://github.com/travisbrown/circe
@derive(bsonDecoder, bsonEncoder) @BsonDiscriminator("case", _.reverse)
sealed trait RecursiveAdtExample
final case class BaseAdtExample(a: String) extends RecursiveAdtExample
final case class NestedAdtExample(r: RecursiveAdtExample) extends RecursiveAdtExample
object RecursiveAdtExample
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import org.scalatest.funsuite.AnyFunSuite
import org.scalatest.matchers.should.Matchers

class FieldsSpec extends AnyFunSuite with Matchers {
case class Evidence()

test("Fields of empty case class") {
Fields[Evidence].fields shouldBe Nil
}
Expand All @@ -16,11 +14,13 @@ class FieldsSpec extends AnyFunSuite with Matchers {
Fields[Projection].fields shouldBe List("ev", "label")
}

sealed trait ST
final case class A(a: Int) extends ST
final case class B(b: Int) extends ST

test("Fields of sealed trait") {
Fields[ST].fields shouldBe Nil
}
}

final case class Evidence()

sealed trait ST
final case class A(a: Int) extends ST
final case class B(b: Int) extends ST
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import java.security.cert.X509Certificate
import javax.net.ssl.SSLEngine
import javax.net.ssl.TrustManagerFactory
import javax.net.ssl.X509ExtendedTrustManager
import scala.annotation.nowarn

/*
Rewritten from https://github.com/line/armeria/blob/main/core/src/main/java/com/linecorp/armeria/client/IgnoreHostsTrustManager.java
Expand Down Expand Up @@ -47,8 +48,9 @@ class TrustSomeHostsManager(delegate: X509ExtendedTrustManager, insecureHosts: S
}

object TrustSomeHostsManager {
@nowarn("cat=lint-nonlocal-return")
def of(insecureHosts: Set[String]): TrustSomeHostsManager = {
var trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm)
val trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm)
trustManagerFactory.init(null.asInstanceOf[KeyStore])
val trustManagers = trustManagerFactory.getTrustManagers
for (tm <- trustManagers)
Expand Down

0 comments on commit b236035

Please sign in to comment.