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

mattjuntunen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-geometry.git


The following commit(s) were added to refs/heads/master by this push:
     new 1c362b31 fixing spotbugs issues
1c362b31 is described below

commit 1c362b31d5c134c25a3ded73f5d1778216cc086c
Author: Matt <mattjuntu...@apache.org>
AuthorDate: Sat Apr 30 00:50:42 2022 -0400

    fixing spotbugs issues
---
 .../geometry/core/internal/AbstractBucketPointMap.java   | 16 ++++++++--------
 src/main/resources/spotbugs/spotbugs-exclude-filter.xml  | 10 ++++++++++
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git 
a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/internal/AbstractBucketPointMap.java
 
b/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/internal/AbstractBucketPointMap.java
index 3e0d5ec6..ddc4bcc5 100644
--- 
a/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/internal/AbstractBucketPointMap.java
+++ 
b/commons-geometry-core/src/main/java/org/apache/commons/geometry/core/internal/AbstractBucketPointMap.java
@@ -103,7 +103,7 @@ public abstract class AbstractBucketPointMap<P extends 
Point<P>, V>
     /** Secondary tree root. */
     private BucketNode<P, V> secondaryRoot;
 
-    /** Cached entry set instance. */
+    /** Cached entry set; instances are stateless so we need only one. */
     private EntrySet entrySetInstance;
 
     /** Version counter, used to track tree modifications. */
@@ -517,13 +517,6 @@ public abstract class AbstractBucketPointMap<P extends 
Point<P>, V>
             this.entries = map.createEntryList();
         }
 
-        /** Get the parent node or null if one does not exist.
-         * @return parent node or null if one does not exist.
-         */
-        public BucketNode<P, V> getParent() {
-            return parent;
-        }
-
         /** Get the index of this node in its parent, or {@code -1} if this
          * node does not have a parent.
          * @return index of this node in its parent, or {@code -1} if this
@@ -1007,6 +1000,13 @@ public abstract class AbstractBucketPointMap<P extends 
Point<P>, V>
             entries = null;
         }
 
+        /** Get the parent node or null if one does not exist.
+         * @return parent node or null if one does not exist.
+         */
+        protected BucketNode<P, V> getParent() {
+            return parent;
+        }
+
         /** Get the precision context for the instance.
          * @return precision context for the instance
          */
diff --git a/src/main/resources/spotbugs/spotbugs-exclude-filter.xml 
b/src/main/resources/spotbugs/spotbugs-exclude-filter.xml
index a3d2782c..3c953c8e 100644
--- a/src/main/resources/spotbugs/spotbugs-exclude-filter.xml
+++ b/src/main/resources/spotbugs/spotbugs-exclude-filter.xml
@@ -86,4 +86,14 @@
     <BugPattern name="EI_EXPOSE_REP,EI_EXPOSE_REP2"/>
   </Match>
 
+  <!--
+    AbstractBucketPointMap.entrySetInstance is stateless and can be cached and 
reused without
+    exposing implementation internals.
+  -->
+  <Match>
+    <Class 
name="org.apache.commons.geometry.core.internal.AbstractBucketPointMap" />
+    <Field name="entrySetInstance" />
+    <BugPattern name="EI_EXPOSE_REP"/>
+  </Match>
+
 </FindBugsFilter>

Reply via email to