github-code-scanning[bot] commented on code in PR #709:
URL: 
https://github.com/apache/incubator-baremaps/pull/709#discussion_r1238945974


##########
baremaps-core/src/main/java/org/apache/baremaps/collection/type/IntegerArrayDataType.java:
##########
@@ -0,0 +1,55 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not 
use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+
+package org.apache.baremaps.collection.type;
+
+
+
+import java.nio.ByteBuffer;
+
+/** A {@link DataType} for reading and writing lists of integers in {@link 
ByteBuffer}s. */
+public class IntegerArrayDataType implements DataType<int[]> {
+
+  /** {@inheritDoc} */
+  @Override
+  public int size(final int[] values) {
+    return Integer.BYTES + values.length * Integer.BYTES;
+  }
+
+  @Override
+  public int size(final ByteBuffer buffer, final int position) {
+    return buffer.getInt(position);
+  }
+
+  /** {@inheritDoc} */
+  @Override
+  public void write(final ByteBuffer buffer, final int position, final int[] 
values) {
+    buffer.putInt(position, size(values));
+    var p = position + Integer.BYTES;
+    for (Integer value : values) {

Review Comment:
   ## Boxed variable is never null
   
   The variable 'value' is only assigned values of primitive type and is never 
'null', but it is declared with the boxed type 'Integer'.
   
   [Show more 
details](https://github.com/apache/incubator-baremaps/security/code-scanning/695)



##########
baremaps-core/src/main/java/org/apache/baremaps/collection/type/ShortArrayDataType.java:
##########
@@ -0,0 +1,56 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not 
use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+
+package org.apache.baremaps.collection.type;
+
+
+
+import java.nio.ByteBuffer;
+
+/** A {@link DataType} for reading and writing lists of shorts in {@link 
ByteBuffer}s. */
+public class ShortArrayDataType implements DataType<short[]> {
+
+  /** {@inheritDoc} */
+  @Override
+  public int size(final short[] values) {
+    return Integer.BYTES + values.length * Short.BYTES;
+  }
+
+  /** {@inheritDoc} */
+  @Override
+  public int size(final ByteBuffer buffer, final int position) {
+    return buffer.getInt(position);
+  }
+
+  /** {@inheritDoc} */
+  @Override
+  public void write(final ByteBuffer buffer, final int position, final short[] 
values) {
+    buffer.putInt(position, size(values));
+    var p = position + Integer.BYTES;
+    for (Short value : values) {

Review Comment:
   ## Boxed variable is never null
   
   The variable 'value' is only assigned values of primitive type and is never 
'null', but it is declared with the boxed type 'Short'.
   
   [Show more 
details](https://github.com/apache/incubator-baremaps/security/code-scanning/697)



##########
baremaps-core/src/main/java/org/apache/baremaps/collection/type/LongArrayDataType.java:
##########
@@ -0,0 +1,56 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not 
use this file except
+ * in compliance with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+
+package org.apache.baremaps.collection.type;
+
+
+
+import java.nio.ByteBuffer;
+
+/** A {@link DataType} for reading and writing lists of longs in {@link 
ByteBuffer}s. */
+public class LongArrayDataType implements DataType<long[]> {
+
+  /** {@inheritDoc} */
+  @Override
+  public int size(final long[] values) {
+    return Integer.BYTES + values.length * Long.BYTES;
+  }
+
+  /** {@inheritDoc} */
+  @Override
+  public int size(final ByteBuffer buffer, final int position) {
+    return buffer.getInt(position);
+  }
+
+  /** {@inheritDoc} */
+  @Override
+  public void write(final ByteBuffer buffer, final int position, final long[] 
values) {
+    buffer.putInt(position, size(values));
+    var p = position + Integer.BYTES;
+    for (Long value : values) {

Review Comment:
   ## Boxed variable is never null
   
   The variable 'value' is only assigned values of primitive type and is never 
'null', but it is declared with the boxed type 'Long'.
   
   [Show more 
details](https://github.com/apache/incubator-baremaps/security/code-scanning/696)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to