Skip to content

Commit d184339

Browse files
committed
Bug: "Comparing identical expressions" warnings in DoubleTest/FloatTest
This is related to tests like this: assertTrue("-0d should be == 0d", 0d == -0d); I.e. the warning can be ignored, as we are explicitly checking for identical expressions. Fix: add '@SuppressWarnings("all") // "Comparing identical expressions" ...' to the methods raising the warning.
1 parent da4c407 commit d184339

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

tests/net.sf.j2s.test.junit/src/net/sf/j2s/test/junit/DoubleTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,7 @@ public void test_doubleValue() {
392392
/**
393393
* @tests java.lang.Double#equals(java.lang.Object)
394394
*/
395+
@SuppressWarnings("all") // "Comparing identical expressions" 0d == -0d
395396
public void test_equalsLjava_lang_Object() {
396397
// Test for method boolean java.lang.Double.equals(java.lang.Object)
397398

tests/net.sf.j2s.test.junit/src/net/sf/j2s/test/junit/FloatTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ public void test_doubleValue() {
202202
/**
203203
* @tests java.lang.Float#equals(java.lang.Object)
204204
*/
205+
@SuppressWarnings("all") // "Comparing identical expressions" 0f == -0f
205206
public void test_equalsLjava_lang_Object() {
206207
// Test for method boolean java.lang.Float.equals(java.lang.Object)
207208

@@ -552,6 +553,7 @@ public void test_toStringF() {
552553
/**
553554
* @tests java.lang.Float#valueOf(java.lang.String)
554555
*/
556+
@SuppressWarnings("all") // "Comparing identical expressions" 0.0f == -0.0f
555557
public void test_valueOfLjava_lang_String() {
556558
// Test for method java.lang.Float
557559
// java.lang.Float.valueOf(java.lang.String)

0 commit comments

Comments
 (0)