Packages

o

com.digitalasset.canton

DiscardedFuture

object DiscardedFuture extends WartTraverser

Flags statements that return a scala.concurrent.Future. Typically, we should not discard scala.concurrent.Future because exceptions inside the future may not get logged. Use FutureUtil.doNotAwait to log exceptions and discard the future where necessary.

Also detects discarded cats.data.EitherT[scala.concurrent.Future, ..., ...] and cats.data.OptionT[scala.concurrent.Future, ...] and arbitrary nestings of those. Custom type constructors can be registered to take the same role as scala.concurrent.Future by annotating the type definition with DoNotDiscardLikeFuture.

Also flags usages of scala.collection.IterableOnceOps.foreach and scala.collection.IterableOnceOps.tapEach where the function returns a future-like type.

This wart is a special case of the warts NonUnitStatements and NonUnitForEach and scalac's -Wnonunit-statement flag, in that it warns only if the return type is future-like. Additionally, this wart uses a different set of exceptions when no warning is issued. We keep this specialized wart for two reasons: 1. It is not practically feasible to use -Wnonunit-statement and NonUnitForEach in scalatest because it would flag many of the assertions of the form x should be >= y in statement positions. Yet, it is important to check for discarded futures in tests because a discarded future may hide an exception. 2. In some production code, it is convenient to suppress the warnings coming from -Wnonunit-statement and NonUnitForEach, just due to how the code is written. In such places, we still want to benefit from the explicit checks against discarded futures.

This wart does not look at futures that are discarded at the end of a unit-type expression. These cases are caught by -Ywarn-value-discard. We do not implement a specialized version for future-like values because we do not expect to suppress the warnings coming from -Ywarn-value-discard.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. DiscardedFuture
  2. WartTraverser
  3. AnyRef
  4. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def apply(u: WartUniverse): Traverser
    Definition Classes
    DiscardedFuture → WartTraverser
  5. def asAnnotationMacro(c: Context)(annottees: scala.reflect.macros.blackbox.Context.Expr[Any]*): scala.reflect.macros.blackbox.Context.Expr[Any]
    Definition Classes
    WartTraverser
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def asMacro(c: Context)(expr: scala.reflect.macros.blackbox.Context.Expr[Any]): scala.reflect.macros.blackbox.Context.Expr[Any]
    Definition Classes
    WartTraverser
  8. lazy val className: String
    Definition Classes
    WartTraverser
  9. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  10. def compose(o: WartTraverser): WartTraverser
    Definition Classes
    WartTraverser
  11. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  12. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  13. def error(u: WartUniverse)(pos: scala.reflect.api.Universe.Position, message: String): Unit
    Definition Classes
    WartTraverser
  14. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  15. def hasTypeAscription(u: WartUniverse)(tree: scala.reflect.api.Universe.ValOrDefDef): Boolean
    Definition Classes
    WartTraverser
  16. def hasWartAnnotation(u: WartUniverse)(tree: scala.reflect.api.Universe.Tree): Boolean
    Definition Classes
    WartTraverser
  17. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  18. def isAnonymousFunctionName(u: WartUniverse)(t: scala.reflect.api.Universe.TypeName): Boolean
    Definition Classes
    WartTraverser
  19. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  20. def isPrimitive(u: WartUniverse)(t: scala.reflect.api.Universe.Type): Boolean
    Definition Classes
    WartTraverser
  21. def isPrivate(u: WartUniverse)(t: scala.reflect.api.Universe.ValOrDefDef): Boolean
    Definition Classes
    WartTraverser
  22. def isPublic(u: WartUniverse)(t: scala.reflect.api.Universe.ValOrDefDef): Boolean
    Definition Classes
    WartTraverser
  23. def isSynthetic(u: WartUniverse)(t: scala.reflect.api.Universe.Tree): Boolean
    Definition Classes
    WartTraverser
  24. def isSyntheticPartialFunction(u: WartUniverse)(tree: scala.reflect.api.Universe.Tree): Boolean
    Definition Classes
    WartTraverser
  25. def isWartAnnotation(u: WartUniverse)(a: scala.reflect.api.Universe.Annotation): Boolean
    Definition Classes
    WartTraverser
  26. val message: String
  27. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  28. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  29. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  30. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  31. def toString(): String
    Definition Classes
    AnyRef → Any
  32. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  33. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  34. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  35. def warning(u: WartUniverse)(pos: scala.reflect.api.Universe.Position, message: String): Unit
    Definition Classes
    WartTraverser
  36. lazy val wartName: String
    Definition Classes
    WartTraverser
  37. def wasInferred(u: WartUniverse)(t: scala.reflect.api.Universe.TypeTree): Boolean
    Definition Classes
    WartTraverser

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated @Deprecated
    Deprecated

Inherited from WartTraverser

Inherited from AnyRef

Inherited from Any

Ungrouped