mirror of https://github.com/apache/druid.git
Change Inspection Profile to set "Method is identical to its super method" as error (#16976)
* Make IntelliJ's MethodIsIdenticalToSuperMethod an error * Change codebase to follow new IntelliJ inspection * Restore non-short-circuit boolean expressions to pass tests
This commit is contained in:
parent
caf8ce3e0b
commit
0217c8c541
|
@ -120,6 +120,7 @@
|
|||
<inspection_tool class="MavenDuplicatePluginInspection" enabled="true" level="ERROR" enabled_by_default="true" />
|
||||
<inspection_tool class="MavenModelInspection" enabled="true" level="WARNING" enabled_by_default="true" />
|
||||
<inspection_tool class="MethodComplexity" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="MethodIsIdenticalToSuperMethod" enabled="true" level="ERROR" enabled_by_default="true" />
|
||||
<inspection_tool class="MismatchedArrayReadWrite" enabled="true" level="ERROR" enabled_by_default="true" />
|
||||
<inspection_tool class="MismatchedCollectionQueryUpdate" enabled="true" level="ERROR" enabled_by_default="true">
|
||||
<option name="queryNames">
|
||||
|
|
|
@ -20,20 +20,11 @@
|
|||
package org.apache.druid.indexing.common.task.batch.parallel;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import org.apache.druid.indexing.common.task.TaskResource;
|
||||
import org.apache.druid.server.security.Action;
|
||||
import org.apache.druid.server.security.Resource;
|
||||
import org.apache.druid.server.security.ResourceAction;
|
||||
import org.apache.druid.server.security.ResourceType;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class LegacySinglePhaseSubTask extends SinglePhaseSubTask
|
||||
{
|
||||
|
@ -66,16 +57,4 @@ public class LegacySinglePhaseSubTask extends SinglePhaseSubTask
|
|||
return SinglePhaseSubTask.OLD_TYPE_NAME;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@JsonIgnore
|
||||
@Override
|
||||
public Set<ResourceAction> getInputSourceResources()
|
||||
{
|
||||
return getIngestionSchema().getIOConfig().getInputSource() != null ?
|
||||
getIngestionSchema().getIOConfig().getInputSource().getTypes()
|
||||
.stream()
|
||||
.map(i -> new ResourceAction(new Resource(i, ResourceType.EXTERNAL), Action.READ))
|
||||
.collect(Collectors.toSet()) :
|
||||
ImmutableSet.of();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,13 +19,9 @@
|
|||
|
||||
package org.apache.druid.testing.tools;
|
||||
|
||||
import com.fasterxml.jackson.databind.Module;
|
||||
import com.google.inject.Binder;
|
||||
import org.apache.druid.initialization.DruidModule;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Super-simple "client" for the custom node role which defines
|
||||
* the node role so that REST APIs and the system tables are
|
||||
|
@ -40,9 +36,4 @@ public class CustomNodeRoleClientModule implements DruidModule
|
|||
// NodeRoles.addRole(binder, CliCustomNodeRole.NODE_ROLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends Module> getJacksonModules()
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,22 +19,13 @@
|
|||
|
||||
package org.apache.druid.testing.tools;
|
||||
|
||||
import com.fasterxml.jackson.databind.Module;
|
||||
import com.google.inject.Binder;
|
||||
import org.apache.druid.guice.ExpressionModule;
|
||||
import org.apache.druid.initialization.DruidModule;
|
||||
import org.apache.druid.sql.guice.SqlBindings;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
public class SleepModule implements DruidModule
|
||||
{
|
||||
@Override
|
||||
public List<? extends Module> getJacksonModules()
|
||||
{
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure(Binder binder)
|
||||
|
|
|
@ -246,12 +246,6 @@ class LongExpr extends ConstantExpr<Long>
|
|||
super(ExpressionType.LONG, Preconditions.checkNotNull(value, "value"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ExprEval realEval()
|
||||
{
|
||||
|
@ -329,12 +323,6 @@ class DoubleExpr extends ConstantExpr<Double>
|
|||
super(ExpressionType.DOUBLE, Preconditions.checkNotNull(value, "value"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ExprEval realEval()
|
||||
{
|
||||
|
|
|
@ -530,11 +530,6 @@ public interface Function extends NamedFunction
|
|||
*/
|
||||
abstract class ArraysMergeFunction extends ArraysFunction
|
||||
{
|
||||
@Override
|
||||
public Set<Expr> getArrayInputs(List<Expr> args)
|
||||
{
|
||||
return ImmutableSet.copyOf(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasArrayOutput()
|
||||
|
@ -1183,16 +1178,6 @@ public interface Function extends NamedFunction
|
|||
return NAME;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ExpressionType getOutputType(Expr.InputBindingInspector inspector, List<Expr> args)
|
||||
{
|
||||
return ExpressionTypeConversion.function(
|
||||
args.get(0).getOutputType(inspector),
|
||||
args.get(1).getOutputType(inspector)
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canVectorize(Expr.InputBindingInspector inspector, List<Expr> args)
|
||||
{
|
||||
|
@ -2315,18 +2300,6 @@ public interface Function extends NamedFunction
|
|||
return ExprEval.ofLongBoolean(!super.apply(args, bindings).asBoolean());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateArguments(List<Expr> args)
|
||||
{
|
||||
validationHelperCheckArgumentCount(args, 2);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ExpressionType getOutputType(Expr.InputBindingInspector inspector, List<Expr> args)
|
||||
{
|
||||
return ExpressionType.LONG;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3399,18 +3372,6 @@ public interface Function extends NamedFunction
|
|||
return ExprEval.ofArray(arrayType, out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Expr> getScalarInputs(List<Expr> args)
|
||||
{
|
||||
return ImmutableSet.copyOf(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Expr> getArrayInputs(List<Expr> args)
|
||||
{
|
||||
return Collections.emptySet();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasArrayOutput()
|
||||
{
|
||||
|
@ -3544,12 +3505,6 @@ public interface Function extends NamedFunction
|
|||
return ExprEval.ofStringArray(arrayString.split(split != null ? split : ""));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<Expr> getScalarInputs(List<Expr> args)
|
||||
{
|
||||
return ImmutableSet.copyOf(args);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasArrayOutput()
|
||||
{
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
|
||||
package org.apache.druid.query.aggregation;
|
||||
|
||||
import org.apache.druid.query.monomorphicprocessing.RuntimeShapeInspector;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/**
|
||||
|
@ -71,9 +69,4 @@ public class CountBufferAggregator implements BufferAggregator
|
|||
// no resources to cleanup
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inspectRuntimeShape(RuntimeShapeInspector inspector)
|
||||
{
|
||||
// nothing to inspect
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
|
||||
package org.apache.druid.query.aggregation;
|
||||
|
||||
import org.apache.druid.query.monomorphicprocessing.RuntimeShapeInspector;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
public final class NoopBufferAggregator implements BufferAggregator
|
||||
|
@ -75,9 +73,4 @@ public final class NoopBufferAggregator implements BufferAggregator
|
|||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inspectRuntimeShape(RuntimeShapeInspector inspector)
|
||||
{
|
||||
// nothing to inspect
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,6 @@ import java.util.AbstractList;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.function.ToIntFunction;
|
||||
|
||||
public class BufferHashGrouper<KeyType> extends AbstractBufferHashGrouper<KeyType>
|
||||
{
|
||||
|
@ -128,12 +127,6 @@ public class BufferHashGrouper<KeyType> extends AbstractBufferHashGrouper<KeyTyp
|
|||
return initialized;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ToIntFunction<KeyType> hashFunction()
|
||||
{
|
||||
return Groupers::hashObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void newBucketHook(int bucketOffset)
|
||||
{
|
||||
|
|
|
@ -1815,12 +1815,6 @@ public class RowBasedGrouperHelper
|
|||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getKeyBufferValueSize()
|
||||
{
|
||||
return Integer.BYTES;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BufferComparator getBufferComparator()
|
||||
{
|
||||
|
|
|
@ -445,11 +445,6 @@ public class AutoTypeColumnMerger implements DimensionMergerV9
|
|||
return counter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove()
|
||||
{
|
||||
throw new UnsupportedOperationException("remove");
|
||||
}
|
||||
}
|
||||
|
||||
public static class IdLookupArrayIterator implements Iterator<int[]>
|
||||
|
|
|
@ -162,12 +162,6 @@ public class DictionaryMergingIterator<T extends Comparable<T>> implements Close
|
|||
return value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove()
|
||||
{
|
||||
throw new UnsupportedOperationException("remove");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close()
|
||||
{
|
||||
|
|
|
@ -106,12 +106,6 @@ public class SimpleDictionaryMergingIterator<T extends Comparable<T>> implements
|
|||
return counter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove()
|
||||
{
|
||||
throw new UnsupportedOperationException("remove");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close()
|
||||
{
|
||||
|
|
|
@ -222,13 +222,6 @@ public class StringUtf8DictionaryEncodedColumn implements DictionaryEncodedColum
|
|||
return DimensionSelectorUtils.makeValueMatcherGeneric(this, predicateFactory);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Object getObject()
|
||||
{
|
||||
return defaultGetObject();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class classOfObject()
|
||||
{
|
||||
|
|
|
@ -263,12 +263,6 @@ public class FrameBasedIndexedTable implements IndexedTable
|
|||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCacheable()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close()
|
||||
{
|
||||
|
|
|
@ -1423,13 +1423,6 @@ public class NestedFieldVirtualColumn implements VirtualColumn
|
|||
return Numbers.tryParseLong(o, 0L);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void inspectRuntimeShape(RuntimeShapeInspector inspector)
|
||||
{
|
||||
inspector.visit("baseSelector", baseSelector);
|
||||
inspector.visit("parts", parts);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isNull()
|
||||
{
|
||||
|
@ -1461,11 +1454,6 @@ public class NestedFieldVirtualColumn implements VirtualColumn
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> classOfObject()
|
||||
{
|
||||
return Object.class;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -21,7 +21,6 @@ package org.apache.druid.catalog.model.table;
|
|||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.apache.druid.catalog.model.CatalogUtils;
|
||||
import org.apache.druid.catalog.model.ColumnSpec;
|
||||
import org.apache.druid.catalog.model.Columns;
|
||||
import org.apache.druid.catalog.model.ModelProperties;
|
||||
|
@ -78,12 +77,6 @@ public class DatasourceDefn extends TableDefn
|
|||
super(SEGMENT_GRANULARITY_PROPERTY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validate(Object value, ObjectMapper jsonMapper)
|
||||
{
|
||||
String gran = decode(value, jsonMapper);
|
||||
CatalogUtils.validateGranularity(gran);
|
||||
}
|
||||
}
|
||||
|
||||
public static class HiddenColumnsDefn extends StringListPropertyDefn
|
||||
|
|
Loading…
Reference in New Issue