Skip to content

Commit b0ca438

Browse files
committed
PMD warning suppression changes
1 parent 373c8bd commit b0ca438

File tree

9 files changed

+19
-13
lines changed

9 files changed

+19
-13
lines changed

src/main/java/org/lmdbjava/BufferProxy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* @param <T> buffer type
3535
*/
3636
@SuppressWarnings("checkstyle:abstractclassname")
37-
public abstract class BufferProxy<T> { // NOPMD
37+
public abstract class BufferProxy<T> {
3838

3939
/**
4040
* Size of a <code>MDB_val</code> pointer in bytes.

src/main/java/org/lmdbjava/ByteBufferProxy.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
* {@link #PROXY_OPTIMAL} or {@link #PROXY_SAFE} field when invoking
5050
* {@link Env#create(org.lmdbjava.BufferProxy)}.
5151
*/
52+
@SuppressWarnings("PMD.AvoidCatchingGenericException")
5253
public final class ByteBufferProxy {
5354

5455
/**
@@ -76,7 +77,7 @@ private ByteBufferProxy() {
7677
private static BufferProxy<ByteBuffer> getProxyOptimal() {
7778
try {
7879
return new UnsafeProxy();
79-
} catch (final RuntimeException e) { // NOPMD
80+
} catch (final RuntimeException e) {
8081
return PROXY_SAFE;
8182
}
8283
}
@@ -120,7 +121,7 @@ abstract static class AbstractByteBufferProxy extends BufferProxy<ByteBuffer> {
120121
* @param o2 right operand (required)
121122
* @return as specified by {@link Comparable} interface
122123
*/
123-
@SuppressWarnings({"checkstyle:ReturnCount", "PMD.NPathComplexity"})
124+
@SuppressWarnings({"checkstyle:ReturnCount", "PMD.CyclomaticComplexity"})
124125
public static int compareBuff(final ByteBuffer o1, final ByteBuffer o2) {
125126
requireNonNull(o1);
126127
requireNonNull(o2);

src/main/java/org/lmdbjava/CursorIterator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ public void remove() {
9595
cursor.delete();
9696
}
9797

98+
@SuppressWarnings({"PMD.CyclomaticComplexity", "PMD.NullAssignment"})
9899
private void executeCursorOp(final CursorOp op) {
99100
final boolean found;
100101
switch (op) {

src/main/java/org/lmdbjava/Env.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,7 @@ public static final class Builder<T> {
439439
* @param flags the flags for this new environment
440440
* @return an environment ready for use
441441
*/
442+
@SuppressWarnings("PMD.AccessorClassGeneration")
442443
public Env<T> open(final File path, final int mode,
443444
final EnvFlags... flags) {
444445
requireNonNull(path);
@@ -456,7 +457,7 @@ public Env<T> open(final File path, final int mode,
456457
final int flagsMask = mask(flags);
457458
final boolean readOnly = isSet(flagsMask, MDB_RDONLY_ENV);
458459
checkRc(LIB.mdb_env_open(ptr, path.getAbsolutePath(), flagsMask, mode));
459-
return new Env<>(proxy, ptr, readOnly); // NOPMD
460+
return new Env<>(proxy, ptr, readOnly);
460461
} catch (final LmdbNativeException e) {
461462
LIB.mdb_env_close(ptr);
462463
throw e;
@@ -470,8 +471,9 @@ public Env<T> open(final File path, final int mode,
470471
* @param flags the flags for this new environment
471472
* @return an environment ready for use
472473
*/
474+
@SuppressWarnings("PMD.AvoidUsingOctalValues")
473475
public Env<T> open(final File path, final EnvFlags... flags) {
474-
return open(path, 0664, flags); // NOPMD
476+
return open(path, 0664, flags);
475477
}
476478

477479
/**

src/main/java/org/lmdbjava/KeyRangeType.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@
4444
* <p>
4545
* In the examples below, it is assumed the table has keys 2, 4, 6 and 8.
4646
*/
47-
@SuppressWarnings({"PMD.CyclomaticComplexity", "PMD.StdCyclomaticComplexity",
48-
"PMD.ModifiedCyclomaticComplexity"})
47+
@SuppressWarnings("PMD.CyclomaticComplexity")
4948
public enum KeyRangeType {
5049

5150
/**
@@ -376,7 +375,7 @@ CursorOp initialOp() {
376375
* @param c comparator (required)
377376
* @return response to this key
378377
*/
379-
@SuppressWarnings({"checkstyle:ReturnCount", "PMD.NPathComplexity"})
378+
@SuppressWarnings("checkstyle:ReturnCount")
380379
<T, C extends Comparator<T>> IteratorOp iteratorOp(final T start, final T stop,
381380
final T buffer, final C c) {
382381
requireNonNull(c, "Comparator required");

src/main/java/org/lmdbjava/Library.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ final class Library {
113113
private Library() {
114114
}
115115

116-
@SuppressWarnings("NestedAssignment")
116+
@SuppressWarnings("PMD.AssignmentInOperand")
117117
@SuppressFBWarnings("OBL_UNSATISFIED_OBLIGATION") // Spotbugs issue #432
118118
private static String extract(final String name) {
119119
final String suffix = name.substring(name.lastIndexOf('.'));
@@ -200,7 +200,7 @@ public interface ComparatorCallback {
200200
/**
201201
* JNR API for MDB-defined C functions. Not for external use.
202202
*/
203-
@SuppressWarnings({"checkstyle:methodname", "PMD.MethodNamingConventions"})
203+
@SuppressWarnings("checkstyle:methodname")
204204
public interface Lmdb {
205205

206206
void mdb_cursor_close(@In Pointer cursor);

src/main/java/org/lmdbjava/ResultCodeMapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* The immutable nature of all LMDB exceptions means the mapper internally
3535
* maintains a table of them.
3636
*/
37-
@SuppressWarnings({"PMD.CyclomaticComplexity", "PMD.StdCyclomaticComplexity"})
37+
@SuppressWarnings("PMD.CyclomaticComplexity")
3838
final class ResultCodeMapper {
3939

4040
/**

src/test/java/org/lmdbjava/DbiTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@ public void stats() {
385385
}
386386

387387
@Test(expected = MapFullException.class)
388+
@SuppressWarnings("PMD.PreserveStackTrace")
388389
public void testMapFullException() {
389390
final Dbi<ByteBuffer> db = env.openDbi(DB_1, MDB_CREATE);
390391
try (Txn<ByteBuffer> txn = env.txnWrite()) {
@@ -393,7 +394,7 @@ public void testMapFullException() {
393394
v = allocateDirect(1_024 * 1_024 * 1_024);
394395
} catch (final OutOfMemoryError e) {
395396
// Travis CI OS X build cannot allocate this much memory, so assume OK
396-
throw new MapFullException(); // NOPMD
397+
throw new MapFullException();
397398
}
398399
db.put(txn, bb(1), v);
399400
}

src/test/java/org/lmdbjava/TestUtils.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@
3737
final class TestUtils {
3838

3939
public static final String DB_1 = "test-db-1";
40-
public static final int POSIX_MODE = 0664; // NOPMD
40+
41+
@SuppressWarnings("PMD.AvoidUsingOctalValues")
42+
public static final int POSIX_MODE = 0664;
4143

4244
private TestUtils() {
4345
}

0 commit comments

Comments
 (0)