From 1d4a816d03ec8caa7b8fba57b5144039db36571f Mon Sep 17 00:00:00 2001 From: Vladimir Sitnikov Date: Sun, 30 Aug 2020 18:53:36 +0300 Subject: [PATCH] Annotate equals methods with Nullable in src/core/main --- core/build.gradle.kts | 1 + .../java/org/apache/calcite/interpreter/Row.java | 4 +++- .../org/apache/calcite/jdbc/JavaRecordType.java | 4 +++- .../org/apache/calcite/materialize/Lattice.java | 4 ++-- .../calcite/materialize/LatticeSuggester.java | 4 ++-- .../apache/calcite/materialize/LatticeTable.java | 4 +++- .../materialize/MaterializationActor.java | 4 +++- .../calcite/materialize/MaterializationKey.java | 4 +++- .../org/apache/calcite/materialize/Path.java | 4 +++- .../org/apache/calcite/materialize/Step.java | 4 +++- .../org/apache/calcite/materialize/TileKey.java | 4 +++- .../apache/calcite/plan/RelCompositeTrait.java | 4 +++- .../org/apache/calcite/plan/RelOptCostImpl.java | 4 +++- .../java/org/apache/calcite/plan/RelOptRule.java | 4 +++- .../apache/calcite/plan/RelOptRuleOperand.java | 4 +++- .../org/apache/calcite/plan/RelTraitSet.java | 4 +++- .../calcite/plan/hep/HepRelMetadataProvider.java | 4 +++- .../apache/calcite/plan/volcano/VolcanoCost.java | 4 +++- .../plan/volcano/VolcanoRelMetadataProvider.java | 4 +++- .../apache/calcite/prepare/RelOptTableImpl.java | 4 +++- .../org/apache/calcite/profile/Profiler.java | 4 +++- .../org/apache/calcite/profile/ProfilerImpl.java | 4 +++- .../apache/calcite/profile/SimpleProfiler.java | 4 +++- .../org/apache/calcite/rel/AbstractRelNode.java | 5 +++-- .../org/apache/calcite/rel/RelCollationImpl.java | 4 +++- .../org/apache/calcite/rel/RelDistributions.java | 4 +++- .../apache/calcite/rel/RelFieldCollation.java | 4 +++- .../apache/calcite/rel/core/AggregateCall.java | 4 +++- .../apache/calcite/rel/core/CorrelationId.java | 4 +++- .../java/org/apache/calcite/rel/core/Match.java | 4 +++- .../java/org/apache/calcite/rel/core/Window.java | 6 ++++-- .../calcite/rel/hint/HintStrategyTable.java | 3 ++- .../org/apache/calcite/rel/hint/RelHint.java | 2 +- .../calcite/rel/logical/LogicalWindow.java | 4 +++- .../rel/metadata/ChainedRelMetadataProvider.java | 4 +++- .../rel/metadata/JaninoRelMetadataProvider.java | 5 +++-- .../calcite/rel/metadata/RelColumnOrigin.java | 4 +++- .../calcite/rel/mutable/MutableAggregate.java | 4 +++- .../apache/calcite/rel/mutable/MutableCalc.java | 4 +++- .../calcite/rel/mutable/MutableCollect.java | 4 +++- .../calcite/rel/mutable/MutableCorrelate.java | 4 +++- .../calcite/rel/mutable/MutableExchange.java | 4 +++- .../calcite/rel/mutable/MutableFilter.java | 4 +++- .../apache/calcite/rel/mutable/MutableJoin.java | 4 +++- .../apache/calcite/rel/mutable/MutableMatch.java | 4 +++- .../calcite/rel/mutable/MutableProject.java | 4 +++- .../calcite/rel/mutable/MutableSample.java | 4 +++- .../apache/calcite/rel/mutable/MutableScan.java | 4 +++- .../apache/calcite/rel/mutable/MutableSetOp.java | 4 +++- .../apache/calcite/rel/mutable/MutableSort.java | 4 +++- .../rel/mutable/MutableTableFunctionScan.java | 4 +++- .../calcite/rel/mutable/MutableTableModify.java | 4 +++- .../calcite/rel/mutable/MutableUncollect.java | 4 +++- .../calcite/rel/mutable/MutableValues.java | 4 +++- .../calcite/rel/mutable/MutableWindow.java | 4 +++- .../calcite/rel/type/RelDataTypeFactoryImpl.java | 4 +++- .../calcite/rel/type/RelDataTypeFieldImpl.java | 4 +++- .../apache/calcite/rel/type/RelDataTypeImpl.java | 4 +++- .../java/org/apache/calcite/rex/RexCall.java | 4 +++- .../apache/calcite/rex/RexCorrelVariable.java | 4 +++- .../org/apache/calcite/rex/RexDynamicParam.java | 4 +++- .../org/apache/calcite/rex/RexFieldAccess.java | 4 +++- .../java/org/apache/calcite/rex/RexInputRef.java | 4 +++- .../java/org/apache/calcite/rex/RexLiteral.java | 4 +++- .../java/org/apache/calcite/rex/RexLocalRef.java | 4 +++- .../java/org/apache/calcite/rex/RexNode.java | 2 +- .../java/org/apache/calcite/rex/RexOver.java | 4 +++- .../java/org/apache/calcite/rex/RexRangeRef.java | 4 +++- .../java/org/apache/calcite/rex/RexSubQuery.java | 4 +++- .../org/apache/calcite/rex/RexTableInputRef.java | 6 ++++-- .../java/org/apache/calcite/rex/RexWindow.java | 4 +++- .../org/apache/calcite/rex/RexWindowBounds.java | 8 +++++--- .../org/apache/calcite/runtime/Automaton.java | 4 +++- .../org/apache/calcite/runtime/ConsList.java | 4 +++- .../calcite/runtime/DeterministicAutomaton.java | 4 +++- .../org/apache/calcite/runtime/FlatLists.java | 16 +++++++++------- .../apache/calcite/runtime/JsonFunctions.java | 4 +++- .../java/org/apache/calcite/runtime/Matcher.java | 6 ++++-- .../org/apache/calcite/runtime/Resources.java | 4 +++- .../java/org/apache/calcite/schema/Schemas.java | 4 +++- .../calcite/schema/impl/LongSchemaVersion.java | 4 +++- .../org/apache/calcite/sql/SqlCollation.java | 4 +++- .../apache/calcite/sql/SqlIntervalLiteral.java | 4 +++- .../java/org/apache/calcite/sql/SqlLiteral.java | 4 +++- .../java/org/apache/calcite/sql/SqlOperator.java | 4 +++- .../apache/calcite/sql/parser/SqlParserPos.java | 4 +++- .../java/org/apache/calcite/sql/util/IdPair.java | 4 +++- .../org/apache/calcite/sql/util/SqlString.java | 4 +++- .../calcite/sql/validate/SqlMonikerImpl.java | 4 +++- .../apache/calcite/sql2rel/RelDecorrelator.java | 7 ++++--- .../calcite/sql2rel/SqlToRelConverter.java | 3 ++- .../java/org/apache/calcite/tools/RuleSets.java | 4 +++- .../java/org/apache/calcite/util/BitString.java | 4 +++- .../java/org/apache/calcite/util/DateString.java | 4 +++- .../org/apache/calcite/util/ImmutableBitSet.java | 4 +++- .../apache/calcite/util/ImmutableIntList.java | 4 +++- .../java/org/apache/calcite/util/NameMap.java | 4 +++- .../org/apache/calcite/util/NameMultimap.java | 4 +++- .../java/org/apache/calcite/util/NameSet.java | 4 +++- .../java/org/apache/calcite/util/NlsString.java | 4 +++- .../main/java/org/apache/calcite/util/Pair.java | 4 +++- .../org/apache/calcite/util/Permutation.java | 4 +++- .../java/org/apache/calcite/util/TimeString.java | 4 +++- .../calcite/util/TimeWithTimeZoneString.java | 4 +++- .../org/apache/calcite/util/TimestampString.java | 4 +++- .../util/TimestampWithTimeZoneString.java | 4 +++- .../apache/calcite/util/graph/DefaultEdge.java | 4 +++- .../org/apache/calcite/util/mapping/IntPair.java | 4 +++- .../apache/calcite/util/mapping/Mappings.java | 4 +++- 109 files changed, 329 insertions(+), 125 deletions(-) diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 56ce9f4de67..19ce60eb31c 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -56,6 +56,7 @@ dependencies { implementation("net.hydromatic:aggdesigner-algorithm") implementation("org.apache.commons:commons-dbcp2") implementation("org.apache.commons:commons-lang3") + implementation("org.checkerframework:checker-qual") implementation("commons-io:commons-io") implementation("org.codehaus.janino:commons-compiler") implementation("org.codehaus.janino:janino") diff --git a/core/src/main/java/org/apache/calcite/interpreter/Row.java b/core/src/main/java/org/apache/calcite/interpreter/Row.java index 365d5f7e6ac..3df38843b58 100644 --- a/core/src/main/java/org/apache/calcite/interpreter/Row.java +++ b/core/src/main/java/org/apache/calcite/interpreter/Row.java @@ -16,6 +16,8 @@ */ package org.apache.calcite.interpreter; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.Arrays; /** @@ -64,7 +66,7 @@ public static Row of(Object...values) { return Arrays.hashCode(values); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return obj == this || obj instanceof Row && Arrays.equals(values, ((Row) obj).values); diff --git a/core/src/main/java/org/apache/calcite/jdbc/JavaRecordType.java b/core/src/main/java/org/apache/calcite/jdbc/JavaRecordType.java index 80049cd87c2..55680bffb96 100644 --- a/core/src/main/java/org/apache/calcite/jdbc/JavaRecordType.java +++ b/core/src/main/java/org/apache/calcite/jdbc/JavaRecordType.java @@ -19,6 +19,8 @@ import org.apache.calcite.rel.type.RelDataTypeField; import org.apache.calcite.rel.type.RelRecordType; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.List; import java.util.Objects; @@ -37,7 +39,7 @@ public JavaRecordType(List fields, Class clazz) { this.clazz = Objects.requireNonNull(clazz); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return this == obj || obj instanceof JavaRecordType && fieldList.equals(((JavaRecordType) obj).fieldList) diff --git a/core/src/main/java/org/apache/calcite/materialize/Lattice.java b/core/src/main/java/org/apache/calcite/materialize/Lattice.java index db03cdef77f..7d97d65e24b 100644 --- a/core/src/main/java/org/apache/calcite/materialize/Lattice.java +++ b/core/src/main/java/org/apache/calcite/materialize/Lattice.java @@ -591,7 +591,7 @@ public int compareTo(@Nonnull Measure measure) { return Objects.hash(agg, args); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return obj == this || obj instanceof Measure && this.agg.equals(((Measure) obj).agg) @@ -664,7 +664,7 @@ public int compareTo(Column column) { return ordinal; } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return obj == this || obj instanceof Column && this.ordinal == ((Column) obj).ordinal; diff --git a/core/src/main/java/org/apache/calcite/materialize/LatticeSuggester.java b/core/src/main/java/org/apache/calcite/materialize/LatticeSuggester.java index 7176cb352a7..a881312354a 100644 --- a/core/src/main/java/org/apache/calcite/materialize/LatticeSuggester.java +++ b/core/src/main/java/org/apache/calcite/materialize/LatticeSuggester.java @@ -632,7 +632,7 @@ public int hashCode() { return ordinalInQuery; } - public boolean equals(Object obj) { + public boolean equals(@Nullable Object obj) { return this == obj || obj instanceof TableRef && ordinalInQuery == ((TableRef) obj).ordinalInQuery; @@ -658,7 +658,7 @@ private static class StepRef extends DefaultEdge { return ordinalInQuery; } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return this == obj || obj instanceof StepRef && ((StepRef) obj).ordinalInQuery == ordinalInQuery; diff --git a/core/src/main/java/org/apache/calcite/materialize/LatticeTable.java b/core/src/main/java/org/apache/calcite/materialize/LatticeTable.java index 0ea30a40b7a..d012e8f440c 100644 --- a/core/src/main/java/org/apache/calcite/materialize/LatticeTable.java +++ b/core/src/main/java/org/apache/calcite/materialize/LatticeTable.java @@ -20,6 +20,8 @@ import org.apache.calcite.rel.type.RelDataTypeField; import org.apache.calcite.util.Util; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.Objects; import javax.annotation.Nonnull; @@ -37,7 +39,7 @@ public class LatticeTable { return t.getQualifiedName().hashCode(); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return this == obj || obj instanceof LatticeTable && t.getQualifiedName().equals( diff --git a/core/src/main/java/org/apache/calcite/materialize/MaterializationActor.java b/core/src/main/java/org/apache/calcite/materialize/MaterializationActor.java index 7183747f92b..95c5debd09b 100644 --- a/core/src/main/java/org/apache/calcite/materialize/MaterializationActor.java +++ b/core/src/main/java/org/apache/calcite/materialize/MaterializationActor.java @@ -23,6 +23,8 @@ import com.google.common.collect.HashMultimap; import com.google.common.collect.Multimap; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.HashMap; import java.util.List; import java.util.Map; @@ -97,7 +99,7 @@ static class QueryKey { this.path = path; } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return obj == this || obj instanceof QueryKey && sql.equals(((QueryKey) obj).sql) diff --git a/core/src/main/java/org/apache/calcite/materialize/MaterializationKey.java b/core/src/main/java/org/apache/calcite/materialize/MaterializationKey.java index 7f6b61a4af1..3aa39d0007a 100644 --- a/core/src/main/java/org/apache/calcite/materialize/MaterializationKey.java +++ b/core/src/main/java/org/apache/calcite/materialize/MaterializationKey.java @@ -16,6 +16,8 @@ */ package org.apache.calcite.materialize; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.io.Serializable; import java.util.UUID; @@ -32,7 +34,7 @@ public class MaterializationKey implements Serializable { return uuid.hashCode(); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return this == obj || obj instanceof MaterializationKey && uuid.equals(((MaterializationKey) obj).uuid); diff --git a/core/src/main/java/org/apache/calcite/materialize/Path.java b/core/src/main/java/org/apache/calcite/materialize/Path.java index 07a66f27963..68ee4f5fc05 100644 --- a/core/src/main/java/org/apache/calcite/materialize/Path.java +++ b/core/src/main/java/org/apache/calcite/materialize/Path.java @@ -18,6 +18,8 @@ import com.google.common.collect.ImmutableList; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.List; /** A sequence of {@link Step}s from a root node (fact table) to another node @@ -35,7 +37,7 @@ class Path { return id; } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return this == obj || obj instanceof Path && id == ((Path) obj).id; diff --git a/core/src/main/java/org/apache/calcite/materialize/Step.java b/core/src/main/java/org/apache/calcite/materialize/Step.java index 8c8fa8f446f..6ff6a2cd541 100644 --- a/core/src/main/java/org/apache/calcite/materialize/Step.java +++ b/core/src/main/java/org/apache/calcite/materialize/Step.java @@ -24,6 +24,8 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.Ordering; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.List; import java.util.Objects; @@ -68,7 +70,7 @@ static Step create(LatticeTable source, LatticeTable target, return Objects.hash(source, target, keys); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return this == obj || obj instanceof Step && ((Step) obj).source.equals(source) diff --git a/core/src/main/java/org/apache/calcite/materialize/TileKey.java b/core/src/main/java/org/apache/calcite/materialize/TileKey.java index 476886f996a..6a16ecb2244 100644 --- a/core/src/main/java/org/apache/calcite/materialize/TileKey.java +++ b/core/src/main/java/org/apache/calcite/materialize/TileKey.java @@ -20,6 +20,8 @@ import com.google.common.collect.ImmutableList; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.Objects; /** Definition of a particular combination of dimensions and measures of a @@ -45,7 +47,7 @@ public TileKey(Lattice lattice, ImmutableBitSet dimensions, return Objects.hash(lattice, dimensions); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return obj == this || obj instanceof TileKey && lattice == ((TileKey) obj).lattice diff --git a/core/src/main/java/org/apache/calcite/plan/RelCompositeTrait.java b/core/src/main/java/org/apache/calcite/plan/RelCompositeTrait.java index ac8c705e314..66a25072b41 100644 --- a/core/src/main/java/org/apache/calcite/plan/RelCompositeTrait.java +++ b/core/src/main/java/org/apache/calcite/plan/RelCompositeTrait.java @@ -19,6 +19,8 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.Ordering; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.Arrays; import java.util.List; import java.util.Objects; @@ -78,7 +80,7 @@ public RelTraitDef getTraitDef() { return Arrays.hashCode(traits); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return this == obj || obj instanceof RelCompositeTrait && Arrays.equals(traits, ((RelCompositeTrait) obj).traits); diff --git a/core/src/main/java/org/apache/calcite/plan/RelOptCostImpl.java b/core/src/main/java/org/apache/calcite/plan/RelOptCostImpl.java index 2ed57bd5d28..2d0350e2c20 100644 --- a/core/src/main/java/org/apache/calcite/plan/RelOptCostImpl.java +++ b/core/src/main/java/org/apache/calcite/plan/RelOptCostImpl.java @@ -16,6 +16,8 @@ */ package org.apache.calcite.plan; +import org.checkerframework.checker.nullness.qual.Nullable; + /** * RelOptCostImpl provides a default implementation for the {@link RelOptCost} * interface. It it defined in terms of a single scalar quantity; somewhat @@ -76,7 +78,7 @@ public boolean equals(RelOptCost other) { return getRows() == other.getRows(); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { if (obj instanceof RelOptCostImpl) { return equals((RelOptCost) obj); } diff --git a/core/src/main/java/org/apache/calcite/plan/RelOptRule.java b/core/src/main/java/org/apache/calcite/plan/RelOptRule.java index cfd478b57e8..20d03dec20b 100644 --- a/core/src/main/java/org/apache/calcite/plan/RelOptRule.java +++ b/core/src/main/java/org/apache/calcite/plan/RelOptRule.java @@ -25,6 +25,8 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -462,7 +464,7 @@ public int hashCode() { return description.hashCode(); } - public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return (obj instanceof RelOptRule) && equals((RelOptRule) obj); } diff --git a/core/src/main/java/org/apache/calcite/plan/RelOptRuleOperand.java b/core/src/main/java/org/apache/calcite/plan/RelOptRuleOperand.java index 75dfc51e441..4f774ba1f43 100644 --- a/core/src/main/java/org/apache/calcite/plan/RelOptRuleOperand.java +++ b/core/src/main/java/org/apache/calcite/plan/RelOptRuleOperand.java @@ -20,6 +20,8 @@ import com.google.common.collect.ImmutableList; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.List; import java.util.Objects; import java.util.function.Predicate; @@ -170,7 +172,7 @@ public int hashCode() { return Objects.hash(clazz, trait, children); } - public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { if (this == obj) { return true; } diff --git a/core/src/main/java/org/apache/calcite/plan/RelTraitSet.java b/core/src/main/java/org/apache/calcite/plan/RelTraitSet.java index e6737dc7f99..18bd930351e 100644 --- a/core/src/main/java/org/apache/calcite/plan/RelTraitSet.java +++ b/core/src/main/java/org/apache/calcite/plan/RelTraitSet.java @@ -24,6 +24,8 @@ import com.google.common.collect.ImmutableList; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.AbstractList; import java.util.Arrays; import java.util.HashMap; @@ -420,7 +422,7 @@ public T canonize(T trait) { * @param obj another RelTraitSet * @return true if traits are equal and in the same order, false otherwise */ - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { if (this == obj) { return true; } diff --git a/core/src/main/java/org/apache/calcite/plan/hep/HepRelMetadataProvider.java b/core/src/main/java/org/apache/calcite/plan/hep/HepRelMetadataProvider.java index 435e406a967..c0cb122b71d 100644 --- a/core/src/main/java/org/apache/calcite/plan/hep/HepRelMetadataProvider.java +++ b/core/src/main/java/org/apache/calcite/plan/hep/HepRelMetadataProvider.java @@ -26,6 +26,8 @@ import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.Multimap; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.lang.reflect.Method; /** @@ -35,7 +37,7 @@ class HepRelMetadataProvider implements RelMetadataProvider { //~ Methods ---------------------------------------------------------------- - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return obj instanceof HepRelMetadataProvider; } diff --git a/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoCost.java b/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoCost.java index f8d67ec6cc0..af64e4a3a0e 100644 --- a/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoCost.java +++ b/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoCost.java @@ -20,6 +20,8 @@ import org.apache.calcite.plan.RelOptCostFactory; import org.apache.calcite.plan.RelOptUtil; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.Objects; /** @@ -131,7 +133,7 @@ public boolean equals(RelOptCost other) { && (this.io == ((VolcanoCost) other).io); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { if (obj instanceof VolcanoCost) { return equals((VolcanoCost) obj); } diff --git a/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoRelMetadataProvider.java b/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoRelMetadataProvider.java index 00c51642273..6c0eb4a5e71 100644 --- a/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoRelMetadataProvider.java +++ b/core/src/main/java/org/apache/calcite/plan/volcano/VolcanoRelMetadataProvider.java @@ -26,6 +26,8 @@ import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.Multimap; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.lang.reflect.Method; /** @@ -35,7 +37,7 @@ public class VolcanoRelMetadataProvider implements RelMetadataProvider { //~ Methods ---------------------------------------------------------------- - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return obj instanceof VolcanoRelMetadataProvider; } diff --git a/core/src/main/java/org/apache/calcite/prepare/RelOptTableImpl.java b/core/src/main/java/org/apache/calcite/prepare/RelOptTableImpl.java index 65b08d6626f..5a0fe57c152 100644 --- a/core/src/main/java/org/apache/calcite/prepare/RelOptTableImpl.java +++ b/core/src/main/java/org/apache/calcite/prepare/RelOptTableImpl.java @@ -60,6 +60,8 @@ import com.google.common.collect.ImmutableList; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.AbstractList; import java.util.Collection; import java.util.List; @@ -221,7 +223,7 @@ public Expression getExpression(Class clazz) { extendedTable, expressionFunction, getRowCount()); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return obj instanceof RelOptTableImpl && this.rowType.equals(((RelOptTableImpl) obj).getRowType()) && this.table == ((RelOptTableImpl) obj).table; diff --git a/core/src/main/java/org/apache/calcite/profile/Profiler.java b/core/src/main/java/org/apache/calcite/profile/Profiler.java index 7ab6988194b..21cda8e93b7 100644 --- a/core/src/main/java/org/apache/calcite/profile/Profiler.java +++ b/core/src/main/java/org/apache/calcite/profile/Profiler.java @@ -25,6 +25,8 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSortedSet; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.math.BigDecimal; import java.math.MathContext; import java.math.RoundingMode; @@ -81,7 +83,7 @@ static ImmutableBitSet toOrdinals(Iterable columns) { return ordinal; } - @Override public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { return this == o || o instanceof Column && ordinal == ((Column) o).ordinal; diff --git a/core/src/main/java/org/apache/calcite/profile/ProfilerImpl.java b/core/src/main/java/org/apache/calcite/profile/ProfilerImpl.java index e3afb2925b4..38a0ac7a651 100644 --- a/core/src/main/java/org/apache/calcite/profile/ProfilerImpl.java +++ b/core/src/main/java/org/apache/calcite/profile/ProfilerImpl.java @@ -34,6 +34,8 @@ import com.google.common.collect.Ordering; import com.yahoo.sketches.hll.HllSketch; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.nio.ByteBuffer; import java.nio.charset.StandardCharsets; import java.util.ArrayDeque; @@ -465,7 +467,7 @@ static class Space { return columnOrdinals.hashCode(); } - @Override public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { return o == this || o instanceof Space && columnOrdinals.equals(((Space) o).columnOrdinals); diff --git a/core/src/main/java/org/apache/calcite/profile/SimpleProfiler.java b/core/src/main/java/org/apache/calcite/profile/SimpleProfiler.java index 932d3b6fc73..b4ee707c3e5 100644 --- a/core/src/main/java/org/apache/calcite/profile/SimpleProfiler.java +++ b/core/src/main/java/org/apache/calcite/profile/SimpleProfiler.java @@ -27,6 +27,8 @@ import com.google.common.collect.ImmutableSortedSet; import com.google.common.collect.Iterables; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.ArrayList; import java.util.BitSet; import java.util.Collection; @@ -303,7 +305,7 @@ static class Space implements Comparable { return columnOrdinals.hashCode(); } - @Override public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { return o == this || o instanceof Space && columnOrdinals.equals(((Space) o).columnOrdinals); diff --git a/core/src/main/java/org/apache/calcite/rel/AbstractRelNode.java b/core/src/main/java/org/apache/calcite/rel/AbstractRelNode.java index 206503de3df..d46eedcfdfd 100644 --- a/core/src/main/java/org/apache/calcite/rel/AbstractRelNode.java +++ b/core/src/main/java/org/apache/calcite/rel/AbstractRelNode.java @@ -42,6 +42,7 @@ import com.google.common.collect.ImmutableSet; import org.apiguardian.api.API; +import org.checkerframework.checker.nullness.qual.Nullable; import org.slf4j.Logger; import java.util.ArrayList; @@ -321,7 +322,7 @@ public RelOptTable getTable() { * sub-classes of {@link RelNode} to redefine identity. Various algorithms * (e.g. visitors, planner) can define the identity as meets their needs. */ - @Override public final boolean equals(Object obj) { + @Override public final boolean equals(@Nullable Object obj) { return super.equals(obj); } @@ -427,7 +428,7 @@ private class InnerRelDigest implements RelDigest { hash = 0; } - @Override public boolean equals(final Object o) { + @Override public boolean equals(final @Nullable Object o) { if (this == o) { return true; } diff --git a/core/src/main/java/org/apache/calcite/rel/RelCollationImpl.java b/core/src/main/java/org/apache/calcite/rel/RelCollationImpl.java index f06c84c1cd6..21229e41259 100644 --- a/core/src/main/java/org/apache/calcite/rel/RelCollationImpl.java +++ b/core/src/main/java/org/apache/calcite/rel/RelCollationImpl.java @@ -30,6 +30,8 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.UnmodifiableIterator; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.Iterator; import java.util.List; import javax.annotation.Nonnull; @@ -83,7 +85,7 @@ public int hashCode() { return fieldCollations.hashCode(); } - public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { if (this == obj) { return true; } diff --git a/core/src/main/java/org/apache/calcite/rel/RelDistributions.java b/core/src/main/java/org/apache/calcite/rel/RelDistributions.java index 9b7b10eb9c0..4336b796772 100644 --- a/core/src/main/java/org/apache/calcite/rel/RelDistributions.java +++ b/core/src/main/java/org/apache/calcite/rel/RelDistributions.java @@ -26,6 +26,8 @@ import com.google.common.collect.Ordering; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.Collection; import java.util.List; import java.util.Objects; @@ -110,7 +112,7 @@ private RelDistributionImpl(Type type, ImmutableIntList keys) { return Objects.hash(type, keys); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return this == obj || obj instanceof RelDistributionImpl && type == ((RelDistributionImpl) obj).type diff --git a/core/src/main/java/org/apache/calcite/rel/RelFieldCollation.java b/core/src/main/java/org/apache/calcite/rel/RelFieldCollation.java index 38ecccef9a4..4d8a51ab6bf 100644 --- a/core/src/main/java/org/apache/calcite/rel/RelFieldCollation.java +++ b/core/src/main/java/org/apache/calcite/rel/RelFieldCollation.java @@ -18,6 +18,8 @@ import org.apache.calcite.sql.validate.SqlMonotonicity; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.Objects; import javax.annotation.Nonnull; @@ -248,7 +250,7 @@ public RelFieldCollation shift(int offset) { return withFieldIndex(fieldIndex + offset); } - @Override public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { return this == o || o instanceof RelFieldCollation && fieldIndex == ((RelFieldCollation) o).fieldIndex diff --git a/core/src/main/java/org/apache/calcite/rel/core/AggregateCall.java b/core/src/main/java/org/apache/calcite/rel/core/AggregateCall.java index 8880389f4a2..c34294b53e0 100644 --- a/core/src/main/java/org/apache/calcite/rel/core/AggregateCall.java +++ b/core/src/main/java/org/apache/calcite/rel/core/AggregateCall.java @@ -30,6 +30,8 @@ import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.List; import java.util.Objects; @@ -326,7 +328,7 @@ public boolean hasFilter() { return filterArg >= 0; } - @Override public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { if (!(o instanceof AggregateCall)) { return false; } diff --git a/core/src/main/java/org/apache/calcite/rel/core/CorrelationId.java b/core/src/main/java/org/apache/calcite/rel/core/CorrelationId.java index 11be21b632b..8cb8193e828 100644 --- a/core/src/main/java/org/apache/calcite/rel/core/CorrelationId.java +++ b/core/src/main/java/org/apache/calcite/rel/core/CorrelationId.java @@ -18,6 +18,8 @@ import com.google.common.collect.ImmutableSet; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.Set; /** @@ -93,7 +95,7 @@ public int compareTo(CorrelationId other) { return id; } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return this == obj || obj instanceof CorrelationId && this.id == ((CorrelationId) obj).id; diff --git a/core/src/main/java/org/apache/calcite/rel/core/Match.java b/core/src/main/java/org/apache/calcite/rel/core/Match.java index 4b1a5ca4d66..7ababd1eac5 100644 --- a/core/src/main/java/org/apache/calcite/rel/core/Match.java +++ b/core/src/main/java/org/apache/calcite/rel/core/Match.java @@ -40,6 +40,8 @@ import com.google.common.collect.ImmutableSortedMap; import com.google.common.collect.ImmutableSortedSet; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.HashSet; import java.util.List; import java.util.Map; @@ -333,7 +335,7 @@ public static final class RexMRAggCall extends RexCall return toString().compareTo(o.toString()); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return obj == this || obj instanceof RexMRAggCall && toString().equals(obj.toString()); diff --git a/core/src/main/java/org/apache/calcite/rel/core/Window.java b/core/src/main/java/org/apache/calcite/rel/core/Window.java index dc364ea5b7c..d5f255efece 100644 --- a/core/src/main/java/org/apache/calcite/rel/core/Window.java +++ b/core/src/main/java/org/apache/calcite/rel/core/Window.java @@ -45,6 +45,8 @@ import com.google.common.collect.ImmutableList; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.AbstractList; import java.util.List; import java.util.Objects; @@ -287,7 +289,7 @@ private String computeString() { return buf.toString(); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return this == obj || obj instanceof Group && this.digest.equals(((Group) obj).digest); @@ -394,7 +396,7 @@ public RexWinAggCall( this.ignoreNulls = ignoreNulls; } - @Override public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } diff --git a/core/src/main/java/org/apache/calcite/rel/hint/HintStrategyTable.java b/core/src/main/java/org/apache/calcite/rel/hint/HintStrategyTable.java index fc4db46ae4f..14dcacac122 100644 --- a/core/src/main/java/org/apache/calcite/rel/hint/HintStrategyTable.java +++ b/core/src/main/java/org/apache/calcite/rel/hint/HintStrategyTable.java @@ -22,6 +22,7 @@ import org.apache.calcite.util.Litmus; import org.apache.calcite.util.trace.CalciteTrace; +import org.checkerframework.checker.nullness.qual.Nullable; import org.slf4j.Logger; import java.util.Collections; @@ -164,7 +165,7 @@ static Key of(String name) { return new Key(name.toLowerCase(Locale.ROOT)); } - @Override public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } diff --git a/core/src/main/java/org/apache/calcite/rel/hint/RelHint.java b/core/src/main/java/org/apache/calcite/rel/hint/RelHint.java index 169e1bdc5c1..72fd0ee1e15 100644 --- a/core/src/main/java/org/apache/calcite/rel/hint/RelHint.java +++ b/core/src/main/java/org/apache/calcite/rel/hint/RelHint.java @@ -128,7 +128,7 @@ public RelHint copy(List inheritPath) { return new RelHint(inheritPath, hintName, listOptions, kvOptions); } - @Override public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } diff --git a/core/src/main/java/org/apache/calcite/rel/logical/LogicalWindow.java b/core/src/main/java/org/apache/calcite/rel/logical/LogicalWindow.java index 7272a5796b8..d2daa3a81cf 100644 --- a/core/src/main/java/org/apache/calcite/rel/logical/LogicalWindow.java +++ b/core/src/main/java/org/apache/calcite/rel/logical/LogicalWindow.java @@ -43,6 +43,8 @@ import com.google.common.collect.Lists; import com.google.common.collect.Multimap; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.AbstractList; import java.util.ArrayList; import java.util.Collection; @@ -324,7 +326,7 @@ private static class WindowKey { return Objects.hash(groupSet, orderKeys, isRows, lowerBound, upperBound); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return obj == this || obj instanceof WindowKey && groupSet.equals(((WindowKey) obj).groupSet) diff --git a/core/src/main/java/org/apache/calcite/rel/metadata/ChainedRelMetadataProvider.java b/core/src/main/java/org/apache/calcite/rel/metadata/ChainedRelMetadataProvider.java index e727650c816..ecba82d735e 100644 --- a/core/src/main/java/org/apache/calcite/rel/metadata/ChainedRelMetadataProvider.java +++ b/core/src/main/java/org/apache/calcite/rel/metadata/ChainedRelMetadataProvider.java @@ -23,6 +23,8 @@ import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.Multimap; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -57,7 +59,7 @@ protected ChainedRelMetadataProvider( //~ Methods ---------------------------------------------------------------- - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return obj == this || obj instanceof ChainedRelMetadataProvider && providers.equals(((ChainedRelMetadataProvider) obj).providers); diff --git a/core/src/main/java/org/apache/calcite/rel/metadata/JaninoRelMetadataProvider.java b/core/src/main/java/org/apache/calcite/rel/metadata/JaninoRelMetadataProvider.java index 1ab362b3369..441b380c24c 100644 --- a/core/src/main/java/org/apache/calcite/rel/metadata/JaninoRelMetadataProvider.java +++ b/core/src/main/java/org/apache/calcite/rel/metadata/JaninoRelMetadataProvider.java @@ -63,6 +63,7 @@ import com.google.common.collect.Multimap; import com.google.common.util.concurrent.UncheckedExecutionException; +import org.checkerframework.checker.nullness.qual.Nullable; import org.codehaus.commons.compiler.CompileException; import org.codehaus.commons.compiler.CompilerFactoryFactory; import org.codehaus.commons.compiler.ICompilerFactory; @@ -171,7 +172,7 @@ private static CacheBuilder maxSize(CacheBuilder builder, return builder; } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return obj == this || obj instanceof JaninoRelMetadataProvider && ((JaninoRelMetadataProvider) obj).provider.equals(provider); @@ -534,7 +535,7 @@ private Key(MetadataDef def, RelMetadataProvider provider, + relClasses.hashCode(); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return this == obj || obj instanceof Key && ((Key) obj).def.equals(def) diff --git a/core/src/main/java/org/apache/calcite/rel/metadata/RelColumnOrigin.java b/core/src/main/java/org/apache/calcite/rel/metadata/RelColumnOrigin.java index 6a3d7e5ae15..56de099e488 100644 --- a/core/src/main/java/org/apache/calcite/rel/metadata/RelColumnOrigin.java +++ b/core/src/main/java/org/apache/calcite/rel/metadata/RelColumnOrigin.java @@ -18,6 +18,8 @@ import org.apache.calcite.plan.RelOptTable; +import org.checkerframework.checker.nullness.qual.Nullable; + /** * RelColumnOrigin is a data structure describing one of the origins of an * output column produced by a relational expression. @@ -70,7 +72,7 @@ public boolean isDerived() { } // override Object - public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { if (!(obj instanceof RelColumnOrigin)) { return false; } diff --git a/core/src/main/java/org/apache/calcite/rel/mutable/MutableAggregate.java b/core/src/main/java/org/apache/calcite/rel/mutable/MutableAggregate.java index 5c5a8b70c5b..db84ddca287 100644 --- a/core/src/main/java/org/apache/calcite/rel/mutable/MutableAggregate.java +++ b/core/src/main/java/org/apache/calcite/rel/mutable/MutableAggregate.java @@ -23,6 +23,8 @@ import com.google.common.collect.ImmutableList; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.List; import java.util.Objects; @@ -65,7 +67,7 @@ public static MutableAggregate of(MutableRel input, ImmutableBitSet groupSet, groupSets, aggCalls); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return obj == this || obj instanceof MutableAggregate && groupSet.equals(((MutableAggregate) obj).groupSet) diff --git a/core/src/main/java/org/apache/calcite/rel/mutable/MutableCalc.java b/core/src/main/java/org/apache/calcite/rel/mutable/MutableCalc.java index 5791bb9aac9..1d172c5f2cb 100644 --- a/core/src/main/java/org/apache/calcite/rel/mutable/MutableCalc.java +++ b/core/src/main/java/org/apache/calcite/rel/mutable/MutableCalc.java @@ -18,6 +18,8 @@ import org.apache.calcite.rex.RexProgram; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.Objects; /** Mutable equivalent of {@link org.apache.calcite.rel.core.Calc}. */ @@ -39,7 +41,7 @@ public static MutableCalc of(MutableRel input, RexProgram program) { return new MutableCalc(input, program); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return obj == this || obj instanceof MutableCalc && MutableRel.STRING_EQUIVALENCE.equivalent( diff --git a/core/src/main/java/org/apache/calcite/rel/mutable/MutableCollect.java b/core/src/main/java/org/apache/calcite/rel/mutable/MutableCollect.java index 3123c25b44d..0782d2f89fa 100644 --- a/core/src/main/java/org/apache/calcite/rel/mutable/MutableCollect.java +++ b/core/src/main/java/org/apache/calcite/rel/mutable/MutableCollect.java @@ -18,6 +18,8 @@ import org.apache.calcite.rel.type.RelDataType; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.Objects; /** Mutable equivalent of {@link org.apache.calcite.rel.core.Collect}. */ @@ -42,7 +44,7 @@ public static MutableCollect of(RelDataType rowType, return new MutableCollect(rowType, input, fieldName); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return obj == this || obj instanceof MutableCollect && fieldName.equals(((MutableCollect) obj).fieldName) diff --git a/core/src/main/java/org/apache/calcite/rel/mutable/MutableCorrelate.java b/core/src/main/java/org/apache/calcite/rel/mutable/MutableCorrelate.java index 80302fa30d7..cba7890c8d4 100644 --- a/core/src/main/java/org/apache/calcite/rel/mutable/MutableCorrelate.java +++ b/core/src/main/java/org/apache/calcite/rel/mutable/MutableCorrelate.java @@ -21,6 +21,8 @@ import org.apache.calcite.rel.type.RelDataType; import org.apache.calcite.util.ImmutableBitSet; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.Objects; /** Mutable equivalent of {@link org.apache.calcite.rel.core.Correlate}. */ @@ -59,7 +61,7 @@ public static MutableCorrelate of(RelDataType rowType, MutableRel left, requiredColumns, joinType); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return obj == this || obj instanceof MutableCorrelate && correlationId.equals( diff --git a/core/src/main/java/org/apache/calcite/rel/mutable/MutableExchange.java b/core/src/main/java/org/apache/calcite/rel/mutable/MutableExchange.java index b9f48254169..72669a1cdbf 100644 --- a/core/src/main/java/org/apache/calcite/rel/mutable/MutableExchange.java +++ b/core/src/main/java/org/apache/calcite/rel/mutable/MutableExchange.java @@ -18,6 +18,8 @@ import org.apache.calcite.rel.RelDistribution; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.Objects; /** Mutable equivalent of {@link org.apache.calcite.rel.core.Exchange}. */ @@ -39,7 +41,7 @@ public static MutableExchange of(MutableRel input, RelDistribution distribution) return new MutableExchange(input, distribution); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return obj == this || obj instanceof MutableExchange && distribution.equals(((MutableExchange) obj).distribution) diff --git a/core/src/main/java/org/apache/calcite/rel/mutable/MutableFilter.java b/core/src/main/java/org/apache/calcite/rel/mutable/MutableFilter.java index 009674aaf1a..783e8d9301f 100644 --- a/core/src/main/java/org/apache/calcite/rel/mutable/MutableFilter.java +++ b/core/src/main/java/org/apache/calcite/rel/mutable/MutableFilter.java @@ -18,6 +18,8 @@ import org.apache.calcite.rex.RexNode; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.Objects; /** Mutable equivalent of {@link org.apache.calcite.rel.core.Filter}. */ @@ -40,7 +42,7 @@ public static MutableFilter of(MutableRel input, RexNode condition) { return new MutableFilter(input, condition); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return obj == this || obj instanceof MutableFilter && condition.equals(((MutableFilter) obj).condition) diff --git a/core/src/main/java/org/apache/calcite/rel/mutable/MutableJoin.java b/core/src/main/java/org/apache/calcite/rel/mutable/MutableJoin.java index ab87de80d02..ccc6a093fbe 100644 --- a/core/src/main/java/org/apache/calcite/rel/mutable/MutableJoin.java +++ b/core/src/main/java/org/apache/calcite/rel/mutable/MutableJoin.java @@ -21,6 +21,8 @@ import org.apache.calcite.rel.type.RelDataType; import org.apache.calcite.rex.RexNode; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.Objects; import java.util.Set; @@ -62,7 +64,7 @@ public static MutableJoin of(RelDataType rowType, MutableRel left, variablesStopped); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return obj == this || obj instanceof MutableJoin && joinType == ((MutableJoin) obj).joinType diff --git a/core/src/main/java/org/apache/calcite/rel/mutable/MutableMatch.java b/core/src/main/java/org/apache/calcite/rel/mutable/MutableMatch.java index 8fffb148e2d..9103320a683 100644 --- a/core/src/main/java/org/apache/calcite/rel/mutable/MutableMatch.java +++ b/core/src/main/java/org/apache/calcite/rel/mutable/MutableMatch.java @@ -21,6 +21,8 @@ import org.apache.calcite.rex.RexNode; import org.apache.calcite.util.ImmutableBitSet; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.Map; import java.util.Objects; import java.util.SortedSet; @@ -74,7 +76,7 @@ public static MutableMatch of(RelDataType rowType, orderKeys, interval); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return obj == this || obj instanceof MutableMatch && pattern.equals(((MutableMatch) obj).pattern) diff --git a/core/src/main/java/org/apache/calcite/rel/mutable/MutableProject.java b/core/src/main/java/org/apache/calcite/rel/mutable/MutableProject.java index b781f1caa9a..808947289e4 100644 --- a/core/src/main/java/org/apache/calcite/rel/mutable/MutableProject.java +++ b/core/src/main/java/org/apache/calcite/rel/mutable/MutableProject.java @@ -25,6 +25,8 @@ import org.apache.calcite.util.Pair; import org.apache.calcite.util.mapping.Mappings; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.List; import java.util.Objects; @@ -66,7 +68,7 @@ public static MutableRel of(MutableRel input, List exprList, return of(rowType, input, exprList); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return obj == this || obj instanceof MutableProject && MutableRel.PAIRWISE_STRING_EQUIVALENCE.equivalent( diff --git a/core/src/main/java/org/apache/calcite/rel/mutable/MutableSample.java b/core/src/main/java/org/apache/calcite/rel/mutable/MutableSample.java index 84bdf7f4b65..1fe63f6cf90 100644 --- a/core/src/main/java/org/apache/calcite/rel/mutable/MutableSample.java +++ b/core/src/main/java/org/apache/calcite/rel/mutable/MutableSample.java @@ -18,6 +18,8 @@ import org.apache.calcite.plan.RelOptSamplingParameters; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.Objects; /** Mutable equivalent of {@link org.apache.calcite.rel.core.Sample}. */ @@ -40,7 +42,7 @@ public static MutableSample of( return new MutableSample(input, params); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return obj == this || obj instanceof MutableSample && params.equals(((MutableSample) obj).params) diff --git a/core/src/main/java/org/apache/calcite/rel/mutable/MutableScan.java b/core/src/main/java/org/apache/calcite/rel/mutable/MutableScan.java index 4efc2d14170..25a1b866a67 100644 --- a/core/src/main/java/org/apache/calcite/rel/mutable/MutableScan.java +++ b/core/src/main/java/org/apache/calcite/rel/mutable/MutableScan.java @@ -18,6 +18,8 @@ import org.apache.calcite.rel.core.TableScan; +import org.checkerframework.checker.nullness.qual.Nullable; + /** Mutable equivalent of {@link org.apache.calcite.rel.core.TableScan}. */ public class MutableScan extends MutableLeafRel { private MutableScan(TableScan rel) { @@ -33,7 +35,7 @@ public static MutableScan of(TableScan scan) { return new MutableScan(scan); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return obj == this || obj instanceof MutableScan && rel.getTable().getQualifiedName().equals(((MutableScan) obj).rel diff --git a/core/src/main/java/org/apache/calcite/rel/mutable/MutableSetOp.java b/core/src/main/java/org/apache/calcite/rel/mutable/MutableSetOp.java index c6d15d19bce..500a56bcfbb 100644 --- a/core/src/main/java/org/apache/calcite/rel/mutable/MutableSetOp.java +++ b/core/src/main/java/org/apache/calcite/rel/mutable/MutableSetOp.java @@ -19,6 +19,8 @@ import org.apache.calcite.plan.RelOptCluster; import org.apache.calcite.rel.type.RelDataType; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.List; import java.util.Objects; @@ -36,7 +38,7 @@ public boolean isAll() { return all; } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return obj == this || obj instanceof MutableSetOp && type == ((MutableSetOp) obj).type diff --git a/core/src/main/java/org/apache/calcite/rel/mutable/MutableSort.java b/core/src/main/java/org/apache/calcite/rel/mutable/MutableSort.java index 2aa5c17fe3f..332df5312c8 100644 --- a/core/src/main/java/org/apache/calcite/rel/mutable/MutableSort.java +++ b/core/src/main/java/org/apache/calcite/rel/mutable/MutableSort.java @@ -19,6 +19,8 @@ import org.apache.calcite.rel.RelCollation; import org.apache.calcite.rex.RexNode; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.Objects; /** Mutable equivalent of {@link org.apache.calcite.rel.core.Sort}. */ @@ -49,7 +51,7 @@ public static MutableSort of(MutableRel input, RelCollation collation, return new MutableSort(input, collation, offset, fetch); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return obj == this || obj instanceof MutableSort && collation.equals(((MutableSort) obj).collation) diff --git a/core/src/main/java/org/apache/calcite/rel/mutable/MutableTableFunctionScan.java b/core/src/main/java/org/apache/calcite/rel/mutable/MutableTableFunctionScan.java index 3e671608072..5aff43cd031 100644 --- a/core/src/main/java/org/apache/calcite/rel/mutable/MutableTableFunctionScan.java +++ b/core/src/main/java/org/apache/calcite/rel/mutable/MutableTableFunctionScan.java @@ -21,6 +21,8 @@ import org.apache.calcite.rel.type.RelDataType; import org.apache.calcite.rex.RexNode; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.lang.reflect.Type; import java.util.List; import java.util.Objects; @@ -60,7 +62,7 @@ public static MutableTableFunctionScan of(RelOptCluster cluster, cluster, rowType, inputs, rexCall, elementType, columnMappings); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return obj == this || obj instanceof MutableTableFunctionScan && STRING_EQUIVALENCE.equivalent(rexCall, diff --git a/core/src/main/java/org/apache/calcite/rel/mutable/MutableTableModify.java b/core/src/main/java/org/apache/calcite/rel/mutable/MutableTableModify.java index 1103cad04f8..60c1afd2c09 100644 --- a/core/src/main/java/org/apache/calcite/rel/mutable/MutableTableModify.java +++ b/core/src/main/java/org/apache/calcite/rel/mutable/MutableTableModify.java @@ -22,6 +22,8 @@ import org.apache.calcite.rel.type.RelDataType; import org.apache.calcite.rex.RexNode; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.List; import java.util.Objects; @@ -70,7 +72,7 @@ public static MutableTableModify of(RelDataType rowType, operation, updateColumnList, sourceExpressionList, flattened); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return obj == this || obj instanceof MutableTableModify && table.getQualifiedName().equals( diff --git a/core/src/main/java/org/apache/calcite/rel/mutable/MutableUncollect.java b/core/src/main/java/org/apache/calcite/rel/mutable/MutableUncollect.java index 49d65efab34..594d109b5d6 100644 --- a/core/src/main/java/org/apache/calcite/rel/mutable/MutableUncollect.java +++ b/core/src/main/java/org/apache/calcite/rel/mutable/MutableUncollect.java @@ -18,6 +18,8 @@ import org.apache.calcite.rel.type.RelDataType; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.Objects; /** Mutable equivalent of {@link org.apache.calcite.rel.core.Uncollect}. */ @@ -43,7 +45,7 @@ public static MutableUncollect of(RelDataType rowType, return new MutableUncollect(rowType, input, withOrdinality); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return obj == this || obj instanceof MutableUncollect && withOrdinality == ((MutableUncollect) obj).withOrdinality diff --git a/core/src/main/java/org/apache/calcite/rel/mutable/MutableValues.java b/core/src/main/java/org/apache/calcite/rel/mutable/MutableValues.java index 53e0223327f..2f921bc1b69 100644 --- a/core/src/main/java/org/apache/calcite/rel/mutable/MutableValues.java +++ b/core/src/main/java/org/apache/calcite/rel/mutable/MutableValues.java @@ -18,6 +18,8 @@ import org.apache.calcite.rel.core.Values; +import org.checkerframework.checker.nullness.qual.Nullable; + /** Mutable equivalent of {@link org.apache.calcite.rel.core.Values}. */ public class MutableValues extends MutableLeafRel { private MutableValues(Values rel) { @@ -33,7 +35,7 @@ public static MutableValues of(Values values) { return new MutableValues(values); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return obj == this || obj instanceof MutableValues && rel == ((MutableValues) obj).rel; diff --git a/core/src/main/java/org/apache/calcite/rel/mutable/MutableWindow.java b/core/src/main/java/org/apache/calcite/rel/mutable/MutableWindow.java index b098b5758b5..013d9534764 100644 --- a/core/src/main/java/org/apache/calcite/rel/mutable/MutableWindow.java +++ b/core/src/main/java/org/apache/calcite/rel/mutable/MutableWindow.java @@ -20,6 +20,8 @@ import org.apache.calcite.rel.type.RelDataType; import org.apache.calcite.rex.RexLiteral; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.List; import java.util.Objects; @@ -48,7 +50,7 @@ public static MutableWindow of(RelDataType rowType, return new MutableWindow(rowType, input, groups, constants); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return obj == this || obj instanceof MutableWindow && groups.equals(((MutableWindow) obj).groups) diff --git a/core/src/main/java/org/apache/calcite/rel/type/RelDataTypeFactoryImpl.java b/core/src/main/java/org/apache/calcite/rel/type/RelDataTypeFactoryImpl.java index 1cd3a2085c3..ae5de4258cc 100644 --- a/core/src/main/java/org/apache/calcite/rel/type/RelDataTypeFactoryImpl.java +++ b/core/src/main/java/org/apache/calcite/rel/type/RelDataTypeFactoryImpl.java @@ -32,6 +32,8 @@ import com.google.common.collect.Interner; import com.google.common.collect.Interners; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.lang.reflect.Field; import java.lang.reflect.Modifier; import java.nio.charset.Charset; @@ -667,7 +669,7 @@ private static class Key { return Objects.hash(kind, names, types, nullable); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return obj == this || obj instanceof Key && kind == ((Key) obj).kind diff --git a/core/src/main/java/org/apache/calcite/rel/type/RelDataTypeFieldImpl.java b/core/src/main/java/org/apache/calcite/rel/type/RelDataTypeFieldImpl.java index 4d1ac981376..a5ca9475400 100644 --- a/core/src/main/java/org/apache/calcite/rel/type/RelDataTypeFieldImpl.java +++ b/core/src/main/java/org/apache/calcite/rel/type/RelDataTypeFieldImpl.java @@ -18,6 +18,8 @@ import org.apache.calcite.sql.type.SqlTypeName; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.io.Serializable; import java.util.Objects; @@ -53,7 +55,7 @@ public RelDataTypeFieldImpl( return Objects.hash(index, name, type); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { if (this == obj) { return true; } diff --git a/core/src/main/java/org/apache/calcite/rel/type/RelDataTypeImpl.java b/core/src/main/java/org/apache/calcite/rel/type/RelDataTypeImpl.java index 5e33d3e4736..6976c282336 100644 --- a/core/src/main/java/org/apache/calcite/rel/type/RelDataTypeImpl.java +++ b/core/src/main/java/org/apache/calcite/rel/type/RelDataTypeImpl.java @@ -28,6 +28,8 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.io.Serializable; import java.nio.charset.Charset; import java.util.ArrayList; @@ -179,7 +181,7 @@ public boolean isStruct() { return fieldList != null; } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return this == obj || obj instanceof RelDataTypeImpl && this.digest.equals(((RelDataTypeImpl) obj).digest); diff --git a/core/src/main/java/org/apache/calcite/rex/RexCall.java b/core/src/main/java/org/apache/calcite/rex/RexCall.java index 107d6e2a1e4..2ea5a05b9be 100644 --- a/core/src/main/java/org/apache/calcite/rex/RexCall.java +++ b/core/src/main/java/org/apache/calcite/rex/RexCall.java @@ -28,6 +28,8 @@ import com.google.common.collect.ImmutableList; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -251,7 +253,7 @@ private Pair> getNormalized() { return this.normalized; } - @Override public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } diff --git a/core/src/main/java/org/apache/calcite/rex/RexCorrelVariable.java b/core/src/main/java/org/apache/calcite/rex/RexCorrelVariable.java index 7c3408cede4..fa900cfebbc 100644 --- a/core/src/main/java/org/apache/calcite/rex/RexCorrelVariable.java +++ b/core/src/main/java/org/apache/calcite/rex/RexCorrelVariable.java @@ -20,6 +20,8 @@ import org.apache.calcite.rel.type.RelDataType; import org.apache.calcite.sql.SqlKind; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.Objects; /** @@ -55,7 +57,7 @@ public R accept(RexBiVisitor visitor, P arg) { return SqlKind.CORREL_VARIABLE; } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return this == obj || obj instanceof RexCorrelVariable && digest.equals(((RexCorrelVariable) obj).digest) diff --git a/core/src/main/java/org/apache/calcite/rex/RexDynamicParam.java b/core/src/main/java/org/apache/calcite/rex/RexDynamicParam.java index dab2907c247..fb0f69b9b2a 100644 --- a/core/src/main/java/org/apache/calcite/rex/RexDynamicParam.java +++ b/core/src/main/java/org/apache/calcite/rex/RexDynamicParam.java @@ -19,6 +19,8 @@ import org.apache.calcite.rel.type.RelDataType; import org.apache.calcite.sql.SqlKind; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.Objects; /** @@ -62,7 +64,7 @@ public R accept(RexBiVisitor visitor, P arg) { return visitor.visitDynamicParam(this, arg); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return this == obj || obj instanceof RexDynamicParam && type.equals(((RexDynamicParam) obj).type) diff --git a/core/src/main/java/org/apache/calcite/rex/RexFieldAccess.java b/core/src/main/java/org/apache/calcite/rex/RexFieldAccess.java index bd052020435..edbf375d77b 100644 --- a/core/src/main/java/org/apache/calcite/rex/RexFieldAccess.java +++ b/core/src/main/java/org/apache/calcite/rex/RexFieldAccess.java @@ -22,6 +22,8 @@ import com.google.common.base.Preconditions; +import org.checkerframework.checker.nullness.qual.Nullable; + /** * Access to a field of a row-expression. * @@ -103,7 +105,7 @@ public RexNode getReferenceExpr() { return expr; } - @Override public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } diff --git a/core/src/main/java/org/apache/calcite/rex/RexInputRef.java b/core/src/main/java/org/apache/calcite/rex/RexInputRef.java index e264a6d2181..d79fc226e81 100644 --- a/core/src/main/java/org/apache/calcite/rex/RexInputRef.java +++ b/core/src/main/java/org/apache/calcite/rex/RexInputRef.java @@ -21,6 +21,8 @@ import org.apache.calcite.sql.SqlKind; import org.apache.calcite.util.Pair; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.List; /** @@ -68,7 +70,7 @@ public RexInputRef(int index, RelDataType type) { //~ Methods ---------------------------------------------------------------- - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return this == obj || obj instanceof RexInputRef && index == ((RexInputRef) obj).index; diff --git a/core/src/main/java/org/apache/calcite/rex/RexLiteral.java b/core/src/main/java/org/apache/calcite/rex/RexLiteral.java index 70d23a2c7f3..972d7fa8b85 100644 --- a/core/src/main/java/org/apache/calcite/rex/RexLiteral.java +++ b/core/src/main/java/org/apache/calcite/rex/RexLiteral.java @@ -42,6 +42,8 @@ import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.io.IOException; import java.io.PrintWriter; import java.math.BigDecimal; @@ -1088,7 +1090,7 @@ public boolean isAlwaysFalse() { return !booleanValue(this); } - public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { if (this == obj) { return true; } diff --git a/core/src/main/java/org/apache/calcite/rex/RexLocalRef.java b/core/src/main/java/org/apache/calcite/rex/RexLocalRef.java index f242496e48e..d512264e9ee 100644 --- a/core/src/main/java/org/apache/calcite/rex/RexLocalRef.java +++ b/core/src/main/java/org/apache/calcite/rex/RexLocalRef.java @@ -19,6 +19,8 @@ import org.apache.calcite.rel.type.RelDataType; import org.apache.calcite.sql.SqlKind; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.List; import java.util.Objects; @@ -60,7 +62,7 @@ public RexLocalRef(int index, RelDataType type) { return SqlKind.LOCAL_REF; } - public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return this == obj || obj instanceof RexLocalRef && Objects.equals(this.type, ((RexLocalRef) obj).type) diff --git a/core/src/main/java/org/apache/calcite/rex/RexNode.java b/core/src/main/java/org/apache/calcite/rex/RexNode.java index 8a42b9d2ded..92f92cd8f78 100644 --- a/core/src/main/java/org/apache/calcite/rex/RexNode.java +++ b/core/src/main/java/org/apache/calcite/rex/RexNode.java @@ -114,7 +114,7 @@ public int nodeCount() { * *

Every node must implement {@link #equals} based on its content */ - @Override public abstract boolean equals(Object obj); + @Override public abstract boolean equals(@Nullable Object obj); /** {@inheritDoc} * diff --git a/core/src/main/java/org/apache/calcite/rex/RexOver.java b/core/src/main/java/org/apache/calcite/rex/RexOver.java index 6e006c9edd9..14ec80c7ef2 100644 --- a/core/src/main/java/org/apache/calcite/rex/RexOver.java +++ b/core/src/main/java/org/apache/calcite/rex/RexOver.java @@ -24,6 +24,8 @@ import com.google.common.base.Preconditions; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.List; import java.util.Objects; import javax.annotation.Nonnull; @@ -197,7 +199,7 @@ public Void visitOver(RexOver over) { } } - @Override public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } diff --git a/core/src/main/java/org/apache/calcite/rex/RexRangeRef.java b/core/src/main/java/org/apache/calcite/rex/RexRangeRef.java index 3c57f95bba9..f4affca567a 100644 --- a/core/src/main/java/org/apache/calcite/rex/RexRangeRef.java +++ b/core/src/main/java/org/apache/calcite/rex/RexRangeRef.java @@ -18,6 +18,8 @@ import org.apache.calcite.rel.type.RelDataType; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.Objects; /** @@ -77,7 +79,7 @@ public R accept(RexBiVisitor visitor, P arg) { return visitor.visitRangeRef(this, arg); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return this == obj || obj instanceof RexRangeRef && type.equals(((RexRangeRef) obj).type) diff --git a/core/src/main/java/org/apache/calcite/rex/RexSubQuery.java b/core/src/main/java/org/apache/calcite/rex/RexSubQuery.java index df1ae2959b0..f6a53a40b24 100644 --- a/core/src/main/java/org/apache/calcite/rex/RexSubQuery.java +++ b/core/src/main/java/org/apache/calcite/rex/RexSubQuery.java @@ -29,6 +29,8 @@ import com.google.common.collect.ImmutableList; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.List; import java.util.Objects; import javax.annotation.Nonnull; @@ -137,7 +139,7 @@ public RexSubQuery clone(RelNode rel) { return new RexSubQuery(type, getOperator(), operands, rel); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { if (this == obj) { return true; } diff --git a/core/src/main/java/org/apache/calcite/rex/RexTableInputRef.java b/core/src/main/java/org/apache/calcite/rex/RexTableInputRef.java index 6ebf65bb53d..e61c86cc2b3 100644 --- a/core/src/main/java/org/apache/calcite/rex/RexTableInputRef.java +++ b/core/src/main/java/org/apache/calcite/rex/RexTableInputRef.java @@ -20,6 +20,8 @@ import org.apache.calcite.rel.type.RelDataType; import org.apache.calcite.sql.SqlKind; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.List; /** @@ -51,7 +53,7 @@ private RexTableInputRef(RelTableRef tableRef, int index, RelDataType type) { //~ Methods ---------------------------------------------------------------- - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return this == obj || obj instanceof RexTableInputRef && tableRef.equals(((RexTableInputRef) obj).tableRef) @@ -110,7 +112,7 @@ private RelTableRef(RelOptTable table, int entityNumber) { //~ Methods ---------------------------------------------------------------- - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return this == obj || obj instanceof RelTableRef && table.getQualifiedName().equals(((RelTableRef) obj).getQualifiedName()) diff --git a/core/src/main/java/org/apache/calcite/rex/RexWindow.java b/core/src/main/java/org/apache/calcite/rex/RexWindow.java index 3793fc5ad68..2c33b03305a 100644 --- a/core/src/main/java/org/apache/calcite/rex/RexWindow.java +++ b/core/src/main/java/org/apache/calcite/rex/RexWindow.java @@ -21,6 +21,8 @@ import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableList; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.List; import java.util.Objects; @@ -96,7 +98,7 @@ public int hashCode() { return digest.hashCode(); } - public boolean equals(Object that) { + @Override public boolean equals(@Nullable Object that) { if (that instanceof RexWindow) { RexWindow window = (RexWindow) that; return digest.equals(window.digest); diff --git a/core/src/main/java/org/apache/calcite/rex/RexWindowBounds.java b/core/src/main/java/org/apache/calcite/rex/RexWindowBounds.java index 3f5e6fa3e3a..9cada271384 100644 --- a/core/src/main/java/org/apache/calcite/rex/RexWindowBounds.java +++ b/core/src/main/java/org/apache/calcite/rex/RexWindowBounds.java @@ -22,6 +22,8 @@ import com.google.common.collect.ImmutableList; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.Objects; /** @@ -105,7 +107,7 @@ private static class RexUnboundedWindowBound extends RexWindowBound { return preceding ? 0 : 2; } - @Override public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { return this == o || o instanceof RexUnboundedWindowBound && preceding == ((RexUnboundedWindowBound) o).preceding; @@ -132,7 +134,7 @@ private static class RexCurrentRowWindowBound extends RexWindowBound { return 1; } - @Override public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { return this == o || o instanceof RexCurrentRowWindowBound; } @@ -187,7 +189,7 @@ private RexBoundedWindowBound(SqlKind sqlKind, RexNode offset) { return offset + " " + sqlKind; } - @Override public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { return this == o || o instanceof RexBoundedWindowBound && offset.equals(((RexBoundedWindowBound) o).offset) diff --git a/core/src/main/java/org/apache/calcite/runtime/Automaton.java b/core/src/main/java/org/apache/calcite/runtime/Automaton.java index 0079da8f68f..baa55496fcd 100644 --- a/core/src/main/java/org/apache/calcite/runtime/Automaton.java +++ b/core/src/main/java/org/apache/calcite/runtime/Automaton.java @@ -21,6 +21,8 @@ import com.google.common.collect.ImmutableList; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.Objects; /** A nondeterministic finite-state automaton (NFA). @@ -97,7 +99,7 @@ static class State { this.id = id; } - @Override public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { return o == this || o instanceof State && ((State) o).id == id; diff --git a/core/src/main/java/org/apache/calcite/runtime/ConsList.java b/core/src/main/java/org/apache/calcite/runtime/ConsList.java index 445cf7e1b1d..4a68164b078 100644 --- a/core/src/main/java/org/apache/calcite/runtime/ConsList.java +++ b/core/src/main/java/org/apache/calcite/runtime/ConsList.java @@ -18,6 +18,8 @@ import com.google.common.collect.ImmutableList; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; @@ -78,7 +80,7 @@ public int size() { return toList().hashCode(); } - @Override public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { return o == this || o instanceof List && toList().equals(o); diff --git a/core/src/main/java/org/apache/calcite/runtime/DeterministicAutomaton.java b/core/src/main/java/org/apache/calcite/runtime/DeterministicAutomaton.java index 3602c0b4328..0acd172a468 100644 --- a/core/src/main/java/org/apache/calcite/runtime/DeterministicAutomaton.java +++ b/core/src/main/java/org/apache/calcite/runtime/DeterministicAutomaton.java @@ -19,6 +19,8 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableSet; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.HashSet; import java.util.Objects; import java.util.Optional; @@ -169,7 +171,7 @@ public boolean contains(Automaton.State state) { return states.contains(state); } - @Override public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { return this == o || o instanceof MultiState && Objects.equals(states, ((MultiState) o).states); diff --git a/core/src/main/java/org/apache/calcite/runtime/FlatLists.java b/core/src/main/java/org/apache/calcite/runtime/FlatLists.java index c8c7d07e545..b2d161a7fe6 100644 --- a/core/src/main/java/org/apache/calcite/runtime/FlatLists.java +++ b/core/src/main/java/org/apache/calcite/runtime/FlatLists.java @@ -21,6 +21,8 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.AbstractList; import java.util.ArrayList; import java.util.Arrays; @@ -332,7 +334,7 @@ public Iterator iterator() { return Collections.singletonList(t0).iterator(); } - public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } @@ -448,7 +450,7 @@ public Iterator iterator() { return Arrays.asList(t0, t1).iterator(); } - public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } @@ -585,7 +587,7 @@ public Iterator iterator() { return Arrays.asList(t0, t1, t2).iterator(); } - public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } @@ -739,7 +741,7 @@ public Iterator iterator() { return Arrays.asList(t0, t1, t2, t3).iterator(); } - public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } @@ -912,7 +914,7 @@ public Iterator iterator() { return Arrays.asList(t0, t1, t2, t3, t4).iterator(); } - public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } @@ -1105,7 +1107,7 @@ public Iterator iterator() { return Arrays.asList(t0, t1, t2, t3, t4, t5).iterator(); } - public boolean equals(Object o) { + public boolean equals(@Nullable Object o) { if (this == o) { return true; } @@ -1265,7 +1267,7 @@ public int hashCode() { return 1; // same as Collections.emptyList() } - public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { return o == this || o instanceof List && ((List) o).isEmpty(); } diff --git a/core/src/main/java/org/apache/calcite/runtime/JsonFunctions.java b/core/src/main/java/org/apache/calcite/runtime/JsonFunctions.java index 21d42d77576..f5f72c2f620 100644 --- a/core/src/main/java/org/apache/calcite/runtime/JsonFunctions.java +++ b/core/src/main/java/org/apache/calcite/runtime/JsonFunctions.java @@ -36,6 +36,8 @@ import com.jayway.jsonpath.spi.mapper.JacksonMappingProvider; import com.jayway.jsonpath.spi.mapper.MappingProvider; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -772,7 +774,7 @@ public boolean hasException() { return exc != null; } - @Override public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } diff --git a/core/src/main/java/org/apache/calcite/runtime/Matcher.java b/core/src/main/java/org/apache/calcite/runtime/Matcher.java index 627c6f5f246..407f80decc6 100644 --- a/core/src/main/java/org/apache/calcite/runtime/Matcher.java +++ b/core/src/main/java/org/apache/calcite/runtime/Matcher.java @@ -24,6 +24,8 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.Sets; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -243,7 +245,7 @@ public PartialMatch append(String symbol, E row, return new PartialMatch<>(startRow, symbols, rows, toState); } - @Override public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { return o == this || o instanceof PartialMatch && startRow == ((PartialMatch) o).startRow @@ -333,7 +335,7 @@ static class Tuple { this.row = row; } - @Override public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { return o == this || o instanceof Tuple && ((Tuple) o).symbol.equals(symbol) diff --git a/core/src/main/java/org/apache/calcite/runtime/Resources.java b/core/src/main/java/org/apache/calcite/runtime/Resources.java index 17dc7efab68..27060c898ad 100644 --- a/core/src/main/java/org/apache/calcite/runtime/Resources.java +++ b/core/src/main/java/org/apache/calcite/runtime/Resources.java @@ -16,6 +16,8 @@ */ package org.apache.calcite.runtime; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.io.IOException; import java.io.InputStream; import java.lang.annotation.ElementType; @@ -281,7 +283,7 @@ public Inst(String base, Locale locale, Method method, Object... args) { this.args = args; } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return this == obj || obj != null && obj.getClass() == this.getClass() diff --git a/core/src/main/java/org/apache/calcite/schema/Schemas.java b/core/src/main/java/org/apache/calcite/schema/Schemas.java index 00b9239b9d9..5e3b2700e4b 100644 --- a/core/src/main/java/org/apache/calcite/schema/Schemas.java +++ b/core/src/main/java/org/apache/calcite/schema/Schemas.java @@ -45,6 +45,8 @@ import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.lang.reflect.Type; import java.sql.Connection; import java.util.AbstractList; @@ -583,7 +585,7 @@ private static class PathImpl this.pairs = pairs; } - @Override public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { return this == o || o instanceof PathImpl && pairs.equals(((PathImpl) o).pairs); diff --git a/core/src/main/java/org/apache/calcite/schema/impl/LongSchemaVersion.java b/core/src/main/java/org/apache/calcite/schema/impl/LongSchemaVersion.java index 399d1b3436c..cb9f4619f27 100644 --- a/core/src/main/java/org/apache/calcite/schema/impl/LongSchemaVersion.java +++ b/core/src/main/java/org/apache/calcite/schema/impl/LongSchemaVersion.java @@ -18,6 +18,8 @@ import org.apache.calcite.schema.SchemaVersion; +import org.checkerframework.checker.nullness.qual.Nullable; + /** Implementation of SchemaVersion that uses a long value as representation. */ public class LongSchemaVersion implements SchemaVersion { private final long value; @@ -36,7 +38,7 @@ public boolean isBefore(SchemaVersion other) { return this.value < ((LongSchemaVersion) other).value; } - public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { if (this == obj) { return true; } diff --git a/core/src/main/java/org/apache/calcite/sql/SqlCollation.java b/core/src/main/java/org/apache/calcite/sql/SqlCollation.java index cadc89e783c..3f31d65c954 100644 --- a/core/src/main/java/org/apache/calcite/sql/SqlCollation.java +++ b/core/src/main/java/org/apache/calcite/sql/SqlCollation.java @@ -22,6 +22,8 @@ import org.apache.calcite.util.SerializableCharset; import org.apache.calcite.util.Util; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.io.Serializable; import java.nio.charset.Charset; import java.text.Collator; @@ -122,7 +124,7 @@ public SqlCollation( //~ Methods ---------------------------------------------------------------- - @Override public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { return this == o || o instanceof SqlCollation && collationName.equals(((SqlCollation) o).collationName); diff --git a/core/src/main/java/org/apache/calcite/sql/SqlIntervalLiteral.java b/core/src/main/java/org/apache/calcite/sql/SqlIntervalLiteral.java index d0d49bb3770..6a2a8dcd75e 100644 --- a/core/src/main/java/org/apache/calcite/sql/SqlIntervalLiteral.java +++ b/core/src/main/java/org/apache/calcite/sql/SqlIntervalLiteral.java @@ -20,6 +20,8 @@ import org.apache.calcite.sql.type.SqlTypeName; import org.apache.calcite.util.Litmus; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.Objects; /** @@ -109,7 +111,7 @@ public static class IntervalValue { this.intervalStr = intervalStr; } - public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { if (!(obj instanceof IntervalValue)) { return false; } diff --git a/core/src/main/java/org/apache/calcite/sql/SqlLiteral.java b/core/src/main/java/org/apache/calcite/sql/SqlLiteral.java index c3b7981f093..2bb68d11ed0 100644 --- a/core/src/main/java/org/apache/calcite/sql/SqlLiteral.java +++ b/core/src/main/java/org/apache/calcite/sql/SqlLiteral.java @@ -39,6 +39,8 @@ import org.apache.calcite.util.TimestampString; import org.apache.calcite.util.Util; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.math.BigDecimal; import java.nio.charset.Charset; import java.nio.charset.UnsupportedCharsetException; @@ -618,7 +620,7 @@ public static SqlLiteral createSample( return new SqlLiteral(sampleSpec, SqlTypeName.SYMBOL, pos); } - public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { if (!(obj instanceof SqlLiteral)) { return false; } diff --git a/core/src/main/java/org/apache/calcite/sql/SqlOperator.java b/core/src/main/java/org/apache/calcite/sql/SqlOperator.java index 310b325f65a..e4c5aee0e52 100644 --- a/core/src/main/java/org/apache/calcite/sql/SqlOperator.java +++ b/core/src/main/java/org/apache/calcite/sql/SqlOperator.java @@ -38,6 +38,8 @@ import com.google.common.collect.ImmutableList; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.Arrays; import java.util.List; import java.util.Objects; @@ -366,7 +368,7 @@ protected void unparseListClause( } // override Object - public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { if (!(obj instanceof SqlOperator)) { return false; } diff --git a/core/src/main/java/org/apache/calcite/sql/parser/SqlParserPos.java b/core/src/main/java/org/apache/calcite/sql/parser/SqlParserPos.java index a1d9d29a979..ed505b569d5 100644 --- a/core/src/main/java/org/apache/calcite/sql/parser/SqlParserPos.java +++ b/core/src/main/java/org/apache/calcite/sql/parser/SqlParserPos.java @@ -21,6 +21,8 @@ import com.google.common.collect.Iterables; import com.google.common.collect.Lists; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.io.Serializable; import java.util.AbstractList; import java.util.Arrays; @@ -89,7 +91,7 @@ public int hashCode() { return Objects.hash(lineNumber, columnNumber, endLineNumber, endColumnNumber); } - public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { return o == this || o instanceof SqlParserPos && this.lineNumber == ((SqlParserPos) o).lineNumber diff --git a/core/src/main/java/org/apache/calcite/sql/util/IdPair.java b/core/src/main/java/org/apache/calcite/sql/util/IdPair.java index 9cd211dfb49..21e660742b7 100644 --- a/core/src/main/java/org/apache/calcite/sql/util/IdPair.java +++ b/core/src/main/java/org/apache/calcite/sql/util/IdPair.java @@ -17,6 +17,8 @@ package org.apache.calcite.sql.util; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.List; import java.util.Map; import java.util.Objects; @@ -48,7 +50,7 @@ protected IdPair(L left, R right) { return left + "=" + right; } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return obj == this || obj instanceof IdPair && left == ((IdPair) obj).left diff --git a/core/src/main/java/org/apache/calcite/sql/util/SqlString.java b/core/src/main/java/org/apache/calcite/sql/util/SqlString.java index 3e968575f0f..de71a6cae30 100644 --- a/core/src/main/java/org/apache/calcite/sql/util/SqlString.java +++ b/core/src/main/java/org/apache/calcite/sql/util/SqlString.java @@ -20,6 +20,8 @@ import com.google.common.collect.ImmutableList; +import org.checkerframework.checker.nullness.qual.Nullable; + /** * String that represents a kocher SQL statement, expression, or fragment. * @@ -60,7 +62,7 @@ public SqlString(SqlDialect dialect, String sql, ImmutableList dynamicP return sql.hashCode(); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return obj == this || obj instanceof SqlString && sql.equals(((SqlString) obj).sql); diff --git a/core/src/main/java/org/apache/calcite/sql/validate/SqlMonikerImpl.java b/core/src/main/java/org/apache/calcite/sql/validate/SqlMonikerImpl.java index 8b504284634..3041cddbf09 100644 --- a/core/src/main/java/org/apache/calcite/sql/validate/SqlMonikerImpl.java +++ b/core/src/main/java/org/apache/calcite/sql/validate/SqlMonikerImpl.java @@ -22,6 +22,8 @@ import com.google.common.collect.ImmutableList; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.List; import java.util.Objects; @@ -53,7 +55,7 @@ public SqlMonikerImpl(String name, SqlMonikerType type) { //~ Methods ---------------------------------------------------------------- - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return this == obj || obj instanceof SqlMonikerImpl && type == ((SqlMonikerImpl) obj).type diff --git a/core/src/main/java/org/apache/calcite/sql2rel/RelDecorrelator.java b/core/src/main/java/org/apache/calcite/sql2rel/RelDecorrelator.java index 161439ff39d..a576e5a2cd5 100644 --- a/core/src/main/java/org/apache/calcite/sql2rel/RelDecorrelator.java +++ b/core/src/main/java/org/apache/calcite/sql2rel/RelDecorrelator.java @@ -101,6 +101,7 @@ import com.google.common.collect.Sets; import com.google.common.collect.SortedSetMultimap; +import org.checkerframework.checker.nullness.qual.Nullable; import org.slf4j.Logger; import java.math.BigDecimal; @@ -2675,7 +2676,7 @@ static class CorRef implements Comparable { return Objects.hash(uniqueKey, corr, field); } - @Override public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { return this == o || o instanceof CorRef && uniqueKey == ((CorRef) o).uniqueKey @@ -2718,7 +2719,7 @@ static class CorDef implements Comparable { return Objects.hash(corr, field); } - @Override public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { return this == o || o instanceof CorDef && corr == ((CorDef) o).corr @@ -2776,7 +2777,7 @@ private CorelMap(Multimap mapRefRelToCorRef, + "\n"; } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return obj == this || obj instanceof CorelMap && mapRefRelToCorRef.equals(((CorelMap) obj).mapRefRelToCorRef) diff --git a/core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java b/core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java index 1b0a25c5e1d..faa0b8d84e8 100644 --- a/core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java +++ b/core/src/main/java/org/apache/calcite/sql2rel/SqlToRelConverter.java @@ -182,6 +182,7 @@ import com.google.common.collect.Iterables; import com.google.common.collect.Sets; +import org.checkerframework.checker.nullness.qual.Nullable; import org.slf4j.Logger; import java.lang.reflect.Type; @@ -5995,7 +5996,7 @@ private ConfigImpl(boolean decorrelationEnabled, this.hintStrategyTable = hintStrategyTable; } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return this == obj || obj instanceof ConfigImpl && decorrelationEnabled == ((ConfigImpl) obj).decorrelationEnabled diff --git a/core/src/main/java/org/apache/calcite/tools/RuleSets.java b/core/src/main/java/org/apache/calcite/tools/RuleSets.java index e158ad8dd15..49ecead4f97 100644 --- a/core/src/main/java/org/apache/calcite/tools/RuleSets.java +++ b/core/src/main/java/org/apache/calcite/tools/RuleSets.java @@ -20,6 +20,8 @@ import com.google.common.collect.ImmutableList; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.Iterator; /** @@ -53,7 +55,7 @@ private static class ListRuleSet implements RuleSet { return rules.hashCode(); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return obj == this || obj instanceof ListRuleSet && rules.equals(((ListRuleSet) obj).rules); diff --git a/core/src/main/java/org/apache/calcite/util/BitString.java b/core/src/main/java/org/apache/calcite/util/BitString.java index eb0caf74267..d2701177c28 100644 --- a/core/src/main/java/org/apache/calcite/util/BitString.java +++ b/core/src/main/java/org/apache/calcite/util/BitString.java @@ -16,6 +16,8 @@ */ package org.apache.calcite.util; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.math.BigInteger; import java.util.List; import java.util.Objects; @@ -95,7 +97,7 @@ public String toString() { return bits.hashCode() + bitCount; } - @Override public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { return o == this || o instanceof BitString && bits.equals(((BitString) o).bits) diff --git a/core/src/main/java/org/apache/calcite/util/DateString.java b/core/src/main/java/org/apache/calcite/util/DateString.java index 3467c415f08..de9bba6b21b 100644 --- a/core/src/main/java/org/apache/calcite/util/DateString.java +++ b/core/src/main/java/org/apache/calcite/util/DateString.java @@ -20,6 +20,8 @@ import com.google.common.base.Preconditions; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.Calendar; import java.util.regex.Pattern; import javax.annotation.Nonnull; @@ -75,7 +77,7 @@ private static String ymd(int year, int month, int day) { return v; } - @Override public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { // The value is in canonical form. return o == this || o instanceof DateString diff --git a/core/src/main/java/org/apache/calcite/util/ImmutableBitSet.java b/core/src/main/java/org/apache/calcite/util/ImmutableBitSet.java index 4da1c73c48d..10da5a49198 100644 --- a/core/src/main/java/org/apache/calcite/util/ImmutableBitSet.java +++ b/core/src/main/java/org/apache/calcite/util/ImmutableBitSet.java @@ -24,6 +24,8 @@ import com.google.common.collect.Iterables; import com.google.common.collect.Ordering; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.io.Serializable; import java.nio.LongBuffer; import java.util.AbstractList; @@ -446,7 +448,7 @@ public int size() { * {@code false} otherwise * @see #size() */ - public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { if (this == obj) { return true; } diff --git a/core/src/main/java/org/apache/calcite/util/ImmutableIntList.java b/core/src/main/java/org/apache/calcite/util/ImmutableIntList.java index 9fb4d77bfae..61fb7f5402e 100644 --- a/core/src/main/java/org/apache/calcite/util/ImmutableIntList.java +++ b/core/src/main/java/org/apache/calcite/util/ImmutableIntList.java @@ -25,6 +25,8 @@ import com.google.common.collect.Lists; import com.google.common.collect.UnmodifiableListIterator; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.lang.reflect.Array; import java.util.Arrays; import java.util.Collection; @@ -111,7 +113,7 @@ private static ImmutableIntList copyFromCollection( return Arrays.hashCode(ints); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return this == obj || obj instanceof ImmutableIntList ? Arrays.equals(ints, ((ImmutableIntList) obj).ints) diff --git a/core/src/main/java/org/apache/calcite/util/NameMap.java b/core/src/main/java/org/apache/calcite/util/NameMap.java index 3a5fa1daf7e..ac6e715a55e 100644 --- a/core/src/main/java/org/apache/calcite/util/NameMap.java +++ b/core/src/main/java/org/apache/calcite/util/NameMap.java @@ -20,6 +20,8 @@ import com.google.common.collect.ImmutableSortedMap; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.Collections; import java.util.Map; import java.util.NavigableMap; @@ -53,7 +55,7 @@ public NameMap() { return map.hashCode(); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return this == obj || obj instanceof NameMap && map.equals(((NameMap) obj).map); diff --git a/core/src/main/java/org/apache/calcite/util/NameMultimap.java b/core/src/main/java/org/apache/calcite/util/NameMultimap.java index 5278f9b5cef..8d1505746eb 100644 --- a/core/src/main/java/org/apache/calcite/util/NameMultimap.java +++ b/core/src/main/java/org/apache/calcite/util/NameMultimap.java @@ -18,6 +18,8 @@ import org.apache.calcite.linq4j.function.Experimental; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -54,7 +56,7 @@ public NameMultimap() { return map.hashCode(); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return this == obj || obj instanceof NameMultimap && map.equals(((NameMultimap) obj).map); diff --git a/core/src/main/java/org/apache/calcite/util/NameSet.java b/core/src/main/java/org/apache/calcite/util/NameSet.java index 0849aea80d7..f21003ea483 100644 --- a/core/src/main/java/org/apache/calcite/util/NameSet.java +++ b/core/src/main/java/org/apache/calcite/util/NameSet.java @@ -18,6 +18,8 @@ import com.google.common.collect.Maps; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.Collection; import java.util.Collections; import java.util.Comparator; @@ -54,7 +56,7 @@ public static NameSet immutableCopyOf(Set names) { return names.hashCode(); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return this == obj || obj instanceof NameSet && names.equals(((NameSet) obj).names); diff --git a/core/src/main/java/org/apache/calcite/util/NlsString.java b/core/src/main/java/org/apache/calcite/util/NlsString.java index 8c682563d05..685f679c934 100644 --- a/core/src/main/java/org/apache/calcite/util/NlsString.java +++ b/core/src/main/java/org/apache/calcite/util/NlsString.java @@ -27,6 +27,8 @@ import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.nio.ByteBuffer; import java.nio.charset.CharacterCodingException; import java.nio.charset.Charset; @@ -161,7 +163,7 @@ public int hashCode() { return Objects.hash(stringValue, bytesValue, charsetName, collation); } - public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return this == obj || obj instanceof NlsString && Objects.equals(stringValue, ((NlsString) obj).stringValue) diff --git a/core/src/main/java/org/apache/calcite/util/Pair.java b/core/src/main/java/org/apache/calcite/util/Pair.java index 9cd9c2e3c78..f7fc9bc7a9d 100644 --- a/core/src/main/java/org/apache/calcite/util/Pair.java +++ b/core/src/main/java/org/apache/calcite/util/Pair.java @@ -16,6 +16,8 @@ */ package org.apache.calcite.util; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.io.Serializable; import java.util.AbstractList; import java.util.Collections; @@ -81,7 +83,7 @@ public static Pair of(Map.Entry entry) { //~ Methods ---------------------------------------------------------------- - public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return this == obj || (obj instanceof Pair) && Objects.equals(this.left, ((Pair) obj).left) diff --git a/core/src/main/java/org/apache/calcite/util/Permutation.java b/core/src/main/java/org/apache/calcite/util/Permutation.java index 5c4148f8ff3..08579986a94 100644 --- a/core/src/main/java/org/apache/calcite/util/Permutation.java +++ b/core/src/main/java/org/apache/calcite/util/Permutation.java @@ -21,6 +21,8 @@ import org.apache.calcite.util.mapping.MappingType; import org.apache.calcite.util.mapping.Mappings; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.Arrays; import java.util.Iterator; @@ -473,7 +475,7 @@ public int hashCode() { return toString().hashCode(); } - public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { // not very efficient return (obj instanceof Permutation) && toString().equals(obj.toString()); diff --git a/core/src/main/java/org/apache/calcite/util/TimeString.java b/core/src/main/java/org/apache/calcite/util/TimeString.java index fc2f953ea34..b426a5dc9fd 100644 --- a/core/src/main/java/org/apache/calcite/util/TimeString.java +++ b/core/src/main/java/org/apache/calcite/util/TimeString.java @@ -21,6 +21,8 @@ import com.google.common.base.Preconditions; import com.google.common.base.Strings; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.Calendar; import java.util.regex.Pattern; import javax.annotation.Nonnull; @@ -118,7 +120,7 @@ public TimeString withFraction(String fraction) { return v; } - @Override public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { // The value is in canonical form (no trailing zeros). return o == this || o instanceof TimeString diff --git a/core/src/main/java/org/apache/calcite/util/TimeWithTimeZoneString.java b/core/src/main/java/org/apache/calcite/util/TimeWithTimeZoneString.java index f53bcca3696..3d7a8111d22 100644 --- a/core/src/main/java/org/apache/calcite/util/TimeWithTimeZoneString.java +++ b/core/src/main/java/org/apache/calcite/util/TimeWithTimeZoneString.java @@ -20,6 +20,8 @@ import com.google.common.base.Preconditions; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Locale; @@ -145,7 +147,7 @@ public TimeWithTimeZoneString withTimeZone(TimeZone timeZone) { return v; } - @Override public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { // The value is in canonical form (no trailing zeros). return o == this || o instanceof TimeWithTimeZoneString diff --git a/core/src/main/java/org/apache/calcite/util/TimestampString.java b/core/src/main/java/org/apache/calcite/util/TimestampString.java index f4ecd0b4daa..9dab68a2653 100644 --- a/core/src/main/java/org/apache/calcite/util/TimestampString.java +++ b/core/src/main/java/org/apache/calcite/util/TimestampString.java @@ -21,6 +21,8 @@ import com.google.common.base.Preconditions; import com.google.common.base.Strings; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.Calendar; import java.util.regex.Pattern; @@ -98,7 +100,7 @@ public TimestampString withFraction(String fraction) { return v; } - @Override public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { // The value is in canonical form (no trailing zeros). return o == this || o instanceof TimestampString diff --git a/core/src/main/java/org/apache/calcite/util/TimestampWithTimeZoneString.java b/core/src/main/java/org/apache/calcite/util/TimestampWithTimeZoneString.java index 6594a1ef861..2db66ec640d 100644 --- a/core/src/main/java/org/apache/calcite/util/TimestampWithTimeZoneString.java +++ b/core/src/main/java/org/apache/calcite/util/TimestampWithTimeZoneString.java @@ -20,6 +20,8 @@ import com.google.common.base.Preconditions; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Locale; @@ -141,7 +143,7 @@ public TimestampWithTimeZoneString withTimeZone(TimeZone timeZone) { return v; } - @Override public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { // The value is in canonical form (no trailing zeros). return o == this || o instanceof TimestampWithTimeZoneString diff --git a/core/src/main/java/org/apache/calcite/util/graph/DefaultEdge.java b/core/src/main/java/org/apache/calcite/util/graph/DefaultEdge.java index e13f81b5426..2c616e2f88a 100644 --- a/core/src/main/java/org/apache/calcite/util/graph/DefaultEdge.java +++ b/core/src/main/java/org/apache/calcite/util/graph/DefaultEdge.java @@ -16,6 +16,8 @@ */ package org.apache.calcite.util.graph; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.Objects; /** @@ -34,7 +36,7 @@ public DefaultEdge(Object source, Object target) { return source.hashCode() * 31 + target.hashCode(); } - @Override public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { return this == obj || obj instanceof DefaultEdge && ((DefaultEdge) obj).source.equals(source) diff --git a/core/src/main/java/org/apache/calcite/util/mapping/IntPair.java b/core/src/main/java/org/apache/calcite/util/mapping/IntPair.java index f7b4834cc77..20ac9d0a6aa 100644 --- a/core/src/main/java/org/apache/calcite/util/mapping/IntPair.java +++ b/core/src/main/java/org/apache/calcite/util/mapping/IntPair.java @@ -22,6 +22,8 @@ import com.google.common.collect.Lists; import com.google.common.collect.Ordering; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.AbstractList; import java.util.Comparator; import java.util.List; @@ -92,7 +94,7 @@ public String toString() { return source + "-" + target; } - public boolean equals(Object obj) { + public boolean equals(@Nullable Object obj) { if (obj instanceof IntPair) { IntPair that = (IntPair) obj; return (this.source == that.source) && (this.target == that.target); diff --git a/core/src/main/java/org/apache/calcite/util/mapping/Mappings.java b/core/src/main/java/org/apache/calcite/util/mapping/Mappings.java index 9162d4074dd..bd3273225aa 100644 --- a/core/src/main/java/org/apache/calcite/util/mapping/Mappings.java +++ b/core/src/main/java/org/apache/calcite/util/mapping/Mappings.java @@ -25,6 +25,8 @@ import com.google.common.collect.Iterables; import com.google.common.primitives.Ints; +import org.checkerframework.checker.nullness.qual.Nullable; + import java.util.AbstractList; import java.util.ArrayList; import java.util.Arrays; @@ -1017,7 +1019,7 @@ public int hashCode() { return toString().hashCode(); } - public boolean equals(Object obj) { + @Override public boolean equals(@Nullable Object obj) { // not very efficient return (obj instanceof Mapping) && toString().equals(obj.toString());