Skip to content

Commit 9ec5ee6

Browse files
committed
Suppress irrelevant ErrorProne warnings
1 parent 3423e01 commit 9ec5ee6

7 files changed

Lines changed: 14 additions & 1 deletion

File tree

core/src/main/java/com/datastax/oss/driver/api/core/cql/Bindable.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public interface Bindable<T extends Bindable<T>>
3131
*
3232
* @throws IndexOutOfBoundsException if the index is invalid.
3333
*/
34+
@SuppressWarnings("ReferenceEquality")
3435
default boolean isSet(int i) {
3536
return getBytesUnsafe(i) != ProtocolConstants.UNSET_VALUE;
3637
}
@@ -43,6 +44,7 @@ default boolean isSet(int i) {
4344
*
4445
* @throws IndexOutOfBoundsException if the id is invalid.
4546
*/
47+
@SuppressWarnings("ReferenceEquality")
4648
default boolean isSet(CqlIdentifier id) {
4749
return getBytesUnsafe(id) != ProtocolConstants.UNSET_VALUE;
4850
}
@@ -55,6 +57,7 @@ default boolean isSet(CqlIdentifier id) {
5557
*
5658
* @throws IndexOutOfBoundsException if the name is invalid.
5759
*/
60+
@SuppressWarnings("ReferenceEquality")
5861
default boolean isSet(String name) {
5962
return getBytesUnsafe(name) != ProtocolConstants.UNSET_VALUE;
6063
}

core/src/main/java/com/datastax/oss/driver/internal/core/channel/StreamIdGenerator.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class StreamIdGenerator {
3737
this.availableIds = this.maxAvailableIds;
3838
}
3939

40+
@SuppressWarnings("NonAtomicVolatileUpdate") // see explanation in class Javadoc
4041
int acquire() {
4142
int id = ids.nextClearBit(0);
4243
if (id >= maxAvailableIds) {
@@ -47,6 +48,7 @@ int acquire() {
4748
return id;
4849
}
4950

51+
@SuppressWarnings("NonAtomicVolatileUpdate")
5052
void release(int id) {
5153
if (ids.get(id)) {
5254
availableIds++;

core/src/main/java/com/datastax/oss/driver/internal/core/metadata/NodeStateManager.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ private void markInitialized() {
115115
isInitialized = true;
116116
}
117117

118+
// Updates to DefaultNode's volatile fields are confined to the admin thread
119+
@SuppressWarnings("NonAtomicVolatileUpdate")
118120
private void onChannelEvent(ChannelEvent event) {
119121
assert adminExecutor.inEventLoop();
120122
if (closeWasCalled) {

core/src/main/java/com/datastax/oss/driver/internal/core/util/concurrent/UncaughtExceptions.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public static <T> void log(Future<T> future) {
5050
}
5151
}
5252

53+
@SuppressWarnings("TypeParameterUnusedInFormals") // type parameter is only needed for chaining
5354
public static <T> T log(Throwable t) {
5455
Loggers.warnWithException(LOG, "Uncaught exception in scheduled task", t);
5556
return null;

core/src/test/java/com/datastax/oss/driver/internal/SerializationHelper.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ public static <T> byte[] serialize(T t) {
3636
}
3737
}
3838

39+
// the calling code performs validations on the result, so this doesn't matter
40+
@SuppressWarnings("TypeParameterUnusedInFormals")
3941
public static <T> T deserialize(byte[] bytes) {
4042
try {
4143
ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(bytes));

core/src/test/java/com/datastax/oss/driver/internal/core/util/concurrent/ScheduledTaskCapturingEventLoop.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
*
4242
* <p>This is used to make unit tests independent of time.
4343
*/
44+
@SuppressWarnings("FunctionalInterfaceClash") // does not matter for test code
4445
public class ScheduledTaskCapturingEventLoop extends DefaultEventLoop {
4546

4647
private final BlockingQueue<CapturedTask> capturedTasks = new ArrayBlockingQueue<>(100);

test-infra/src/main/java/com/datastax/oss/driver/api/testinfra/cluster/SessionUtils.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,19 @@ public static String getConfigPath() {
9696
* in the 0th DC of the provided Cassandra resource as contact points, and the default
9797
* configuration augmented with the provided options.
9898
*/
99+
@SuppressWarnings("TypeParameterUnusedInFormals")
99100
public static <SessionT extends Session> SessionT newSession(
100101
CassandraResourceRule cassandraResource, String... options) {
101102
return newSession(cassandraResource, null, new NodeStateListener[0], options);
102103
}
103104

105+
@SuppressWarnings("TypeParameterUnusedInFormals")
104106
public static <SessionT extends Session> SessionT newSession(
105107
CassandraResourceRule cassandraResource, CqlIdentifier keyspace, String... options) {
106108
return newSession(cassandraResource, keyspace, new NodeStateListener[0], options);
107109
}
108110

109-
@SuppressWarnings("unchecked")
111+
@SuppressWarnings({"unchecked", "TypeParameterUnusedInFormals"})
110112
public static <SessionT extends Session> SessionT newSession(
111113
CassandraResourceRule cassandraResource,
112114
CqlIdentifier keyspace,

0 commit comments

Comments
 (0)