You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by dc...@apache.org on 2021/08/19 14:51:39 UTC

[datasketches-memory] branch release-preparation created (now 3b3fdd5)

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

dcromberge pushed a change to branch release-preparation
in repository https://gitbox.apache.org/repos/asf/datasketches-memory.git.


      at 3b3fdd5  Checkstyle and SpotBugs fixes

This branch includes the following new commits:

     new 3b3fdd5  Checkstyle and SpotBugs fixes

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org


[datasketches-memory] 01/01: Checkstyle and SpotBugs fixes

Posted by dc...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dcromberge pushed a commit to branch release-preparation
in repository https://gitbox.apache.org/repos/asf/datasketches-memory.git

commit 3b3fdd5c104273b7bc65258603f6463687035963
Author: David Cromberge <da...@gmail.com>
AuthorDate: Thu Aug 19 15:49:34 2021 +0100

    Checkstyle and SpotBugs fixes
    
    The following violations were corrected:
    
    - marking fields and parameters as final
    - missing default cases in switch statement
    
    Note that there are 'violations' in the MurmerHashV3 class concerning
    switch fall-throughs.  This is left as-is.
---
 .../org/apache/datasketches/memory/WritableMemory.java  |  2 +-
 .../datasketches/memory/internal/BaseStateImpl.java     | 17 ++++++++++-------
 .../memory/internal/BaseWritableBufferImpl.java         |  2 +-
 .../org/apache/datasketches/memory/internal/Util.java   |  2 +-
 4 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/WritableMemory.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/WritableMemory.java
index c6cb64f..6866862 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/WritableMemory.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/WritableMemory.java
@@ -250,7 +250,7 @@ public interface WritableMemory extends Memory {
    * @return a new WritableMemory for write operations on a new byte array.
    */
   static WritableMemory allocate(int capacityBytes, ByteOrder byteOrder, MemoryRequestServer memReqSvr) {
-    byte[] arr = new byte[capacityBytes];
+    final byte[] arr = new byte[capacityBytes];
     negativeCheck(capacityBytes, "capacityBytes");
     return writableWrap(arr, 0, capacityBytes, byteOrder, memReqSvr);
   }
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseStateImpl.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseStateImpl.java
index 1b92232..0ff2912 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseStateImpl.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseStateImpl.java
@@ -301,7 +301,7 @@ public abstract class BaseStateImpl implements BaseState {
     return (getTypeId() & READONLY) > 0;
   }
 
-  final static byte setReadOnlyType(byte type, boolean readOnly) {
+  final static byte setReadOnlyType(final byte type, final boolean readOnly) {
     return (byte)((type & ~1) | (readOnly ? READONLY : 0));
   }
 
@@ -346,10 +346,9 @@ public abstract class BaseStateImpl implements BaseState {
    * @return a human readable string.
    */
   public static final String typeDecode(final int typeId) {
-    StringBuilder sb = new StringBuilder();
-    int group1 = typeId & 0x7;
+    final StringBuilder sb = new StringBuilder();
+    final int group1 = typeId & 0x7;
     switch (group1) {
-      case 0 : sb.append(""); break;
       case 1 : sb.append("ReadOnly, "); break;
       case 2 : sb.append("Region, "); break;
       case 3 : sb.append("ReadOnly Region, "); break;
@@ -357,23 +356,27 @@ public abstract class BaseStateImpl implements BaseState {
       case 5 : sb.append("ReadOnly Duplicate, "); break;
       case 6 : sb.append("Region Duplicate, "); break;
       case 7 : sb.append("ReadOnly Region Duplicate, "); break;
+      default: break;
     }
-    int group2 = (typeId >>> 3) & 0x3;
+    final int group2 = (typeId >>> 3) & 0x3;
     switch (group2) {
       case 0 : sb.append("Heap, "); break;
       case 1 : sb.append("Direct, "); break;
       case 2 : sb.append("Map, "); break;
       case 3 : sb.append("ByteBuffer, "); break;
+      default: break;
     }
-    int group3 = (typeId >>> 5) & 0x1;
+    final int group3 = (typeId >>> 5) & 0x1;
     switch (group3) {
       case 0 : sb.append("Native, "); break;
       case 1 : sb.append("NonNative, "); break;
+      default: break;
     }
-    int group4 = (typeId >>> 6) & 0x1;
+    final int group4 = (typeId >>> 6) & 0x1;
     switch (group4) {
       case 0 : sb.append("Memory"); break;
       case 1 : sb.append("Buffer"); break;
+      default: break;
     }
     return sb.toString();
   }
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseWritableBufferImpl.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseWritableBufferImpl.java
index 832561f..e1dbe93 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseWritableBufferImpl.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseWritableBufferImpl.java
@@ -80,7 +80,7 @@ public abstract class BaseWritableBufferImpl extends BaseBufferImpl implements W
       final MemoryRequestServer memReqSvr) {
     final AccessByteBuffer abb = new AccessByteBuffer(byteBuf);
     final int typeId = (abb.resourceReadOnly || localReadOnly) ? READONLY : 0;
-    BaseWritableBufferImpl bwbi = Util.isNativeByteOrder(byteOrder)
+    final BaseWritableBufferImpl bwbi = Util.isNativeByteOrder(byteOrder)
         ? new BBWritableBufferImpl(abb.unsafeObj, abb.nativeBaseOffset,
             abb.regionOffset, abb.capacityBytes, typeId, byteBuf, memReqSvr)
         : new BBNonNativeWritableBufferImpl(abb.unsafeObj, abb.nativeBaseOffset,
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/Util.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/Util.java
index f9b1f30..d8768a4 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/Util.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/Util.java
@@ -42,7 +42,7 @@ public final class Util {
   public static final ByteOrder NON_NATIVE_BYTE_ORDER = ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN
       ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN;
 
-  public static ByteOrder otherByteOrder(ByteOrder order) {
+  public static ByteOrder otherByteOrder(final ByteOrder order) {
     return (order == ByteOrder.nativeOrder()) ? NON_NATIVE_BYTE_ORDER : ByteOrder.nativeOrder();
   }
 

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org