[analysis api] rename ValidityToken -> KtLifetimeToken
This commit is contained in:
@@ -19,7 +19,7 @@ fun KtAnalysisSession.getSymbol() : KtSymbol {
|
||||
}
|
||||
```
|
||||
|
||||
## No leakages of ValidityTokenOwners from KtAnalysisSession context
|
||||
All `ValidityTokenOwners` you get inside a `KtAnalysisSessoin` context should never leak it. But you may:
|
||||
* Store your `ValidityTokenOwners` as a field inside a class that implements `ValidityTokenOwners`. This way your outer class is `ValidityTokenOwners` itself and all rules apply to it.
|
||||
## No leakages of KtLifetimeTokenOwners from KtAnalysisSession context
|
||||
All `KtLifetimeTokenOwners` you get inside a `KtAnalysisSessoin` context should never leak it. But you may:
|
||||
* Store your `KtLifetimeTokenOwners` as a field inside a class that implements `KtLifetimeTokenOwners`. This way your outer class is `KtLifetimeTokenOwners` itself and all rules apply to it.
|
||||
* Pass it to another function with a `KtAnalysisSessoin` receiver.
|
||||
@@ -50,11 +50,11 @@ Where `action` lambda represents the **KtAnalysisSession Scope**.
|
||||
|
||||
## Lifecycle Owners
|
||||
|
||||
Every Lifecycle Owner has its lifecycle which is defined by corresponding `ValidityToken`. There is a special
|
||||
Every Lifecycle Owner has its lifecycle which is defined by corresponding `KtLifetimeToken`. There is a special
|
||||
function `analyseWithCustomToken` which allows specifying needed behaviour. There are also analyse function which is made for the IDE which
|
||||
analyses with `ReadActionConfinementValidityToken`
|
||||
analyses with `KtReadActionConfinementLifetimeToken`
|
||||
|
||||
`ReadActionConfinementValidityToken` has the following contracts:
|
||||
`KtReadActionConfinementLifetimeToken` has the following contracts:
|
||||
|
||||
* Accessibility contracts
|
||||
* Analysis should not be called from **EDT Thread**
|
||||
|
||||
@@ -110,9 +110,9 @@ If you fixed a bug or added new functionality to an existing feature, consider a
|
||||
|
||||
## Follow Analysis API Implementation Contracts
|
||||
|
||||
* Add `ValidityTokenOwner` as supertype for all declarations which contains other `ValidityTokenOwner` inside (eg, via parameter types,
|
||||
function return types) to ensure that internal `ValidityTokenOwner` are not exposed via your declaration.
|
||||
* You have some declaration which implements `ValidityTokenOwner`. It means that this declaration has a lifetime. And this declaration has
|
||||
* Add `KtLifetimeTokenOwner` as supertype for all declarations which contains other `KtLifetimeTokenOwner` inside (eg, via parameter types,
|
||||
function return types) to ensure that internal `KtLifetimeTokenOwner` are not exposed via your declaration.
|
||||
* You have some declaration which implements `KtLifetimeTokenOwner`. It means that this declaration has a lifetime. And this declaration has
|
||||
to be checked to ensure that it is not used after its lifetime has come to the end. To ensure that all methods(except `hashCode`/`equals`
|
||||
/`toString`) and properties should be wrapped into `withValidityAssertion { .. }` check:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user