From 8b78b07259ad2f75cd9bc2ea1c7f998b2cb192f5 Mon Sep 17 00:00:00 2001
From: tianchen
Date: Sun, 23 Jun 2019 23:56:29 -0700
Subject: [PATCH] ARROW-5672: [Java] Refactor redundant method modifier
Related to [ARROW-5672](https://issues.apache.org/jira/browse/ARROW-5672).
Author: tianchen
Closes #4644 from tianchen92/check_method_modifier and squashes the following commits:
b915d366d fix build fail
846f2f5ba Refactor redundant method modifier
---
java/dev/checkstyle/checkstyle.xml | 2 +-
.../org/apache/arrow/flight/FlightClient.java | 8 ++--
.../flight/auth/BasicServerAuthHandler.java | 4 +-
.../flight/auth/ServerAuthInterceptor.java | 2 +-
.../gandiva/evaluator/BaseEvaluatorTest.java | 4 +-
.../arrow/memory/AllocationReservation.java | 6 +--
.../apache/arrow/memory/BufferAllocator.java | 40 +++++++++----------
.../apache/arrow/memory/BufferManager.java | 8 ++--
.../arrow/vector/BaseVariableWidthVector.java | 1 +
.../org/apache/arrow/vector/FieldVector.java | 6 +--
.../arrow/vector/complex/Positionable.java | 4 +-
.../vector/util/ByteFunctionHelpers.java | 6 +--
12 files changed, 46 insertions(+), 45 deletions(-)
diff --git a/java/dev/checkstyle/checkstyle.xml b/java/dev/checkstyle/checkstyle.xml
index ec84f401168ac..bc26b6b836fde 100644
--- a/java/dev/checkstyle/checkstyle.xml
+++ b/java/dev/checkstyle/checkstyle.xml
@@ -272,7 +272,7 @@
-
+
diff --git a/java/flight/src/main/java/org/apache/arrow/flight/FlightClient.java b/java/flight/src/main/java/org/apache/arrow/flight/FlightClient.java
index 221423e8d9adc..c70e1fddca22a 100644
--- a/java/flight/src/main/java/org/apache/arrow/flight/FlightClient.java
+++ b/java/flight/src/main/java/org/apache/arrow/flight/FlightClient.java
@@ -310,13 +310,13 @@ public PutResult getResult() {
*/
public interface ClientStreamListener {
- public void putNext();
+ void putNext();
- public void error(Throwable ex);
+ void error(Throwable ex);
- public void completed();
+ void completed();
- public PutResult getResult();
+ PutResult getResult();
}
diff --git a/java/flight/src/main/java/org/apache/arrow/flight/auth/BasicServerAuthHandler.java b/java/flight/src/main/java/org/apache/arrow/flight/auth/BasicServerAuthHandler.java
index 0a515838d7221..0a45edf66a750 100644
--- a/java/flight/src/main/java/org/apache/arrow/flight/auth/BasicServerAuthHandler.java
+++ b/java/flight/src/main/java/org/apache/arrow/flight/auth/BasicServerAuthHandler.java
@@ -45,9 +45,9 @@ public BasicServerAuthHandler(BasicAuthValidator authValidator) {
*/
public interface BasicAuthValidator {
- public byte[] getToken(String username, String password) throws Exception;
+ byte[] getToken(String username, String password) throws Exception;
- public Optional isValid(byte[] token);
+ Optional isValid(byte[] token);
}
diff --git a/java/flight/src/main/java/org/apache/arrow/flight/auth/ServerAuthInterceptor.java b/java/flight/src/main/java/org/apache/arrow/flight/auth/ServerAuthInterceptor.java
index 0d5e18fe671b0..f38dee74ce70a 100644
--- a/java/flight/src/main/java/org/apache/arrow/flight/auth/ServerAuthInterceptor.java
+++ b/java/flight/src/main/java/org/apache/arrow/flight/auth/ServerAuthInterceptor.java
@@ -56,7 +56,7 @@ public Listener interceptCall(ServerCall call,
return next.startCall(call, headers);
}
- private final Optional isValid(Metadata headers) {
+ private Optional isValid(Metadata headers) {
byte[] token = headers.get(AuthConstants.TOKEN_KEY);
return authHandler.isValid(token);
}
diff --git a/java/gandiva/src/test/java/org/apache/arrow/gandiva/evaluator/BaseEvaluatorTest.java b/java/gandiva/src/test/java/org/apache/arrow/gandiva/evaluator/BaseEvaluatorTest.java
index 0d7c9e34cb68b..9384cd4d363ad 100644
--- a/java/gandiva/src/test/java/org/apache/arrow/gandiva/evaluator/BaseEvaluatorTest.java
+++ b/java/gandiva/src/test/java/org/apache/arrow/gandiva/evaluator/BaseEvaluatorTest.java
@@ -132,9 +132,9 @@ public long getElapsedMillis() {
interface DataAndVectorGenerator {
- public void writeData(ArrowBuf buffer);
+ void writeData(ArrowBuf buffer);
- public ValueVector generateOutputVector(int numRowsInBatch);
+ ValueVector generateOutputVector(int numRowsInBatch);
}
class Int32DataAndVectorGenerator implements DataAndVectorGenerator {
diff --git a/java/memory/src/main/java/org/apache/arrow/memory/AllocationReservation.java b/java/memory/src/main/java/org/apache/arrow/memory/AllocationReservation.java
index c868c1678205d..808b9d04cc7b8 100644
--- a/java/memory/src/main/java/org/apache/arrow/memory/AllocationReservation.java
+++ b/java/memory/src/main/java/org/apache/arrow/memory/AllocationReservation.java
@@ -77,14 +77,14 @@ public interface AllocationReservation extends AutoCloseable {
*
* @return whether or not the reservation has been used
*/
- public boolean isUsed();
+ boolean isUsed();
/**
* Return whether or not the reservation has been closed.
*
* @return whether or not the reservation has been closed
*/
- public boolean isClosed();
+ boolean isClosed();
- public void close();
+ void close();
}
diff --git a/java/memory/src/main/java/org/apache/arrow/memory/BufferAllocator.java b/java/memory/src/main/java/org/apache/arrow/memory/BufferAllocator.java
index 057088e3cb1f1..06cd6d87c61f4 100644
--- a/java/memory/src/main/java/org/apache/arrow/memory/BufferAllocator.java
+++ b/java/memory/src/main/java/org/apache/arrow/memory/BufferAllocator.java
@@ -37,7 +37,7 @@ public interface BufferAllocator extends AutoCloseable {
* @return a new ArrowBuf, or null if the request can't be satisfied
* @throws OutOfMemoryException if buffer cannot be allocated
*/
- public ArrowBuf buffer(int size);
+ ArrowBuf buffer(int size);
/**
* Allocate a new or reused buffer of the provided size. Note that the buffer may technically
@@ -50,14 +50,14 @@ public interface BufferAllocator extends AutoCloseable {
* @return a new ArrowBuf, or null if the request can't be satisfied
* @throws OutOfMemoryException if buffer cannot be allocated
*/
- public ArrowBuf buffer(int size, BufferManager manager);
+ ArrowBuf buffer(int size, BufferManager manager);
/**
* Returns the allocator this allocator falls back to when it needs more memory.
*
* @return the underlying allocator used by this allocator
*/
- public ByteBufAllocator getAsByteBufAllocator();
+ ByteBufAllocator getAsByteBufAllocator();
/**
* Create a new child allocator.
@@ -67,7 +67,7 @@ public interface BufferAllocator extends AutoCloseable {
* @param maxAllocation maximum amount of space the new allocator can allocate
* @return the new allocator, or null if it can't be created
*/
- public BufferAllocator newChildAllocator(String name, long initReservation, long maxAllocation);
+ BufferAllocator newChildAllocator(String name, long initReservation, long maxAllocation);
/**
* Create a new child allocator.
@@ -78,7 +78,7 @@ public interface BufferAllocator extends AutoCloseable {
* @param maxAllocation maximum amount of space the new allocator can allocate
* @return the new allocator, or null if it can't be created
*/
- public BufferAllocator newChildAllocator(
+ BufferAllocator newChildAllocator(
String name,
AllocationListener listener,
long initReservation,
@@ -91,42 +91,42 @@ public BufferAllocator newChildAllocator(
* that, release all buffers before the allocator is closed.
*/
@Override
- public void close();
+ void close();
/**
* Returns the amount of memory currently allocated from this allocator.
*
* @return the amount of memory currently allocated
*/
- public long getAllocatedMemory();
+ long getAllocatedMemory();
/**
* Return the current maximum limit this allocator imposes.
*
* @return Limit in number of bytes.
*/
- public long getLimit();
+ long getLimit();
/**
* Return the initial reservation.
*
* @return reservation in bytes.
*/
- public long getInitReservation();
+ long getInitReservation();
/**
* Set the maximum amount of memory this allocator is allowed to allocate.
*
* @param newLimit The new Limit to apply to allocations
*/
- public void setLimit(long newLimit);
+ void setLimit(long newLimit);
/**
* Returns the peak amount of memory allocated from this allocator.
*
* @return the peak amount of memory allocated
*/
- public long getPeakMemoryAllocation();
+ long getPeakMemoryAllocation();
/**
* Returns the amount of memory that can probably be allocated at this moment
@@ -134,21 +134,21 @@ public BufferAllocator newChildAllocator(
*
* @return Headroom in bytes
*/
- public long getHeadroom();
+ long getHeadroom();
/**
* Returns the parent allocator.
*
* @return parent allocator
*/
- public BufferAllocator getParentAllocator();
+ BufferAllocator getParentAllocator();
/**
* Returns the set of child allocators.
*
* @return set of child allocators
*/
- public Collection getChildAllocators();
+ Collection getChildAllocators();
/**
* Create an allocation reservation. A reservation is a way of building up
@@ -157,7 +157,7 @@ public BufferAllocator newChildAllocator(
* @return the newly created reservation
* @see AllocationReservation
*/
- public AllocationReservation newReservation();
+ AllocationReservation newReservation();
/**
* Get a reference to the empty buffer associated with this allocator. Empty buffers are
@@ -167,7 +167,7 @@ public BufferAllocator newChildAllocator(
*
* @return the empty buffer
*/
- public ArrowBuf getEmpty();
+ ArrowBuf getEmpty();
/**
* Return the name of this allocator. This is a human readable name that can help debugging.
@@ -176,7 +176,7 @@ public BufferAllocator newChildAllocator(
*
* @return the name of the allocator
*/
- public String getName();
+ String getName();
/**
* Return whether or not this allocator (or one if its parents) is over its limits. In the case
@@ -186,7 +186,7 @@ public BufferAllocator newChildAllocator(
*
* @return whether or not this allocator (or one if its parents) is over its limits
*/
- public boolean isOverLimit();
+ boolean isOverLimit();
/**
* Return a verbose string describing this allocator. If in DEBUG mode, this will also include
@@ -195,12 +195,12 @@ public BufferAllocator newChildAllocator(
*
* @return A very verbose description of the allocator hierarchy.
*/
- public String toVerboseString();
+ String toVerboseString();
/**
* Asserts (using java assertions) that the provided allocator is currently open. If assertions
* are disabled, this is
* a no-op.
*/
- public void assertOpen();
+ void assertOpen();
}
diff --git a/java/memory/src/main/java/org/apache/arrow/memory/BufferManager.java b/java/memory/src/main/java/org/apache/arrow/memory/BufferManager.java
index e85291a3e2fd3..19575f0f9f90b 100644
--- a/java/memory/src/main/java/org/apache/arrow/memory/BufferManager.java
+++ b/java/memory/src/main/java/org/apache/arrow/memory/BufferManager.java
@@ -34,14 +34,14 @@ public interface BufferManager extends AutoCloseable {
* @param newSize Size of new replacement buffer.
* @return A new version of the buffer.
*/
- public ArrowBuf replace(ArrowBuf old, int newSize);
+ ArrowBuf replace(ArrowBuf old, int newSize);
/**
* Get a managed buffer of indeterminate size.
*
* @return A buffer.
*/
- public ArrowBuf getManagedBuffer();
+ ArrowBuf getManagedBuffer();
/**
* Get a managed buffer of at least a certain size.
@@ -49,7 +49,7 @@ public interface BufferManager extends AutoCloseable {
* @param size The desired size
* @return A buffer
*/
- public ArrowBuf getManagedBuffer(int size);
+ ArrowBuf getManagedBuffer(int size);
- public void close();
+ void close();
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/BaseVariableWidthVector.java b/java/vector/src/main/java/org/apache/arrow/vector/BaseVariableWidthVector.java
index b5667df3ad3cd..eb99056267244 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/BaseVariableWidthVector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/BaseVariableWidthVector.java
@@ -24,6 +24,7 @@
import org.apache.arrow.memory.BaseAllocator;
import org.apache.arrow.memory.BufferAllocator;
+import org.apache.arrow.memory.OutOfMemoryException;
import org.apache.arrow.vector.ipc.message.ArrowFieldNode;
import org.apache.arrow.vector.types.pojo.Field;
import org.apache.arrow.vector.types.pojo.FieldType;
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/FieldVector.java b/java/vector/src/main/java/org/apache/arrow/vector/FieldVector.java
index 04274a2602d8b..8ecec93dd62f8 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/FieldVector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/FieldVector.java
@@ -73,19 +73,19 @@ public interface FieldVector extends ValueVector {
*
* @return buffer address
*/
- public long getValidityBufferAddress();
+ long getValidityBufferAddress();
/**
* Gets the starting address of the underlying buffer associated with data vector.
*
* @return buffer address
*/
- public long getDataBufferAddress();
+ long getDataBufferAddress();
/**
* Gets the starting address of the underlying buffer associated with offset vector.
*
* @return buffer address
*/
- public long getOffsetBufferAddress();
+ long getOffsetBufferAddress();
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/complex/Positionable.java b/java/vector/src/main/java/org/apache/arrow/vector/complex/Positionable.java
index d1985c10a4b0c..dda4954081624 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/complex/Positionable.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/complex/Positionable.java
@@ -23,7 +23,7 @@
*/
@SuppressWarnings("unused") // Used in when instantiating freemarker templates.
public interface Positionable {
- public int getPosition();
+ int getPosition();
- public void setPosition(int index);
+ void setPosition(int index);
}
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/util/ByteFunctionHelpers.java b/java/vector/src/main/java/org/apache/arrow/vector/util/ByteFunctionHelpers.java
index d3179c16fd9f1..8140103bfc4bc 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/util/ByteFunctionHelpers.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/util/ByteFunctionHelpers.java
@@ -49,7 +49,7 @@ public static final int equal(final ArrowBuf left, int lStart, int lEnd, final A
return memEqual(left.memoryAddress(), lStart, lEnd, right.memoryAddress(), rStart, rEnd);
}
- private static final int memEqual(final long laddr, int lStart, int lEnd, final long raddr, int rStart,
+ private static int memEqual(final long laddr, int lStart, int lEnd, final long raddr, int rStart,
final int rEnd) {
int n = lEnd - lStart;
@@ -109,7 +109,7 @@ public static final int compare(
return memcmp(left.memoryAddress(), lStart, lEnd, right.memoryAddress(), rStart, rEnd);
}
- private static final int memcmp(
+ private static int memcmp(
final long laddr,
int lStart,
int lEnd,
@@ -190,7 +190,7 @@ public static int unsignedLongCompare(long a, long b) {
}
- private static final int memcmp(
+ private static int memcmp(
final long laddr,
int lStart,
int lEnd,