MCPcopy
hub / github.com/uber-go/nilaway / ProducingAnnotationTrigger

Interface ProducingAnnotationTrigger

annotation/produce_trigger.go:37–67  ·  view source on GitHub ↗

A ProducingAnnotationTrigger is a possible reason that a nil value might be produced All ProducingAnnotationTriggers must embed one of the following 4 structs: -TriggerIfNilable -TriggerIfDeepNilable -ProduceTriggerTautology -ProduceTriggerNever This is because there are interfaces, such as Admits

Source from the content-addressed store, hash-verified

35// This is because there are interfaces, such as AdmitsPrimitive, that are implemented only for those
36// structs, and to which a ProducingAnnotationTrigger must be able to be case
37type ProducingAnnotationTrigger interface {
38 // CheckProduce can be called to determined whether this trigger should be triggered
39 // given a particular Annotation map
40 // for example - a `FuncReturn` trigger triggers iff the corresponding function has
41 // nilable return type
42 CheckProduce(Map) bool
43
44 // NeedsGuardMatch returns whether this production is contingent on being
45 // paired with a guarded consumer.
46 // In other words, this production is only given the freedom to produce
47 // a non-nil value in the case that it is matched with a guarded consumer.
48 // otherwise, it is replaced with annotation.GuardMissing
49 NeedsGuardMatch() bool
50
51 // SetNeedsGuard sets the underlying Guard-Neediness of this ProduceTrigger, if present
52 // This should be very sparingly used, and only with utter conviction of correctness.
53 // Default setting for ProduceTriggers is to not need a guard.
54 SetNeedsGuard(bool)
55
56 Prestring() Prestring
57
58 // Kind returns the kind of the trigger.
59 Kind() TriggerKind
60
61 // UnderlyingSite returns the underlying site this trigger's nilability depends on. If the
62 // trigger always or never fires, the site is nil.
63 UnderlyingSite() Key
64
65 // equals returns true if the passed ProducingAnnotationTrigger is equal to this one
66 equals(ProducingAnnotationTrigger) bool
67}
68
69// TriggerIfNilable is a general trigger indicating that the bad case occurs when a certain Annotation
70// key is nilable

Callers 28

checkErrorsFunction · 0.65
CheckMethod · 0.65
CheckGuardOnFullTriggerFunction · 0.65
AddComputationMethod · 0.65
addReturnConsumersFunction · 0.65
backpropAcrossAssignmentFunction · 0.65
backpropAcrossRangeFunction · 0.65
PrestringMethod · 0.65
PrestringsMethod · 0.65
ProcessEntryMethod · 0.65
typeIsStringFunction · 0.65
getObjInfoFunction · 0.65

Implementers 5

TriggerIfNilableannotation/produce_trigger.go
TriggerIfDeepNilableannotation/produce_trigger.go
ProduceTriggerTautologyannotation/produce_trigger.go
ProduceTriggerNeverannotation/produce_trigger.go
mockProducingAnnotationTriggerannotation/helper_test.go

Calls

no outgoing calls

Tested by

no test coverage detected