Skip to content

Commit

Permalink
fix nullability annotations for AtomicReferenceFieldUpdaters after st…
Browse files Browse the repository at this point in the history
…yle: execute CommonStaticAnalys
  • Loading branch information
vlsi committed Jan 4, 2024
1 parent d117b47 commit 56fba6d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@
public class QueryExecutorCloseAction implements Closeable {
private static final Logger LOGGER = Logger.getLogger(QueryExecutorBase.class.getName());

@SuppressWarnings("RedundantCast")
// Cast is needed for checkerframework to accept the code
private static final AtomicReferenceFieldUpdater<QueryExecutorCloseAction, @Nullable PGStream> PG_STREAM_UPDATER =
AtomicReferenceFieldUpdater.newUpdater(
QueryExecutorCloseAction.class, PGStream.class, "pgStream");
QueryExecutorCloseAction.class, (Class<@Nullable PGStream>) PGStream.class, "pgStream");

private volatile @Nullable PGStream pgStream;

Expand Down
5 changes: 4 additions & 1 deletion pgjdbc/src/main/java/org/postgresql/jdbc/PgStatement.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,12 @@ public class PgStatement implements Statement, BaseStatement {
* {@link #CANCEL_TIMER_UPDATER} as per {@link AtomicReferenceFieldUpdater} javadoc.
*/
private volatile @Nullable TimerTask cancelTimerTask;

@SuppressWarnings("RedundantCast")
// Cast is needed for checkerframework to accept the code
private static final AtomicReferenceFieldUpdater<PgStatement, @Nullable TimerTask> CANCEL_TIMER_UPDATER =
AtomicReferenceFieldUpdater.newUpdater(
PgStatement.class, TimerTask.class, "cancelTimerTask");
PgStatement.class, (Class<@Nullable TimerTask>) TimerTask.class, "cancelTimerTask");

/**
* Protects statement from out-of-order cancels. It protects from both
Expand Down

0 comments on commit 56fba6d

Please sign in to comment.