Skip to content

Fix gradle 9 warnings and bump antlr version #3354

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private static BigInteger toIndex(int numBits, long... transposedIndexes) {
for (int i = 0; i < numBits; i++) {
for (final long transposedIndex : transposedIndexes) {
if ((transposedIndex & mask) != 0) {
b[b.length - 1 - bIndex / 8] |= 1 << (bIndex % 8);
b[b.length - 1 - bIndex / 8] |= (byte)(1 << (bIndex % 8));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm confused how this change relates to Gradle 9. Looking at the logs, there still seem to be a bunch of gradle warnings, and no changes in this PR to fix the gradle files. Meanwhile #3358 Seems to be tackling a similar goal, and has no changes to the java code.
It also seems better to split the gradle 9 warning changes, and the antlr upgrade into separate PRs.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually hit this also and decided not to address it in #3358: this change is about upgrading the JDK, not Gradle. If you compile with JDK23 from main, these show up today.

}
bIndex--;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public Map<String, Object> getLogInfo() {
*/
@Nonnull
@Override
public LoggableKeysAndValuesImpl addLogInfo(@Nonnull String description, Object object) {
public final LoggableKeysAndValuesImpl addLogInfo(@Nonnull String description, Object object) {
if (logInfo == null) {
logInfo = new HashMap<>();
}
Expand All @@ -98,7 +98,7 @@ public LoggableKeysAndValuesImpl addLogInfo(@Nonnull String description, Object
*/
@Nonnull
@Override
public LoggableKeysAndValuesImpl addLogInfo(@Nonnull Object ... keyValue) {
public final LoggableKeysAndValuesImpl addLogInfo(@Nonnull Object ... keyValue) {
if ((keyValue.length % 2) != 0) {
throw new IllegalArgumentException("Unbalanced key/value logging info");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public class LoggableTimeoutException extends TimeoutException implements Loggab
*
* @see #addLogInfo(Object...)
*/
@SuppressWarnings("this-escape")
public LoggableTimeoutException(@Nonnull Throwable cause, @Nullable Object... keyValues) {
super();
super.initCause(cause);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ public static <T> RecordCursorResult<T> exhausted() {
public static class IllegalResultValueAccessException extends RecordCoreException {
private static final long serialVersionUID = 1;

@SuppressWarnings("this-escape")
public IllegalResultValueAccessException(@Nonnull RecordCursorContinuation continuation, @Nonnull RecordCursor.NoNextReason noNextReason) {
super("Tried to call get() on a RecordCoreResult that did not have a next value.");
addLogInfo("continuation", continuation);
Expand All @@ -308,6 +309,7 @@ public IllegalResultValueAccessException(@Nonnull RecordCursorContinuation conti
public static class IllegalResultNoNextReasonAccessException extends RecordCoreException {
private static final long serialVersionUID = 1;

@SuppressWarnings("this-escape")
public IllegalResultNoNextReasonAccessException(@Nullable Object value, @Nonnull RecordCursorContinuation continuation) {
super("Tried to call noNextReason() on a RecordCoreResult that had a next value.");
addLogInfo("value", value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public boolean isClosed() {

@Nonnull
@Override
public Executor getExecutor() {
public final Executor getExecutor() {
return inner.getExecutor();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ public Object getSubspaceTupleKey() {
* @param subspaceKey the key used to determine this index's subspace prefix
* @see #getSubspaceKey()
*/
public void setSubspaceKey(@Nonnull Object subspaceKey) {
public final void setSubspaceKey(@Nonnull Object subspaceKey) {
useExplicitSubspaceKey = true;
this.subspaceKey = normalizeSubspaceKey(name, subspaceKey);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public JoinConstituent(@Nonnull String name, @Nonnull RecordTypeBuilder recordTy
this.outerJoined = outerJoined;
}

public boolean isOuterJoined() {
public final boolean isOuterJoined() {
return outerJoined;
}

Expand Down Expand Up @@ -116,6 +116,7 @@ public JoinedRecordTypeBuilder(@Nonnull String name, @Nonnull Object recordTypeK
super(name, recordTypeKey, metaDataBuilder);
}

@SuppressWarnings("this-escape")
public JoinedRecordTypeBuilder(@Nonnull RecordMetaDataProto.JoinedRecordType typeProto, @Nonnull RecordMetaDataBuilder metaDataBuilder) {
super(typeProto.getName(), LiteralKeyExpression.fromProtoValue(typeProto.getRecordTypeKey()), metaDataBuilder);
for (RecordMetaDataProto.JoinedRecordType.JoinConstituent joinConstituent : typeProto.getJoinConstituentsList()) {
Expand All @@ -140,7 +141,7 @@ protected JoinConstituent newConstituent(@Nonnull String name, @Nonnull RecordTy
* @return the newly added constituent
*/
@Nonnull
public JoinConstituent addConstituent(@Nonnull String name, @Nonnull RecordTypeBuilder recordType, boolean isOuterJoined) {
public final JoinConstituent addConstituent(@Nonnull String name, @Nonnull RecordTypeBuilder recordType, boolean isOuterJoined) {
return addConstituent(new JoinConstituent(name, recordType, isOuterJoined));
}

Expand All @@ -162,7 +163,7 @@ public List<Join> getJoins() {
* @return the newly added join
*/
@Nonnull
public Join addJoin(@Nonnull String left, @Nonnull KeyExpression leftExpression, @Nonnull String right, @Nonnull KeyExpression rightExpression) {
public final Join addJoin(@Nonnull String left, @Nonnull KeyExpression leftExpression, @Nonnull String right, @Nonnull KeyExpression rightExpression) {
if (leftExpression.getColumnSize() != rightExpression.getColumnSize()) {
throw new RecordCoreArgumentException("Two sides of join are not the same size and will never match")
.addLogInfo("left", leftExpression, "right", rightExpression);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ protected RecordTypeIndexesBuilder(@Nonnull String name, @Nonnull RecordTypeInde
}

@Nonnull
public String getName() {
public final String getName() {
return name;
}

@Nonnull
public List<Index> getIndexes() {
public final List<Index> getIndexes() {
return indexes;
}

Expand All @@ -74,12 +74,12 @@ public List<Index> getIndexes() {
* @return a list of all indexes that include this record type along with other types.
*/
@Nonnull
public List<Index> getMultiTypeIndexes() {
public final List<Index> getMultiTypeIndexes() {
return multiTypeIndexes;
}

@Nullable
public Object getRecordTypeKey() {
public final Object getRecordTypeKey() {
return recordTypeKey;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public List<C> getConstituents() {
* @return the newly added constituent
*/
@Nonnull
protected C addConstituent(@Nonnull C constituent) {
protected final C addConstituent(@Nonnull C constituent) {
constituents.add(constituent);
return constituent;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ public UnnestedRecordTypeBuilder(@Nonnull final String name, @Nonnull Object rec
}

@API(API.Status.INTERNAL)
@SuppressWarnings("this-escape")
public UnnestedRecordTypeBuilder(@Nonnull RecordMetaDataProto.UnnestedRecordType typeProto, @Nonnull final RecordMetaDataBuilder metaDataBuilder) {
super(typeProto.getName(), LiteralKeyExpression.fromProtoValue(typeProto.getRecordTypeKey()), metaDataBuilder);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ public UnsplittableKeyExpressionException(@Nonnull BaseKeyExpression keyExpressi
public static class IllegalSubKeyException extends RecordCoreException {
public static final long serialVersionUID = 1L;

@SuppressWarnings("this-escape")
public IllegalSubKeyException(int start, int end, int columnSize) {
super("requested subkey is invalid");
addLogInfo(LogMessageKeys.REQUESTED_START, start);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public class FDBRecordContext extends FDBTransactionContext implements AutoClose
@Nullable
private List<Range> notCommittedConflictingKeys = null;
@Nonnull
private final LockRegistry lockRegistry = new LockRegistry(this.getTimer());
private final LockRegistry lockRegistry;
@Nonnull
private final TempTable.Factory tempTableFactory = TempTable.Factory.instance();

Expand All @@ -181,6 +181,7 @@ protected FDBRecordContext(@Nonnull FDBDatabase fdb,
@Nonnull FDBRecordContextConfig config,
@Nullable FDBStoreTimer delayedTimer) {
super(fdb, transaction, config.getTimer(), delayedTimer);
lockRegistry = new LockRegistry(timer);
this.transactionCreateTime = System.currentTimeMillis();
this.localVersion = new AtomicInteger(0);
this.localVersionCache = new ConcurrentSkipListMap<>(ByteArrayUtil::compareUnsigned);
Expand Down Expand Up @@ -532,7 +533,7 @@ private CompletableFuture<Void> delayedCommit() {

@Override
@Nonnull
public Transaction ensureActive() {
public final Transaction ensureActive() {
if (transaction == null) {
throw new RecordCoreStorageException("Transaction is no longer active.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5202,7 +5202,7 @@ protected Builder(FDBRecordStore store) {
* Copy state from another store builder.
* @param other the record store builder whose state to take
*/
public void copyFrom(@Nonnull Builder other) {
public final void copyFrom(@Nonnull Builder other) {
this.serializer = other.serializer;
this.formatVersion = other.formatVersion;
this.metaDataProvider = other.metaDataProvider;
Expand All @@ -5222,7 +5222,7 @@ public void copyFrom(@Nonnull Builder other) {
* Copy state from a record store.
* @param store the record store whose state to take
*/
public void copyFrom(@Nonnull FDBRecordStore store) {
public final void copyFrom(@Nonnull FDBRecordStore store) {
this.serializer = store.serializer;
this.formatVersion = store.formatVersion;
this.metaDataProvider = store.metaDataProvider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public boolean isAPIVersionAtLeast(@Nonnull APIVersion apiVersion) {
}

@Nullable
public FDBStoreTimer getTimer() {
public final FDBStoreTimer getTimer() {
return timer;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,7 @@ public CompletableFuture<Void> rebuildIndexAsync(@Nonnull FDBRecordStore store)

abstract CompletableFuture<Void> rebuildIndexInternalAsync(FDBRecordStore store);

protected void validateOrThrowEx(boolean isValid, @Nonnull String msg) {
protected final void validateOrThrowEx(boolean isValid, @Nonnull String msg) {
if (!isValid) {
throw new ValidationException(msg,
LogMessageKeys.INDEX_NAME, common.getTargetIndexesNames(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ enum FragmentIterationType {
RECOVER // 3rd iteration: presently throws an error, letting the caller handle recovery..
}

@SuppressWarnings("this-escape")
public IndexingMutuallyByRecords(@Nonnull final IndexingCommon common, @Nonnull final OnlineIndexer.IndexingPolicy policy,
@Nullable List<Tuple> fragmentBoundaries) {
super(common, policy);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public class InstrumentedTransaction extends InstrumentedReadTransaction<Transac
private final long startNanos;
private boolean endTimeRecorded = false;

@SuppressWarnings("this-escape")
public InstrumentedTransaction(@Nullable StoreTimer timer,
@Nullable StoreTimer delayedTimer,
@Nonnull FDBDatabase database,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ public static class Builder extends OnlineIndexOperationBaseBuilder<Builder> {
ScrubbingPolicy scrubbingPolicy = null;
ScrubbingPolicy.Builder scrubbingPolicyBuilder = null;

@SuppressWarnings("this-escape")
protected Builder() {
setLimit(2000);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ private IndexingBase getIndexer() {
* that contains no keys which have yet been processed by the {@link OnlineIndexer}
* during an index build.
*/
@SuppressWarnings("serial")
@SuppressWarnings({"serial", "this-escape"})
public static class RecordBuiltRangeException extends RecordCoreException {
public RecordBuiltRangeException(@Nullable Tuple start, @Nullable Tuple end) {
super("Range specified as unbuilt contained subranges that had already been built");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,7 @@ private void logKey(@Nonnull String staticMessage, boolean done) {
/**
* Exception thrown when only part of a split record is found.
*/
@SuppressWarnings("serial")
@SuppressWarnings({"serial", "this-escape"})
public static class FoundSplitWithoutStartException extends RecordCoreException {
public FoundSplitWithoutStartException(long nextIndex, boolean reverse) {
super("Found split record without start");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ protected <M extends Message> CompletableFuture<Void> updateIndexKeys(@Nonnull f
// Otherwise the entry must already exist for us to be removing it,
// so there is no danger that this will store all (but one) ones in a new key.
Arrays.fill(bitmap, (byte)0xFF);
bitmap[offset / 8] &= ~(byte)(1 << (offset % 8));
bitmap[offset / 8] &= (byte)~(byte)(1 << (offset % 8));
state.transaction.mutate(MutationType.BIT_AND, key, bitmap);
Arrays.fill(bitmap, (byte)0x00);
state.transaction.mutate(MutationType.COMPARE_AND_CLEAR, key, bitmap);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public class KeySpaceDirectory {
* @throws RecordCoreArgumentException if the provided value constant value is not valid for the
* type of directory being created
*/
@SuppressWarnings("PMD.CompareObjectsWithEquals")
@SuppressWarnings({"PMD.CompareObjectsWithEquals", "this-escape"})
public KeySpaceDirectory(@Nonnull String name, @Nonnull KeyType keyType, @Nullable Object value,
@Nullable Function<KeySpacePath, KeySpacePath> wrapper) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
public class NoSuchDirectoryException extends RecordCoreException {
private static final long serialVersionUID = 1L;

@SuppressWarnings("this-escape")
public NoSuchDirectoryException(@Nonnull KeySpaceDirectory rootDirectory, @Nonnull String subdir) {
super("No such directory");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public TimeWindowLeaderboardDirectory(boolean highScoreFirst) {
this.highScoreFirst = highScoreFirst;
}

@SuppressWarnings("this-escape")
protected TimeWindowLeaderboardDirectory(TimeWindowLeaderboardProto.TimeWindowLeaderboardDirectory proto) {
highScoreFirst = proto.getHighScoreFirst();
updateTimestamp = proto.getUpdateTimestamp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public RecordQuery getRecordQuery() {
return recordQuery;
}

public Set<String> getParameters() {
public final Set<String> getParameters() {
return parametersSupplier.get();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1345,7 +1345,7 @@ public ExplainTokensWithPrecedence explain() {

@Nonnull
@Override
public String getParameter() {
public final String getParameter() {
return parameter;
}

Expand All @@ -1369,7 +1369,7 @@ public int hashCode() {
return hashCodeSupplier.get();
}

public int computeHashCode() {
public final int computeHashCode() {
return Objects.hash(type, relatedByEquality());
}

Expand Down Expand Up @@ -1678,7 +1678,7 @@ public int hashCode() {
return hashCodeSupplier.get();
}

public int computeHashCode() {
public final int computeHashCode() {
return Objects.hash(type.name(), relatedByEquality());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public RecordQueryPlanComplexityException(@Nonnull String msg) {
super(msg);
}

@SuppressWarnings("this-escape")
public RecordQueryPlanComplexityException(RecordQueryPlan plan) {
this("Plan exceeds complexity threshold");
addLogInfo(LogMessageKeys.PLAN, ExplainPlanVisitor.toStringForExternalExplain(plan, ExplainLevel.ALL_DETAILS, 1_000));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ protected void update() {
* consumed upon read to lazily compute the properties of the plan passed in.
* @param expression new expression to be added
*/
public void add(@Nonnull final RelationalExpression expression) {
public final void add(@Nonnull final RelationalExpression expression) {
toBeInsertedExpressions.add(narrow(expression));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ protected Ordering(@Nonnull final SetMultimap<Value, Binding> bindingMap,
}

@Nonnull
public SetMultimap<Value, Binding> getBindingMap() {
public final SetMultimap<Value, Binding> getBindingMap() {
return bindingMap;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ protected OrderingPart(@Nonnull final Value value, @Nonnull final S sortOrder) {
}

@Nonnull
public Value getValue() {
public final Value getValue() {
return value;
}

@Nonnull
public S getSortOrder() {
public final S getSortOrder() {
return sortOrder;
}

Expand Down Expand Up @@ -95,7 +95,7 @@ public int hashCode() {
return hashCodeSupplier.get();
}

public int computeHashCode() {
public final int computeHashCode() {
return Objects.hash(getValue(), getSortOrder().name());
}

Expand Down
Loading
Loading