Fix two PMD issues, but comment others where if's were added for readability

This commit is contained in:
Bruno P. Kinoshita 2017-09-13 00:44:46 +12:00
parent 55e8eac25d
commit 9ae946c7da
9 changed files with 16 additions and 21 deletions

View File

@ -193,12 +193,12 @@ public class PrototypeFactory {
if (bais != null) {
bais.close();
}
} catch (final IOException ex) {
} catch (final IOException ex) { //NOPMD
// ignore
}
try {
baos.close();
} catch (final IOException ex) {
} catch (final IOException ex) { //NOPMD
// ignore
}
}

View File

@ -96,10 +96,8 @@ public class FilterIterator<E> implements Iterator<E> {
*/
@Override
public E next() {
if (!nextObjectSet) {
if (!setNextObject()) {
throw new NoSuchElementException();
}
if (!nextObjectSet && !setNextObject()) {
throw new NoSuchElementException();
}
nextObjectSet = false;
return nextObject;

View File

@ -132,10 +132,8 @@ public class FilterListIterator<E> implements ListIterator<E> {
@Override
public E next() {
if (!nextObjectSet) {
if (!setNextObject()) {
throw new NoSuchElementException();
}
if (!nextObjectSet && !setNextObject()) {
throw new NoSuchElementException();
}
nextIndex++;
final E temp = nextObject;
@ -150,10 +148,8 @@ public class FilterListIterator<E> implements ListIterator<E> {
@Override
public E previous() {
if (!previousObjectSet) {
if (!setPreviousObject()) {
throw new NoSuchElementException();
}
if (!previousObjectSet && !setPreviousObject()) {
throw new NoSuchElementException();
}
nextIndex--;
final E temp = previousObject;

View File

@ -116,7 +116,7 @@ public class PermutationIterator<E> implements Iterator<List<E>> {
for (int i = 0; i < keys.length; i++) {
if ((direction[i] && i < keys.length - 1 && keys[i] > keys[i + 1]) ||
(!direction[i] && i > 0 && keys[i] > keys[i - 1])) {
if (keys[i] > largestKey) {
if (keys[i] > largestKey) { // NOPMD
largestKey = keys[i];
indexOfLargestMobileInteger = i;
}

View File

@ -48,7 +48,7 @@ public abstract class AbstractMapEntry<K, V> extends AbstractKeyValue<K, V> impl
* @return the previous value
*/
@Override
public V setValue(final V value) {
public V setValue(final V value) { // NOPMD
return super.setValue(value);
}

View File

@ -291,7 +291,8 @@ public abstract class AbstractReferenceMap<K, V> extends AbstractHashedMap<K, V>
@Override
public void clear() {
super.clear();
while (queue.poll() != null) {} // drain the queue
// drain the queue
while (queue.poll() != null) {} // NOPMD
}
//-----------------------------------------------------------------------

View File

@ -309,7 +309,7 @@ public class MultiValueMap<K, V> extends AbstractMapDecorator<K, Object> impleme
* @see #iterator()
*/
@Override
public Set<Entry<K, Object>> entrySet() {
public Set<Entry<K, Object>> entrySet() { // NOPMD
return super.entrySet();
}

View File

@ -201,7 +201,7 @@ public class SequencesComparator<T> {
}
// Second step
if (delta % 2 != 0 && delta - d <= k && k <= delta + d) {
if (vUp[i-delta] <= vDown[i]) {
if (vUp[i-delta] <= vDown[i]) { // NOPMD
return buildSnake(vUp[i-delta], k + start1 - start2, end1, end2);
}
}
@ -227,7 +227,7 @@ public class SequencesComparator<T> {
}
// Second step
if (delta % 2 == 0 && -d <= k && k <= d ) {
if (vUp[i] <= vDown[i + delta]) {
if (vUp[i] <= vDown[i + delta]) { // NOPMD
return buildSnake(vUp[i], k + start1 - start2, end1, end2);
}
}

View File

@ -177,7 +177,7 @@ abstract class AbstractPatriciaTrie<K, V> extends AbstractBitwiseTrie<K, V> {
// This is a very special and rare case.
/* REPLACE OLD KEY+VALUE */
if (found != root) {
if (found != root) { // NOPMD
incrementModCount();
return found.setKeyValue(key, value);
}