You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by em...@apache.org on 2019/06/24 06:57:00 UTC

[arrow] branch master updated: ARROW-5672: [Java] Refactor redundant method modifier

This is an automated email from the ASF dual-hosted git repository.

emkornfield pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new 8b78b07  ARROW-5672: [Java] Refactor redundant method modifier
8b78b07 is described below

commit 8b78b07259ad2f75cd9bc2ea1c7f998b2cb192f5
Author: tianchen <ni...@alibaba-inc.com>
AuthorDate: Sun Jun 23 23:56:29 2019 -0700

    ARROW-5672: [Java] Refactor redundant method modifier
    
    Related to [ARROW-5672](https://issues.apache.org/jira/browse/ARROW-5672).
    
    Author: tianchen <ni...@alibaba-inc.com>
    
    Closes #4644 from tianchen92/check_method_modifier and squashes the following commits:
    
    b915d366d <tianchen> fix build fail
    846f2f5ba <tianchen> Refactor redundant method modifier
---
 java/dev/checkstyle/checkstyle.xml                 |  2 +-
 .../java/org/apache/arrow/flight/FlightClient.java |  8 ++---
 .../arrow/flight/auth/BasicServerAuthHandler.java  |  4 +--
 .../arrow/flight/auth/ServerAuthInterceptor.java   |  2 +-
 .../arrow/gandiva/evaluator/BaseEvaluatorTest.java |  4 +--
 .../apache/arrow/memory/AllocationReservation.java |  6 ++--
 .../org/apache/arrow/memory/BufferAllocator.java   | 40 +++++++++++-----------
 .../org/apache/arrow/memory/BufferManager.java     |  8 ++---
 .../arrow/vector/BaseVariableWidthVector.java      |  1 +
 .../java/org/apache/arrow/vector/FieldVector.java  |  6 ++--
 .../apache/arrow/vector/complex/Positionable.java  |  4 +--
 .../arrow/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 ec84f40..bc26b6b 100644
--- a/java/dev/checkstyle/checkstyle.xml
+++ b/java/dev/checkstyle/checkstyle.xml
@@ -272,7 +272,7 @@
         </module>
         <module name="RedundantModifier">
             <!-- Checks for redundant modifiers on various symbol definitions -->
-            <property name="tokens" value="VARIABLE_DEF, ANNOTATION_FIELD_DEF, INTERFACE_DEF, CLASS_DEF, ENUM_DEF"/>
+            <property name="tokens" value="VARIABLE_DEF, ANNOTATION_FIELD_DEF, INTERFACE_DEF, CLASS_DEF, ENUM_DEF, METHOD_DEF"/>
         </module>
     </module>
 </module>
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 221423e..c70e1fd 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 class FlightClient implements AutoCloseable {
    */
   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 0a51583..0a45edf 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 class BasicServerAuthHandler implements ServerAuthHandler {
    */
   public interface BasicAuthValidator {
 
-    public byte[] getToken(String username, String password) throws Exception;
+    byte[] getToken(String username, String password) throws Exception;
 
-    public Optional<String> isValid(byte[] token);
+    Optional<String> 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 0d5e18f..f38dee7 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 class ServerAuthInterceptor implements ServerInterceptor {
     return next.startCall(call, headers);
   }
 
-  private final Optional<String> isValid(Metadata headers) {
+  private Optional<String> 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 0d7c9e3..9384cd4 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 @@ class BaseEvaluatorTest {
 
   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 c868c16..808b9d0 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 057088e..06cd6d8 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 interface BufferAllocator extends AutoCloseable {
    * that, release all buffers before the allocator is closed.</p>
    */
   @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 interface BufferAllocator extends AutoCloseable {
    *
    * @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<BufferAllocator> getChildAllocators();
+  Collection<BufferAllocator> getChildAllocators();
 
   /**
    * Create an allocation reservation. A reservation is a way of building up
@@ -157,7 +157,7 @@ public interface BufferAllocator extends AutoCloseable {
    * @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 interface BufferAllocator extends AutoCloseable {
    *
    * @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 interface BufferAllocator extends AutoCloseable {
    *
    * @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 interface BufferAllocator extends AutoCloseable {
    *
    * @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 interface BufferAllocator extends AutoCloseable {
    *
    * @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 e85291a..19575f0 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 b5667df..eb99056 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 java.util.List;
 
 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 04274a2..8ecec93 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 d1985c1..dda4954 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 @@ package org.apache.arrow.vector.complex;
  */
 @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 d3179c1..8140103 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 class ByteFunctionHelpers {
     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 class ByteFunctionHelpers {
     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 class ByteFunctionHelpers {
   }
 
 
-  private static final int memcmp(
+  private static int memcmp(
       final long laddr,
       int lStart,
       int lEnd,