Skip to content

Commit

Permalink
Another round to remove final modifier to private methods because it …
Browse files Browse the repository at this point in the history
…is not needed

Remove final modifier to private methods because it is not needed.
Those methods are final by default.

Author: Henry Saputra <[email protected]>

Closes apache#168 from hsaputra/remove_final_privatemethods_1 and squashes the following commits:

860b512 [Henry Saputra] Remove final modifier to private methods because it is not needed. It is final by default.
  • Loading branch information
hsaputra committed Oct 31, 2014
1 parent 36a8fda commit f5898a0
Show file tree
Hide file tree
Showing 26 changed files with 49 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ public void join() throws InterruptedException {
* @throws IOException
* Thrown, if the directory could not be created, or if one of the checks failed.
*/
private final void checkAndCreateDirectories(File f, boolean needWritePermission) throws IOException {
private void checkAndCreateDirectories(File f, boolean needWritePermission) throws IOException {
String dir = f.getAbsolutePath();

// check if it exists and it is not a directory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -586,13 +586,13 @@ protected final boolean readLine() throws IOException {
}
}

private final void setResult(byte[] buffer, int offset, int len) {
private void setResult(byte[] buffer, int offset, int len) {
this.currBuffer = buffer;
this.currOffset = offset;
this.currLen = len;
}

private final boolean fillBuffer() throws IOException {
private boolean fillBuffer() throws IOException {
// special case for reading the whole split.
if(this.splitLength == FileInputFormat.READ_WHOLE_SPLIT_FLAG) {
int read = this.stream.read(this.readBuffer, 0, readBuffer.length);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ public FSDataInputStream waitForCompletion() throws Throwable {
/**
* Double checked procedure setting the abort flag and closing the stream.
*/
private final void abortWait() {
private void abortWait() {
this.aborted = true;
final FSDataInputStream inStream = this.fdis;
this.fdis = null;
Expand Down
16 changes: 8 additions & 8 deletions flink-core/src/main/java/org/apache/flink/types/Record.java
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ public void getFieldsIntoCheckingNull(int[] positions, Value[] targets) {
* @param offset The offset in the binary string.
* @param limit The limit in the binary string.
*/
private final <T extends Value> void deserialize(T target, int offset, int limit, int fieldNumber) {
private <T extends Value> void deserialize(T target, int offset, int limit, int fieldNumber) {
final InternalDeSerializer serializer = this.serializer;
serializer.memory = this.binaryData;
serializer.position = offset;
Expand Down Expand Up @@ -419,20 +419,20 @@ public void addField(Value value) {
internallySetField(num, value);
}

private final void internallySetField(int fieldNum, Value value) {
private void internallySetField(int fieldNum, Value value) {
// check if we modify an existing field
this.offsets[fieldNum] = value != null ? MODIFIED_INDICATOR_OFFSET : NULL_INDICATOR_OFFSET;
this.writeFields[fieldNum] = value;
markModified(fieldNum);
}

private final void markModified(int field) {
private void markModified(int field) {
if (this.firstModifiedPos > field) {
this.firstModifiedPos = field;
}
}

private final boolean isModified() {
private boolean isModified() {
return this.firstModifiedPos != Integer.MAX_VALUE;
}

Expand Down Expand Up @@ -1001,7 +1001,7 @@ public void updateBinaryRepresenation() {
this.firstModifiedPos = Integer.MAX_VALUE;
}

private final void serializeHeader(final InternalDeSerializer serializer, final int[] offsets, final int numFields) {
private void serializeHeader(final InternalDeSerializer serializer, final int[] offsets, final int numFields) {
try {
if (numFields > 0) {
int slp = serializer.position; // track the last position of the serializer
Expand Down Expand Up @@ -1102,7 +1102,7 @@ public void read(DataInputView in) throws IOException {
initFields(data, 0, len);
}

private final void initFields(final byte[] data, final int begin, final int len) {
private void initFields(final byte[] data, final int begin, final int len) {
try {
// read number of fields, variable length encoded reverse at the back
int pos = begin + len - 2;
Expand Down Expand Up @@ -1734,7 +1734,7 @@ public void writeUTF(String str) throws IOException {
this.position = count;
}

private final void writeValLenIntBackwards(int value) throws IOException {
private void writeValLenIntBackwards(int value) throws IOException {
if (this.position > this.memory.length - 4) {
resize(4);
}
Expand Down Expand Up @@ -1766,7 +1766,7 @@ else if (value <= 0xfffffff) {
}
}

private final void resize(int minCapacityAdd) throws IOException {
private void resize(int minCapacityAdd) throws IOException {
try {
final int newLen = Math.max(this.memory.length * 2, this.memory.length + minCapacityAdd);
final byte[] nb = new byte[newLen];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ public void copy(DataInputView in, DataOutputView target) throws IOException {
// Utilities
// --------------------------------------------------------------------------------------------

private final void ensureSize(int size) {
private void ensureSize(int size) {
if (this.value.length < size) {
this.value = new char[size];
}
Expand All @@ -726,7 +726,7 @@ private final void ensureSize(int size) {
/**
* Grow and retain content.
*/
private final void grow(int size) {
private void grow(int size) {
if (this.value.length < size) {
char[] value = new char[ Math.max(this.value.length * 3 / 2, size)];
System.arraycopy(this.value, 0, value, 0, this.len);
Expand All @@ -738,7 +738,7 @@ private final void grow(int size) {
// Static Helpers for String Serialization
// --------------------------------------------------------------------------------------------

public static final String readString(DataInput in) throws IOException {
public static String readString(DataInput in) throws IOException {
// the length we read is offset by one, because a length of zero indicates a null value
int len = in.readUnsignedByte();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ public void testUnionFields()
}
}

private final void testUnionFieldsForValues(Value[] rec1fields, Value[] rec2fields, Random rnd)
private void testUnionFieldsForValues(Value[] rec1fields, Value[] rec2fields, Random rnd)
{
// fully in binary sync
Record rec1 = createRecord(rec1fields);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public void copy(DataInputView source, DataOutputView target) throws IOException
}


private final void checkAvroInitialized() {
private void checkAvroInitialized() {
if (this.reader == null) {
this.reader = new ReflectDatumReader<T>(type);
this.writer = new ReflectDatumWriter<T>(type);
Expand All @@ -151,7 +151,7 @@ private final void checkAvroInitialized() {
}
}

private final void checkKryoInitialized() {
private void checkKryoInitialized() {
if (this.kryo == null) {
this.kryo = new Kryo();
this.kryo.setAsmEnabled(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void copy(DataInputView source, DataOutputView target) throws IOException

// --------------------------------------------------------------------------------------------

private final void ensureInstanceInstantiated() {
private void ensureInstanceInstantiated() {
if (instance == null) {
instance = createInstance();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public TypeComparator<T> duplicate() {
return new GenericTypeComparator<T>(this);
}

private final void checkKryoInitialized() {
private void checkKryoInitialized() {
if (this.kryo == null) {
this.kryo = new Kryo();
this.kryo.setAsmEnabled(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public boolean equals(Object obj) {

// --------------------------------------------------------------------------------------------

private final void checkKryoInitialized() {
private void checkKryoInitialized() {
if (this.kryo == null) {
this.kryo = new Kryo();
this.kryo.setAsmEnabled(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public TypeComparator<T> duplicate() {
return new ValueComparator<T>(ascendingComparison, type);
}

private final void checkKryoInitialized() {
private void checkKryoInitialized() {
if (this.kryo == null) {
this.kryo = new Kryo();
this.kryo.setAsmEnabled(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public void copy(DataInputView source, DataOutputView target) throws IOException
this.copyInstance.write(target);
}

private final void checkKryoInitialized() {
private void checkKryoInitialized() {
if (this.kryo == null) {
this.kryo = new Kryo();
this.kryo.setAsmEnabled(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,21 +159,21 @@ public T readWithKeyDenormalization(T reuse, DataInputView source) throws IOExce

// --------------------------------------------------------------------------------------------

private final void checkKryoInitialized() {
private void checkKryoInitialized() {
if (this.kryo == null) {
this.kryo = new Kryo();
this.kryo.setAsmEnabled(true);
this.kryo.register(type);
}
}

private final void ensureReferenceInstantiated() {
private void ensureReferenceInstantiated() {
if (reference == null) {
reference = InstantiationUtil.instantiate(type, Writable.class);
}
}

private final void ensureTempReferenceInstantiated() {
private void ensureTempReferenceInstantiated() {
if (tempReference == null) {
tempReference = InstantiationUtil.instantiate(type, Writable.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ public boolean isStateful() {

// --------------------------------------------------------------------------------------------

private final void ensureInstanceInstantiated() {
private void ensureInstanceInstantiated() {
if (copyInstance == null) {
copyInstance = createInstance();
}
}

private final void checkKryoInitialized() {
private void checkKryoInitialized() {
if (this.kryo == null) {
this.kryo = new Kryo();
this.kryo.setAsmEnabled(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public void testBeanStyleObjects() {
}
}

private final <T> void runTests(T[]... instances) {
private <T> void runTests(T[]... instances) {
try {
@SuppressWarnings("unchecked")
Class<T> type = (Class<T>) instances[0][0].getClass();
Expand All @@ -158,7 +158,7 @@ private final <T> void runTests(T[]... instances) {
}
}

private final <T> void runTests(Class<T> type, TypeSerializer<T> componentSerializer, T[]... instances) {
private <T> void runTests(Class<T> type, TypeSerializer<T> componentSerializer, T[]... instances) {
try {
if (type == null || componentSerializer == null || instances == null || instances.length == 0) {
throw new IllegalArgumentException();
Expand All @@ -178,7 +178,7 @@ private final <T> void runTests(Class<T> type, TypeSerializer<T> componentSerial
}
}

private final <T> GenericArraySerializer<T> createSerializer(Class<T> type, TypeSerializer<T> componentSerializer) {
private <T> GenericArraySerializer<T> createSerializer(Class<T> type, TypeSerializer<T> componentSerializer) {
return new GenericArraySerializer<T>(type, componentSerializer);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public void testBeanStyleObjects() {

// ------------------------------------------------------------------------

private final <T> void runTests(T... sortedTestData) {
private <T> void runTests(T... sortedTestData) {
ComparatorTestInstance<T> testBase = new ComparatorTestInstance<T>(sortedTestData);
testBase.testAll();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public void testBeanStyleObjects() {
}
}

private final <T> void runTests(T... instances) {
private <T> void runTests(T... instances) {
if (instances == null || instances.length == 0) {
throw new IllegalArgumentException();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ else if (this.position > this.buffer.length - utflen - 2) {
}


private final void resize(int minCapacityAdd) throws IOException {
private void resize(int minCapacityAdd) throws IOException {
try {
final int newLen = Math.max(this.buffer.length * 2, this.buffer.length + minCapacityAdd);
final byte[] nb = new byte[newLen];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public void testTuple5CustomObjects() {
runTests(testTuples);
}

private final <T extends Tuple> void runTests(T... instances) {
private <T extends Tuple> void runTests(T... instances) {
try {
TupleTypeInfo<T> tupleTypeInfo = (TupleTypeInfo<T>) TypeExtractor.getForObject(instances[0]);
TypeSerializer<T> serializer = tupleTypeInfo.createSerializer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ protected final MemorySegment nextSegment(MemorySegment current, int posInSegmen
return next;
}

private final void writeSegment(MemorySegment segment, int writePosition, boolean lastSegment) throws IOException
private void writeSegment(MemorySegment segment, int writePosition, boolean lastSegment) throws IOException
{
segment.putShort(0, HEADER_MAGIC_NUMBER);
segment.putShort(HEADER_FLAGS_OFFSET, lastSegment ? FLAG_LAST_BLOCK : 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ else if (this.position > this.buffer.length - utflen - 2) {
}


private final void resize(int minCapacityAdd) throws IOException {
private void resize(int minCapacityAdd) throws IOException {
try {
final int newLen = Math.max(this.buffer.length * 2, this.buffer.length + minCapacityAdd);
final byte[] nb = new byte[newLen];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ public void insertOrReplaceRecord(T record, T tempHolder) throws IOException {
}
}

private final void insertBucketEntryFromStart(InMemoryPartition<T> p, MemorySegment bucket,
private void insertBucketEntryFromStart(InMemoryPartition<T> p, MemorySegment bucket,
int bucketInSegmentPos, int hashCode, long pointer)
throws IOException
{
Expand Down Expand Up @@ -639,7 +639,7 @@ private final void insertBucketEntryFromStart(InMemoryPartition<T> p, MemorySegm
}
}

private final void insertBucketEntryFromSearch(InMemoryPartition<T> partition, MemorySegment originalBucket, MemorySegment currentBucket, int originalBucketOffset, int currentBucketOffset, int countInCurrentBucket, long currentForwardPointer, int hashCode, long pointer) throws IOException {
private void insertBucketEntryFromSearch(InMemoryPartition<T> partition, MemorySegment originalBucket, MemorySegment currentBucket, int originalBucketOffset, int currentBucketOffset, int countInCurrentBucket, long currentForwardPointer, int hashCode, long pointer) throws IOException {
boolean checkForResize = false;
if (countInCurrentBucket < NUM_ENTRIES_PER_BUCKET) {
// we are good in our current bucket, put the values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ MemorySegment[] close() throws IOException
}
}

private final void finalizeSegment(MemorySegment seg, int bytesUsed) {
private void finalizeSegment(MemorySegment seg, int bytesUsed) {
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public final void clear() {
size = 0;
}

private final void upHeap() {
private void upHeap() {
int i = size;
T node = heap[i]; // save bottom node
int j = i >>> 1;
Expand All @@ -209,7 +209,7 @@ private final void upHeap() {
heap[i] = node; // install saved node
}

private final void downHeap() {
private void downHeap() {
int i = 1;
T node = heap[i]; // save top node
int j = i << 1; // find smaller child
Expand Down
Loading

0 comments on commit f5898a0

Please sign in to comment.