You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a problem when I try to use @Nullable and AtomicReferenceFieldUpdater , this snippet:
class A {
static final AtomicReferenceFieldUpdater<A, @Nullable Object> RESULT_UPDATER =
AtomicReferenceFieldUpdater.newUpdater(A.class, Object.class, "result");
volatile @Nullable Object result;
A() {
System.out.println("Set operation result " + RESULT_UPDATER.compareAndSet(this, null, new Object()));
}
}
Gives the following error:
/nullaway-mismatched-nullability/src/main/java/org/example/A.java:8: error: [NullAway] Cannot assign from type AtomicReferenceFieldUpdater<A, Object> to type AtomicReferenceFieldUpdater<A, @Nullable Object> due to mismatched nullability of type parameters
static final AtomicReferenceFieldUpdater<A, @Nullable Object> RESULT_UPDATER =
^
Thanks for the report! This is #1075, and we should fix this particular case in #1131, which we're hoping to land soon! In the meantime, you can write AtomicReferenceFieldUpdater.<A, @Nullable Object>newUpdater(...) as a temporary workaround.
I have a problem when I try to use
@Nullable
andAtomicReferenceFieldUpdater
, this snippet:Gives the following error:
The repository with the reproducible example can be found here
https://github.com/violetagg/nullaway-mismatched-nullability
The text was updated successfully, but these errors were encountered: