tilgalas commented on code in PR #32081:
URL: https://github.com/apache/beam/pull/32081#discussion_r1816794102
##########
sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/CachingFactory.java:
##########
@@ -39,9 +41,9 @@
public class CachingFactory<CreatedT> implements Factory<CreatedT> {
private transient @Nullable ConcurrentHashMap<TypeDescriptor<?>, CreatedT>
cache = null;
- private final Factory<CreatedT> innerFactory;
+ private final @NotOnlyInitialized Factory<CreatedT> innerFactory;
Review Comment:
so in `RowValueGettersFactory` there's this code:
```
RowValueGettersFactory(Factory<List<FieldValueGetter<T, Object>>>
gettersFactory) {
this.gettersFactory = gettersFactory;
this.cachingGettersFactory = new CachingFactory<>(this);
}
```
since we're in the constructor, the `this` parameter is still not fully
initialized, so by using this annotation we can temporarily (for the duration
of the initalization of the CachingFactory object) allow assigning the
`innerFactory` field a value which itself is under initialization (or indeed
whose initialization status is unknown, as the signature of the CachingFactory
constructor tells us)
see also https://checkerframework.org/manual/#circular-initialization
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]