Skip to content

Commit

Permalink
ARROW-5672: [Java] Refactor redundant method modifier
Browse files Browse the repository at this point in the history
Related to [ARROW-5672](https://issues.apache.org/jira/browse/ARROW-5672).

Author: tianchen <[email protected]>

Closes #4644 from tianchen92/check_method_modifier and squashes the following commits:

b915d36 <tianchen> fix build fail
846f2f5 <tianchen> Refactor redundant method modifier
  • Loading branch information
tianchen92 authored and emkornfield committed Jun 24, 2019
1 parent c66b695 commit 8b78b07
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 45 deletions.
2 changes: 1 addition & 1 deletion java/dev/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Original file line number Diff line number Diff line change
Expand Up @@ -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();

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> isValid(byte[] token);
Optional<String> isValid(byte[] token);

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public <ReqT, RespT> Listener<ReqT> interceptCall(ServerCall<ReqT, RespT> call,
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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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,
Expand All @@ -91,64 +91,64 @@ public BufferAllocator newChildAllocator(
* 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
* without exceeding this or any parents allocation maximum.
*
* @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
Expand All @@ -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
Expand All @@ -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.
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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();
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,22 @@ 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.
*
* @param size The desired size
* @return A buffer
*/
public ArrowBuf getManagedBuffer(int size);
ArrowBuf getManagedBuffer(int size);

public void close();
void close();
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 8b78b07

Please sign in to comment.