You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/01/19 18:51:00 UTC

[jira] [Commented] (BEAM-413) Mean$CountSum tests for floating point equality

    [ https://issues.apache.org/jira/browse/BEAM-413?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16332742#comment-16332742 ] 

ASF GitHub Bot commented on BEAM-413:
-------------------------------------

kennknowles closed pull request #4219: [BEAM-413] Created local annotation for floating point equality warning.
URL: https://github.com/apache/beam/pull/4219
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/sdks/java/build-tools/src/main/resources/beam/findbugs-filter.xml b/sdks/java/build-tools/src/main/resources/beam/findbugs-filter.xml
index 2035f854203..ca0989c657c 100644
--- a/sdks/java/build-tools/src/main/resources/beam/findbugs-filter.xml
+++ b/sdks/java/build-tools/src/main/resources/beam/findbugs-filter.xml
@@ -331,12 +331,6 @@
     <Bug pattern="EQ_COMPARETO_USE_OBJECT_EQUALS"/>
     <!--[BEAM-410] Class defines compareTo(...) and uses Object.equals()-->
   </Match>
-  <Match>
-    <Class name="org.apache.beam.sdk.transforms.Mean$CountSum"/>
-    <Method name="equals"/>
-    <Bug pattern="FE_FLOATING_POINT_EQUALITY"/>
-    <!--[BEAM-413] Test for floating point equality-->
-  </Match>
   <Match>
     <Class name="org.apache.beam.sdk.util.CombineFnUtil$NonSerializableBoundedCombineFn"/>
     <Field name="context"/>
diff --git a/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Mean.java b/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Mean.java
index 8932b03e527..69deddb276e 100644
--- a/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Mean.java
+++ b/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Mean.java
@@ -156,6 +156,10 @@ public Double extractOutput() {
     }
 
     @Override
+    @edu.umd.cs.findbugs.annotations.SuppressWarnings(
+        value = "FE_FLOATING_POINT_EQUALITY",
+        justification = "Comparing doubles directly since equals method is only used in coder test."
+    )
     public boolean equals(Object other) {
       if (!(other instanceof CountSum)) {
         return false;


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Mean$CountSum tests for floating point equality
> -----------------------------------------------
>
>                 Key: BEAM-413
>                 URL: https://issues.apache.org/jira/browse/BEAM-413
>             Project: Beam
>          Issue Type: Bug
>          Components: sdk-java-core
>            Reporter: Scott Wegner
>            Assignee: Batkhuyag Batsaikhan
>            Priority: Minor
>              Labels: findbugs, newbie, starter
>
> [FindBugs FE_FLOATING_POINT_EQUALITY|https://github.com/apache/incubator-beam/blob/58a029a06aea1030279e5da8f9fa3114f456c1db/sdks/java/build-tools/src/main/resources/beam/findbugs-filter.xml#L298]: Test for floating point equality
> Applies to: [Mean$CountSum.equals|https://github.com/apache/incubator-beam/blob/58a029a06aea1030279e5da8f9fa3114f456c1db/sdks/java/core/src/main/java/org/apache/beam/sdk/transforms/Mean.java#L165].
> This is a good starter bug. When fixing, please remove the corresponding entries from [findbugs-filter.xml|https://github.com/apache/incubator-beam/blob/master/sdks/java/build-tools/src/main/resources/beam/findbugs-filter.xml] and verify the build passes.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)